Relevant sections in the dinasour book: Section 8.6 and 8.7. -------------------------------------------------------------------------- Project 2: CPU Scheduling --------------------------------------------------------------------------- Shared Memory Segments and Mapped files in Modern OS: Shared Memory Segments: shmget and shmat a shared memory segment can be created and then mapped into the address spaces of different processes; Example usage: database buffers, or as a way for communication among processes; Memory mapped files: similarly, a file can be mapped into the address space of a process using mmap, and memory read/write in that region means reading or writing the file. Adding these facilities lead to a view of the address space as a collection of "addressable ranges", or in other words, segments. Each segment is a range of virtual addresses that are valid for the program to address. Typically each segment has a segment descriptor, stating the start address of the segment, and the length of the segment. Modern kernels has a data structure for each process, which is a linked list of all the descriptors of the segments of the process' address space. Based on this data structure, the kernel can decide whether a memory address is legal or illegal. ---------------------------------------------------------------------------- In some of the older architectures, there is no paging support. However, there is "segmentation" support. That is, a whole segment may be loaded from disk into the main memory, and the virtual->physical address translation simply means adding the segment offset to the beginning physical address of the segment. * Check Section 8.6 for more detail. * ------------------------------------------------------------------------- Later on, segmentation is combined with paging, and the architecture is typically called "segmentation with paging". * Check Section 8.7 for more detail. * Example: - Windows 95 i386: Segmentation with Paging: . segments: i386: 16K segments, half for private use, half for common use; each segment is 32 bits; local descriptor table, global descriptor table: table entry: 8 bytes, including base location, and length; every virtual address is a pair: <13-bit s, 1-bit g, 2-bit p> + 32-bit offset; six segment registers; segment tables ---> segment descriptor --> another virtual address; . two-level page tables; Figure in page 283 of the dinasour book; Windows 95: three memory models: . Win 3.1 protected mode segmented memory model; (16-bit windows program) . use selector + offset to reference a physical page; . no paging; . segments up to 64KB each; . WinNT flat memory model; (32-bit windows program) . paging; . two-level page table; . Virtual-86 model; . only 20-bit addresses; . 1MB of addressable space; . segment + offset used to generate the 20-bit address;