next up previous
Next: Resources Up: Introduction Previous: Project Outline

Terms

A few terms are defined here to avoid confusion later. The kernel is a single piece of code that is always present when UNIX is running and is responsible for the interface to the hardware and the management of resources such as the CPU, memory, and disks. A user program (commonly referred to as a user-land program in BSD circles) is any program other than the kernel; that is, any program that can be invoked by the user. This covers programs like ls and cc as well as daemons such as inetd and timed.

Part of the kernel is machine-independent code and part of it is machine-dependent code. The former is shared among the ports and the latter is different for each port. Some code is a hybrid of the two, such as the Motorola 68000-family code that is shared between only some ports.

The memory management unit (MMU) is a piece of hardware that translates virtual addresses to physical memory addresses and handles protection between process spaces. Sometimes the MMU is a separate chip that sits between the CPU and memory, and sometimes it is built into the CPU directly. There are MMU tables in memory that guide the MMU in its mapping.

There are two kinds of memory addresses. A physical address is used to access memory directly; that is, it is the address sent to the RAMs when accessing data. A virtual address goes through the MMU first and is translated to a (usually different) physical address. If the virtual address does not correspond to a physical address or if the operation on that section of memory is not allowed ( e.g., writing to memory that was mapped read-only), then the MMU will fault, causing the kernel to load a page from disk, allocate one from scratch, or terminate the program that caused the fault.

Any executable binary program (both kernel and user) has three parts: the text, the data, and the bssgif. The text is the machine code and is usually mapped read-only so that the MMU will catch errant pointer writes. The data is the initialized data of a program and is stored with the text to make up the executable file. The bss gif (Block Started by Symbol) is not saved on disk and accounts for the uninitialized global variables of a program. In UNIX, when a program is loaded, space for the bss is allocated and initialized to zero. Although the program has no guarantee that the bss (and hence its uninitialized variables) is set to zero, this behavior of UNIX is not likely to ever be changed because most user programs would stop working. gif Be warned, however, that some other operating systems ( e.g., MS-DOS) do not clear the bss and assumptions about its contents at program startup make programs non-portable.



next up previous
Next: Resources Up: Introduction Previous: Project Outline



Lawrence Kesteloot
Fri Jan 20 16:29:52 EST 1995