05.08.2013 Views

Solaris Application Programming, 1/e - Chapter 4 - Parent Directory

Solaris Application Programming, 1/e - Chapter 4 - Parent Directory

Solaris Application Programming, 1/e - Chapter 4 - Parent Directory

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

54 <strong>Chapter</strong> 4 Informational Tools<br />

$ pagesize -a<br />

8192<br />

65536<br />

524288<br />

4194304<br />

Example 4.7 Sample Output from the pagesize Command<br />

The pmap command (covered in Section 4.4.7) reports the page sizes that an<br />

application has been allocated.<br />

It is possible to change the page sizes that an application requests. You can do<br />

this in several ways.<br />

At compile time, you can use the -xpagesize compiler flag documented in<br />

Section 5.8.6 of <strong>Chapter</strong> 5.<br />

You can preload the Multiple PageSize Selection (mpss.so.1) library, which<br />

uses environment variables to set the page sizes. We will cover preloading in<br />

more detail in Section 7.2.10 of <strong>Chapter</strong> 7. An example of using preloading to<br />

set the page size for an application appears in Example 4.8. In this example,<br />

the environment is being set up to request 4MB pages for both the application<br />

stack and the heap.<br />

Example 4.8 Using mpss.so.1 to Set the Page Size for an <strong>Application</strong><br />

$ setenv MPSSHEAP 4M<br />

$ setenv MPSSSTACK 4M<br />

$ setenv LD_PRELOAD mpss.so.1<br />

$ a.out<br />

You can set the preferred page size for a command or for an already running<br />

application through the ppgsz utility. This utility takes a set of page sizes<br />

plus either a command to be run with those page sizes, or a pid for those<br />

page sizes to be applied to. Example 4.9 shows examples of using the ppgsz<br />

command.<br />

% ppgsz -o heap=4M a.out<br />

% ppgsz -o heap=64K -p <br />

Example 4.9 Using the ppgsz Command<br />

Table 4.1 shows the supported page sizes for various processors.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!