1.0 Operating Systems I Introduction
1.0 Operating Systems I Introduction
Introduction
References:
1. Abraham Silberschatz, Greg Gagne, and Peter Baer Galvin, "Operating System Concepts,
Ninth Edition ", Chapter 1
2. https://www2.cs.uic.edu/~jbell/CourseNotes/OperatingSystems/
Here we look at Operating Systems from a number of different viewpoints. No one view really
shows the complete picture, but by looking from a number of different views, we can get a pretty
good overall picture of what operating systems are all about.
1.2 Computer-System Organization - What are all the parts, and how do they fit
together?
• 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
• Typical operation involves I/O requests, direct memory access (DMA), and
interrupt handling.
• One main CPU which manages the computer and runs user apps.
• Other specialized processors (disk controllers, Graphics Processing Units (GPUs),
etc.) do not run user apps.
Figure 1.7 - A dual-core design with two cores placed on the same chip
• 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.
• The concept of modes can be extended beyond two, requiring more than a single
mode bit
• CPUs that support virtualization use one of these extra bits to indicate when the
virtual machine manager, VMM, is in control of the system. The VMM has more
privileges than ordinary user programs, but not so many as the full kernel.
• System calls are typically implemented in the form of software interrupts, which
causes the hardware's interrupt handler to transfer control over to an appropriate
interrupt handler, which is part of the operating system, switching the mode bit to
kernel mode in the process. The interrupt handler checks exactly which interrupt
was generated, checks additional parameters (generally passed through registers)
if appropriate, and then calls the appropriate kernel service routine to handle the
service requested by the system call.
• User programs' attempts to execute illegal instructions ( privileged or non-existent
instructions ), or to access forbidden memory areas, also generate software
interrupts, which are trapped by the interrupt handler and control is transferred to
the OS, which issues an appropriate error message, possibly dumps data to a log
(core) file for later analysis, and then terminates the offending program.
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.)
• 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)
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, flash disks
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.)
• Protection involves ensuring that no process access or interfere with resources to which
they are not entitled, either by design or by accident. (E.g. "protection faults" when
pointer variables are misused.)
• Security involves protecting the system from deliberate attacks, either from legitimate
users of the system attempting to gain unauthorized access and privileges, or external
attackers attempting to access or damage the system.
1.10.2 Trees
1.10.4 Bitmaps
• 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.
Figure 1.18 - General structure of a client-server system
• Any computer or process on the network may provide services to any other which
requests it. There is no clear "leader" or overall organization.
• May employ a central "directory" server for looking up the location of resources,
or may use peer-to-peer searching to find resources.
• E.g. Skype uses a central server to locate a desired peer, and then further
communication is peer to peer.
1.11.6 Virtualization
• Allows one or more "guest" operating systems to run on virtual machines hosted
by a single physical machine and the virtual machine manager.
• Useful for cross-platform development and support.
• For example, a student could run UNIX on a virtual machine, hosted by a virtual
machine manager on a Windows based personal computer. The student would
have full root access to the virtual machine, and if it crashed, the underlying
Windows machine should be unaffected.
• System calls have to be caught by the VMM and translated into (different) system
calls made to the real underlying OS.
• Virtualization can slow down program that have to run through the VMM, but can
also speed up some things if virtual hardware can be accessed through a cache
instead of a physical device.
• Depending on the implementation, programs can also run simultaneously on the
native OS, bypassing the virtual machines.
• ( For more information on the Flourish conference held at UIC on the subject of Free
Libre and Open Source Software , visit http://www.flourishconf.com )
• Open-Source software is published (sometimes sold) with the source code, so that anyone
can see and optionally modify the code.
• Open-source SW is often developed and maintained by a small army of loosely
connected often unpaid programmers, each working towards the common good.
• Critics argue that open-source SW can be buggy, but proponents counter that bugs are
found and fixed quickly, since there are so many pairs of eyes inspecting all the code.
• Open-source operating systems are a good resource for studying OS development, since
students can examine the source code and even change it and re-compile the changes.
1.12.1 History
1.12.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.
• To run Linux on a Windows system using VMware, follow these steps:
1. Download the free "VMware Player" tool from
http://www.vmware.com/download/player and install it on your system
2. Choose a Linux version from among hundreds of virtual machine images
at http://www.vmware.com/appliances
3. Boot the virtual machine within VMware Player.
• 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