Solaris Application Programming

Darryl Gove

Mentioned 1

Solaris(tm) Application Programming is a comprehensive guide to optimizing the performance of applications running in your Solaris environment. From the fundamentals of system performance to using analysis and optimization tools to their fullest, this wide-ranging resource shows developers and software architects how to get the most from Solaris systems and applications. Whether you're new to performance analysis and optimization or an experienced developer searching for the most efficient ways to solve performance issues, this practical guide gives you the background information, tips, and techniques for developing, optimizing, and debugging applications on Solaris. The text begins with a detailed overview of the components that affect system performance. This is followed by explanations of the many developer tools included with Solaris OS and the Sun Studio compiler, and then it takes you beyond the basics with practical, real-world examples. In addition, you will learn how to use the rich set of developer tools to identify performance problems, accurately interpret output from the tools, and choose the smartest, most efficient approach to correcting specific problems and achieving maximum system performance. Coverage includes A discussion of the chip multithreading (CMT) processors from Sun and how they change the way that developers need to think about performance A detailed introduction to the performance analysis and optimization tools included with the Solaris OS and Sun Studio compiler Practical examples for using the developer tools to their fullest, including informational tools, compilers, floating point optimizations, libraries and linking, performance profilers, and debuggers Guidelines for interpreting tool analysis output Optimization, including hardware performance counter metrics and source code optimizations Techniques for improving application performance using multiple processes, or multiple threads An overview of hardware and software components that affect system performance, including coverage of SPARC and x64 processors

More on Amazon.com

Mentioned in questions and answers.

The following is the result after run on solaris, it shows there are two heaps, but in my understanding, for a process, there is only one heap which is a large continuous memory which can be managed by brk to expand or shrink the size. And for anon memory, a process can have many anon memory which can be managed by mmap/munmap. Is my understanding correct? or I read the result of the pmap wrongly?

sol9# pmap -sx pgrep testprog

... 00022000 3960 3960 3960 - 8K rwx-- [ heap ]

00400000 131072 131072 131072 - 4M rwx-- [ heap ]

... FF390000 8 8 - - 8K r-x-- libc_psr.so.1

FF3B0000 8 8 8 - 8K rwx-- [ anon ]

...


total Kb 135968 135944 135112 -

You are both correct and misreading the pmap output. If you had done pmap -x the results would probably be less confusing, showing the heap just once, but since you added the -s flag, it breaks down the heap into segments with different page mappings.

The addresses starting at 0x0022000 are not aligned properly to be mapped to a 4Mb page, so they use 3960kb of 8k pages. 0x0022000+(3960*1024) = 0x00400000

At 0x00400000 the address is properly aligned for 4Mb pages, so the heap switches to using the larger pages with fewer page table entries.

If you wanted to ensure that your heap started at the proper alignment to use 4Mb pages for the whole thing instead of starting with 8k until it reached an alignment boundary, then you would link your program with -M /usr/lib/ld/map.bssalign to do that.

A slightly more in-depth explanation can be found in the Page Size and Memory Layout blog post from Solaris Application Programming author Darryl Gove.

Realated tags

heapsolaris