
1.2.1 Computer-System Operation
- Bootstrap program
- Shared memory between CPU and I/O cards
- Time slicing for multi-process operation
- Interrupt handling - clock, HW, SW
- Implementation of system calls
1.2.2 Storage Structure
- Main memory ( RAM )
- Programs must be loaded into RAM to run.
- Instructions and data fetched from RAM into registers.
- RAM is volatile
- "Medium" size and speed
- Other electronic ( volatile ) memory is faster, smaller, and more expensive per bit:
- Registers
- CPU Cache
- Non-volatile memory ( "permanent" storage ) is slower, larger, and less expensive per bit:
- Electronic disks
- Magnetic disks
- Optical disks
- Magnetic Tapes
1.2.3 I/O Structure
- Typical operation involves I/O requests, direct memory access ( DMA ), and interrupt handling.
1.3.1 Single-Processor Systems
- One main CPU which manages the computer and runs user apps.
- Other specialized processors ( disk controllers, GPUs, etc. ) do not run user apps.
1.3.2 Multiprocessor Systems
- Increased throughput - Faster execution, but not 100% linear speedup.
- Economy of scale - Peripherals, disks, memory, shared among processors.
- Increased reliability
- Failure of a CPU slows system, doesn't crash it.
- Redundant processing provides system of checks and balances. ( e.g. NASA )
1.3.3 Clustered Systems
- Independent systems, with shared common storage and connected by a high-speed LAN, working together.
- Special considerations for access to shared storage are required, ( Distributed lock management ), as are collaboration protocols.
A time-sharing ( multi-user multi-tasking ) OS requires:
- Memory management
- Process management
- Job scheduling
- Resource allocation strategies
- Swap space / virtual memory in physical memory
- Interrupt handling
- File system management
- Protection and security
- Inter-process communications
Interrupt-driven nature of modern OSes requires that erroneous processes not be able to disturb anything else.
1.5.1 Dual-Mode Operation
- User mode when executing harmless code in user applications
- Kernel mode ( a.k.a. system mode, supervisor mode, privileged mode ) when executing potentially dangerous code in the system kernel.
- Certain machine instructions can only be executed in kernel mode.
- Kernel mode can only be entered by making system calls. User code cannot flip the mode switch.
- Modern computers support dual-mode operation in hardware.
1.5.2 Timer
- Before the kernel begins executing user code, a timer is set to generate an interrupt.
- The timer interrupt handler reverts control back to the kernel.
- This assures that no user process can take over the system.
- Timer control is a privileged instruction, ( requiring kernel mode. )
An OS is responsible for the following tasks with regards to process management:
- Creating and deleting both user and system processes
- Ensuring that each process receives its necessary resources, without interfering with other processes.
- Suspending and resuming processes
- Process synchronization and communication
- Deadlock handling
An OS is responsible for the following tasks with regards to memory management:
- Keeping track of which blocks of memory are currently in use, and by which processes.
- Determining which blocks of code and data to move into and out of memory, and when.
- Allocating and deallocating memory as needed. ( E.g. new, malloc )
1.8.1 File-System Management
An OS is responsible for the following tasks with regards to filesystem management:
- Creating and deleting files and directories
- Supporting primitives for manipulating files and directories. ( open, flush, etc. )
- Mapping files onto secondary storage.
- Backing up files onto stable permanent storage media.
1.8.2 Mass-Storage Management
An OS is responsible for the following tasks with regards to mass-storage management:
- Free disk space management
- Storage allocation
- Disk scheduling
Note the trade-offs regarding size, speed, longevity, security, and re-writability between different mass storage devices, including floppy disks, hard disks, tape drives, CDs, DVDs, etc.
1.8.3 Caching
- There are many cases in which a smaller higher-speed storage space serves as a cache, or temporary storage, for some of the most frequently needed portions of larger slower storage areas.
- The hierarchy of memory storage ranges from CPU registers to hard drives and external storage. ( See table below. )
- The OS is responsible for determining what information to store in what level of cache, and when to transfer data from one level to another.
- The proper choice of cache management can have a profound impact on system performance.
- Data read in from disk follows a migration path from the hard drive to main memory, then to the CPU cache, and finally to the registers before it can be used, while data being written follows the reverse path. Each step ( other than the registers ) will typically fetch more data than is immediately needed, and cache the excess in order to satisfy future requests faster. For writing, small amounts of data are frequently buffered until there is enough to fill an entire "block" on the next output device in the chain.
- The issues get more complicated when multiple processes ( or worse multiple computers ) access common data, as it is important to ensure that every access reaches the most up-to-date copy of the cached data ( amongst several copies in different cache levels. )
From Figure 1.11 - Performance of various levels of storage Level 1 2 3 4 Name registers cache main memory disk storage Typical size < 1KB < 16MB < 64 GB > 100 GB Implementation Technology custom memory with multiple ports, CMOS on-chip or off-chip CMOS SRAM CMOS DRAM magnetic disk Access time ( ns ) 0.25-0.5 0.5-25 80-250 5,000,000 Bandwidth ( MB / s ) 20,000-100,000 5000-10,000 1000-5000 20-150 Managed by compiler hardware OS OS Backed by cache main memory disk CD or tape
1.8.4 I/O Systems
The I/O subsystem consists of several components:
- A memory-management component that includes buffering, caching, and spooling.
- A general device-driver interface.
- Drivers for specific hardware devices.
- ( UNIX implements multiple device interfaces for many types of devices, one for accessing the device character by character and one for accessing the device block by block. These can be seen by doing a long listing of /dev, and looking for a "c" or "b" in the first position. You will also note that the "size" field contains two numbers, known as the major and minor device numbers, instead of the normal one. The major number signifies which device driver handles I/O for this device, and the minor number is a parameter passed to the driver to let it know which specific device is being accessed. Where a device can be accessed as either a block or character device, the minor numbers for the two options usually differ by a single bit. )
1.11.1 Real-Time Embedded Systems
- Embedded into devices such as automobiles, climate control systems, process control, and even toasters and refrigerators.
- May involve specialized chips, or generic CPUs applied to a particular task. ( Consider the current price of 80286 or even 8086 or 8088 chips, which are still plenty powerful enough for simple electronic devices such as kids toys. )
- Process control devices require real-time ( interrupt driven ) OSes. Response time can be critical for many such devices.
1.11.2 Multimedia Systems
1.11.3 Handheld Systems
1.12.1 Traditional Computing
1.12.2 Client-Server Computing
- A defined server provides services ( HW or SW ) to other systems which serve as clients. ( Technically clients and servers are processes, not HW, and may co-exist on the same physical computer. )
- A process may act as both client and server of either the same or different resources.
- Served resources may include disk space, CPU cycles, time of day, IP name information, graphical displays ( X Servers ), or other resources.
1.12.3 Peer-to-Peer Computing
- Any computer or process on the network may provide services to any other which requests it. There is no clear "leader" or overall organization.
1.12.4 Web-Based Computing
1.13.1 History
- At one time ( 1950s ) a lot of code was open-source.
- Later, companies tried to protect the privacy of their code, particularly sensitive issues such as copyright protection algorithms.
- In 1983 Richard Stallman started the GNU project to produce an open-source UNIX.
- He later published the GNU Manifesto, arguing that ALL software should be open-source, and founded the Free Software Foundation to promote open-source development.
- FSF and GNU use the GNU General Public License which essentially states that all users of the software have full rights to copy and change the SW however they wish, so long as anything they distribute further contain the same license agreement. ( Copylefting )
1.13.2 Linux
- Developed by Linus Torvalds in Finland in 1991 as the first full operating system developed by GNU.
- Many different distributions of Linux have evolved from Linus's original, including RedHat, SUSE, Fedora, Debian, Slackware, and Ubuntu, each geared toward a different group of end-users and operating environments.
- The book describes how to download and play with the Ubuntu distribution, given a system running VMWare.
1.13.3 BSD UNIX
- UNIX was originally developed at ATT Bell labs, and the source code made available to computer science students at many universities, including the University of California at Berkeley, UCB.
- UCB students developed UNIX further, and released their product as BSD UNIX in both binary and source-code format.
- BSD UNIX is not open-source, however, because a license is still needed from ATT.
- In spite of various lawsuits, there are now several versions of BSD UNIX, including Free BSD, NetBSD, OpenBSD, and DragonflyBSD
- The source code is located in /usr/src.
- The core of the Mac operating system is Darwin, derived from BSD UNIX, and is available at http://developer.apple.com/opensource/index.html
1.13.4 Solaris
- Solaris is the UNIX operating system for computers from Sun Microsystems.
- Solaris was originally based on BSD UNIX, and has since migrated to ATT SystemV as its basis.
- Parts of Solaris are now open-source, and some are not because they are still covered by ATT copyrights.
- It is possible to change the open-source components of Solaris, re-compile them, and then link them in with binary libraries of the copyrighted portions of Solaris.
- Open Solaris is available from http://www.opensolaris.org/os/
- Solaris also allows viewing of the source code online, without having to download and unpack the entire package.
1.13.5 Utility
- The free software movement is gaining rapidly in popularity, leading to thousands of ongoing projects involving untold numbers of programmers.
- Sites such as http://freshmeat.net/ and http://distrowatch.com/ provide portals to many of these projects.