Virtual memory routines
Now let's move on to the
A substantial part of the kernel is devoted to virtual memory processing. Some of these routines handle very specific hardware details, which we won't get into because they will be different for every architecture and MMU. However, the sections dealing with more generic, "virtual" topics can be covered. These are functions that manipulate the address spaces of processes (and the as structure) and the individual segments ( seg structures), page-handling routines, and a general high-level interface to the hat layer, for hardware address translation.
Along with these you will find more specialized routines handling anonymous memory, swap space, and the
structure, which deals with segments that refer to actual vnodes (files). There are some common naming conventions that should enable you to identify functions in each of these areas, although we will touch on only a few specific function
Let's start at the highest level and work down. The include files, which define the structures we're interested in and often list the important routines, are all contained in the /usr/include/vm directory for both SunOS 4 and Solaris 2.
Every process has its own address space, so every process table entry contains a pointer to an address space structure just for that process. The structure serves mostly as an anchor for a list of segments, which describe the valid ranges of virtual addresses that each individual process has. The structure contains global pieces of information, such as a flag that indicates that the entire process is locked in memory, and a count of the number of physical pages actually in use by this process (the
field: the resident set
A few functions deal with the address space as a whole. Some of these are:
There are more functions; they have similar
Segments are individual
Some actual functions for the different segment types are:
There are also some generic segment handling functions that deal with the segment structures
Segments are another "virtual" layer, like vnodes, to allow a range of addresses to refer to many different things (a file, a device like a frame buffer, anonymous memory) but still be handled at a high level in a standardized way.
Solaris Performance and Tools: DTrace and MDB Techniques for Solaris 10 and OpenSolaris
DTrace: Dynamic Tracing in Oracle Solaris, Mac OS X and FreeBSD (Oracle Solaris Series)
Practical Guide to Fedora and Red Hat Enterprise Linux, A (6th Edition)
An Introduction to GCC: For the GNU Compilers GCC and G++