Multics, Unix and Mach summary ------------------------------ Multics: a computing utility Design goals: - fine-grained sharing of data - uniform addressing - device-independent I/O Concepts: - segment: an address space (each program may have 2^18 segments) - page: a fixed-size chunk of memory (each segment may have 2^16 pages, and each page is 64 or 1024 36-bit words) Protection and sharing are implemented per segment. Segments are used for procedures, data structures and files in secondary storage. Complex memory system: On a memory reference, the OS uses the segment number to locate a segment descriptor, which points to the segment's page table, which the OS uses to locate the appropriate page table entry, which points to the page in memory. Both pages and a segment's page tables may reside on disk, so two faults can occur on a memory reference. The hardware provides a 16-word TLB to speed things up. Unix: back to basics Design goals: - simplicity (designed by one guy) - uniform programming model (files, pipes) Concepts: - shell: a program for interacting with the system - daemon: a background process - pipe: a byte stream for interprocess communication - signal: a software interrupt - file: represents a file on disk or one of many other kinds of resources The memory system provides each process with a flat address space, consisting of three "segments" (really regions): text segment for executable code, data segment for static data, and stack segment. The rest of the address space can be used for dynamically allocated memory and memory-mapped files. Unix originally provided swapping but paging was introduced later on. Uniform I/O model of Multics is extended in Unix by presenting all devices as files supporting a uniform interface. Mach: user-level Unix emulation Design goals: - user-level servers (providing OS emulation, flexible memory management) - message-based communication (providing transparent network operation, multiprocessor capability) - portability (across a variety of machine architectures) Concepts: - task: an execution environment, containing resources (address space, threads, port send/receive capabilities) - thread - port: a communication channel, providing protected access to a resource - port set: collection of port receive capabilities, allowing a single thread to receive messages on many ports - message: a block of data, possibly including port capabilities and pointers to large data blocks The kernel implements each of these basic mechanisms and makes I/O devices available to user-level servers. For each task the kernel stores port capabilities, which the task references by an index (like a file descriptor). Other system services are provided as servers in kernel or user space. Basic message passing is done by copying data from one task's address space to another's. Large data blocks can be transferred by passing a pointer to the data, which the kernel then maps into the receiving task's space using copy-on-write mechanism. The kernel handles passing port capabilities between tasks on the same machine simply by modifying the appropriate port tables; passing capabilities across machines is more complex and requires encryption and authentication. Sharing and protection are applied to pages. This can introduce false sharing if applications are not careful about how data is arranged in memory. External pagers are servers that store and retrieve data mapped into one or more tasks' address spaces. Virtual memory and files are handled uniformly as mapped memory. This mechanism can be used to implement distributed shared memory across different machines.