Keeping track of process space


Every process has one single "address space," which is actually a list of separate sections, or chunks, of the total virtual address range. These chunks compose the set of valid addresses that the process can use ” the ones that hold real data. To keep track of all these, the process table entry ( proc structure) contains a pointer to an address space ( as ) structure. The as structure points off to a linked list of segments, or address ranges, kept in sorted order.

Each segment has a special structure (the seg structure) to define it that tells the kernel where that particular segment starts and how long it is. When a page fault occurs, it is easy for the kernel to run down this list and check to see if the desired address is really part of an existing segment. If not, the program receives a segmentation violation signal: there is no segment containing this address, so it was out of bounds. If the address really is part of a valid segment, it means that the desired data (page) was probably not in memory, and the kernel has to find the data and set up the MMU to point to it. In order to do this, each segment structure points to some data that is specific to the type of file to which this segment refers. It might be a regular disk file that has been memory-mapped. It might be a file that can be read but not modified. It might be the stack, which doesn't actually refer to a disk file at all. For example, the special data will contain information about how a page fault is satisfied, or how the system should handle a sync system call over this range of addresses.

There are several segment types. Among these are seg_vn , which is a segment that refers to data in some vnode, and seg_dev , which refers to some device, like a frame buffer, that has been mapped in by that process. The following diagram shows all the structures and how they are linked together.

Figure 20-1. Process Space Structures

graphics/20fig01.gif



PANIC. UNIX System Crash Dump Analysis Handbook
PANIC! UNIX System Crash Dump Analysis Handbook (Bk/CD-ROM)
ISBN: 0131493868
EAN: 2147483647
Year: 1994
Pages: 289
Authors: Chris Drake

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net