Title: CS 620 Comparative Operating Systems Interfaces
1CS 620 Comparative Operating Systems Interfaces
- Professor Timothy Arndt
- BU 331
2Operating Systems Review
- An operating system is a program which is
interposed between users and the hardware of a
system - An operating system can also be seen as a manager
of resources (e.g. processes, files and I/O
devices) - Examples include Windows 98, Windows 2000, Mac OS
9, Palm OS, and various varieties of UNIX (HP-UX,
Linux, AIX, etc.)
3The Place of Operating Systems
4Early Operating Systems
- Early computers were controlled directly by a
programmer or computer operator who entered a job
(given on a deck of punched cards) and collected
the output (from a line printer). - Groups of jobs were placed together in a single
deck giving rise to batch systems. - In order to minimize wasted time, a program
called an operating system was developed. The
program was always in the computers memory and
controlled the execution of the jobs.
5Early Operating Systems
6Batch Operating Systems
- In a batch system, various types of cards were
put together in a deck - Job control cards contained cards often
distinguished by a particular character in the
first row, column position. These cards contained
instructions for the OS written in the machines
job control language (JCL) - Program source code (in a language such as
FORTRAN) were compiled into an executable form. - Data cards contained the data needed for a run of
the program.
7Batch Operating Systems
8Multiprogramming System
- These systems were inefficient since the CPU was
idle while a running program waited for (e.g.) a
slow I/O operation to finish. - In order to get around this problem, several jobs
were kept in memory, and when the running program
was blocked waiting for I/O, the OS switched to
one of the other jobs. This type of system is
called a multiprogramming system. - Note that this type of system is still not
interactive.The user must wait for his job to
finish before he sees the output.
9Multiprogramming System
10Timesharing systems
- As time went on, users were connected to the CPU
via terminals, and the switching between jobs was
fast enough that each user had the illusion of
being the sole user of the system (if the system
wasnt overloaded!). This type of system is
called a timesharing system. - In this type of system the OSs scheme for
control of the CPU must be much more complicated.
In general, each job consists of one or more
processes. - Processes can create other processes called child
processes.
11Processes
12Processes
- A running process consists of several segments in
the computers main memory. - The text segment contains the processes
executable machine instructions. - The global segment contains global and static
(variables declared in a procedure whose value
doesnt change between invocations of the
procedure) variables. - The data segment (or heap) contains dynamically
allocated memory. - The stack contains activation records for
subprograms. The activation records contain local
variables, parameters, return location, etc. When
a subprogram is called an activation record is
pushed on the stack. When a subprogram exits,
its record is popped off the stack.
13A Running Process
14Processes
- Each process has its own virtual address space.
The size of the space depends on the word size of
the computer. - The virtual address space is in general larger
than the computers physical memory, so some
virtual memory scheme is needed. - The OS ensures the virtual to physical mapping
for each process and also that each process can
only access memory locations in its own address
space.
15File System
- Another important resource that the OS manages is
the set of files that programs access. - The file system is typically structured as a tree
in which leaf nodes are files and interior nodes
are directories. - Even if files are on separate physical devices,
they can be combined in a single virtual
hierarchy. - The command used to add a new subtree (on a
separate physical device) to the file system is
called mount. - A single file (or directory) can be placed in
multiple directories without copying the file by
linking the file. A link is a special type of
file.
16File System
17Virtual File Hierarchy
18Interprocess Communication
- Separate processes can communicate with each
other using an OS provided service called
Interprocess Communication (IPC). - UNIX processes can use sockets or pipes to
establish communication with other processes. - IPC and process spawning are relatively slow,
leading to the idea of light-weight processes or
threads in many modern OSs. - Threads spawned by the same process can
communicate through shared memory.
19Interprocess Communication
20User vs. Kernel Mode
- In order to make the system more stable, many OSs
distinguish between processes operating in user
mode versus those operating in kernel mode. - User mode processes can access only their memory
locations in their own address space, cannot
directly access hardware, etc. Kernel mode
processes have no such restrictions. - The fewer processes which run in kernel mode, the
more robust the system should be. On the other
hand, mode switching slows down the system.
21User vs. Kernel Mode
22Other OS Requirements
- Besides controlling files, processes and IPC, an
OS has several other important tasks - Controlling I/O and other peripheral devices
- Networking
- Security and access control for the various
resources - Processing user commands
23Introduction to Distributed Systems
- Distributed systems (as opposed to centralized
systems) are composed of large numbers of CPUs
connected by a high-speed network. - A distributed system is a collection of
independent computers that appear to the users of
the system as a single computer. - Advantages of distributed systems
- Microprocessors offer a better price/performance
ratio than mainframes. - A distributed system may have more total power
than a mainframe.
24Introduction to Distributed Systems
- Some applications involve spatially separated
machines. - If one machine crashes, the system as a whole can
still survive. - Computing power can be added in small increments.
- Advantages of distributed systems over PCs
- Allow many users access to a common data base.
- Allow many users to share expensive peripherals
like color printers. - Make a human-to-human communication easier (e.g.
by electronic mail)
25Introduction to Distributed Systems
- Spread the workload over the available machines
in the most cost effective way. - Disadvantages of distributed systems
- Little software exists at present for distributed
systems. - The network can saturate or cause other problems.
- Easy access also applies to secret data.
26Classification of Multiple CPU Systems
- Distributed systems are multiple CPU systems (as
are parallel systems - we dont distinguish
between these two). - In order to compare various multiple CPU systems,
we would like a classification. - There is no completely satisfactory
classification. The most well-known (but now
outdated) is due to Flynn - MIMD
- Multiprocessor (shared memory)
- Multicomputer (no shared memory)
27Introduction to Distributed Systems
- SIMD (Single Instruction Multiple Data Stream)
- SISD (Single Instruction Single Data Stream)
traditional computers. - MISD (Multiple Instruction Stream Single Data
Stream) No known examples. - Each of these categories can further be
characterized as either - bus or
- switch
- tightly coupled or
- loosely coupled
28Bus-Based Multiprocessors
- Bus-based multiprocessors consist of some number
of CPUs all connected to a common bus, along with
a memory module. - A typical bus has 32 or 64 address lines, 32 or
64 data lines, and 32 or more control lines, all
operating in parallel. - Since there is just one memory, if one CPU writes
a word of memory, and another CPU immediately
reads that word, the value read will be that
written. - The memory is said to be coherent.
- This configuration soon causes the bus to be
overloaded.
29Bus-Based Multiprocessors
- The solution to this problem is to add a
high-speed cache memory between the CPU and the
bus. - The cache holds the most recently accessed words.
All memory request go through the cache. - The probability that a requested word is found in
the cache is called the hit rate. - If the hit rate is high, the bus traffic will be
dramatically reduced.
30Bus-Based Multiprocessors
- The use of a cache gives rise to the cache
coherence problem. - One solution is the use of a write-through cache.
- The caches must also the monitor the bus and
invalidate cache entries when writes to that
address occur. - This process is called snooping.
- Most bus-based multiprocessors use these
techniques.
31Bus-Based Multiprocessors
- Facts about caches
- They can be write through, when the processor
issues a store the value goes in the cache and
also is sent to memory - They can be write back, the value only goes to
the cache. - In this case, the cache line is marked dirty and
when it is evicted it must be written back to
memory. - Because of the broadcast nature of the bus it is
not hard to design snooping caches that maintain
consistency.
32Bus-Based Multiprocessors
- Bus-based multiprocessors are also called
Symmetric Multiprocessors (SMPs) and they are
very common. - Disadvantage (this is really a limitation)
- Cannot be used for a large number of processors
since the bus bandwidth grows with the number of
processors and this gets increasingly difficult
and expensive to supply. - Moreover the latency grows as the number of
processors for both speed of light and more
complicated (electrical) reasons.
33Symmetric Multiprocessors
Processor
Processor
Processor
Processor
Memory
I/O
LAN
34Two Non-SMP Multiprocessors
Processor
Processor
Private Memory
Private Memory
Memory
I/O
LAN
35Two Non-SMP Multiprocessors
Processor
Processor
Memory
I/O
LAN
36Switched Multiprocessors
- To build a multiprocessor with more than (say) 64
processors, a different method is needed to
connect the CPUs with the memory. - One interconnection method is the use of a
crossbar switch in which each CPU is connected to
each interleaved bank of memory. - This method requires n2 crosspoint switches for n
memories and CPUs, which can be expensive for a
large n.
37Switched Multiprocessors
M
M
M
M
CPU
CPU
CPU
CPU
38Switched Multiprocessors
- The omega network is an example of a multistage
network which requires a smaller number of
switches - (nlog2n)/2 with log2n switching
stages. - The number of stages slows down memory access,
however. - Another alternative is the use of hierarchical
systems called NUMA (NonUniform Memory Access). - Each CPU accesses its own memory quickly, but
everyone elses more slowly.
39A CC-NUMA
Proc 1
Proc 2
Proc 4
Proc 3
D
D
cache
cache
cache
cache
Memory 0
Memory 1
I/O
I/O
40NUMA
- CC-NUMAs (Cache Coherent NUMAs) are programmed
like SMPs but to get good performance - must try to exploit the memory hierarchy and have
most references hit in your local cache - most others must hit in the part of the shared
memory in your "node (CPUs on the local bus). - NC-NUMAs (Non Coherent NUMAs) are still harder to
program as you must maintain cache consistent
manually (or with compiler help).
41Bus-Based Multicomputers
- Multicomputers (with no shared memory) are much
easier to build (i.e. scale much more easily). - Each CPU has a direct connection to its own local
memory. - The only traffic on the interconnection network
is CPU-to-CPU, so the volume of traffic is much
lower. - The interconnection can be done using a LAN
rather than a high-speed backplane bus.
42Bus-Based Multicomputers
- In some sense all the computers on the internet
form one enormous multicomputer. - The interesting case is when there is some
closer cooperation between processors say the
workstations in one distributed systems research
lab cooperating on a single problem. - Application must tolerate long-latency
communication and modest bandwidth, using current
state-of-the-practice.
43Switched Multicomputers
- The final class of systems are switched
multicomputers. - Various interconnection networks have been
proposed and built. Examples are grids and
hypercubes. - A hypercube is an n-dimensional cube. For an
n-dimensional hypercube, each CPU has n
connections to other CPUs. - Hypercubes with 1000s of CPUs (Massively Parallel
Processors or MPPs) have been available for
several years.
44Network Operating Systems
- Network operating systems allow one or machines
on a LAN to serve as file servers which provide a
global file system accessible from all
workstations. - An example of the use of a file server is NFS
(Network File System). - The file server receives requests from nonserver
machines called clients, to read and write files. - It is possible that the machines all run the same
OS, but it is not required.
45Network Operating Systems
- A situation like this, where each machine has a
high degree of autonomy and there are few
system-wide requirements is known as a network
operating system. - It is apparent to the users such a system
consists of numerous computers. - There is no coordination among the computers,
except that the client-server traffic must obey
the systems protocols. - The next step up consists of tightly-coupled
software on the same loosely-coupled hardware.
46True Distributed Systems
- The goal of such a system is to create the
illusion that the entire network of computers is
a single timesharing system. - The characteristics of a distributed system
include - A single, global IPC mechanism
- A global protection scheme
- Homogeneous process management
- A single set of system calls
- A homogeneous file systems
- Identical kernels on all CPUs
47True Distributed Systems
- A global file system
- Multiprocessor timesharing systems consist of
tightly-coupled software on tightly-coupled
hardware. - The key character of this class of system is the
existence of a single run queue. - Ready to run processes can be run on any of the
CPUs of the system. - The operating system in this type of organization
normally maintains a traditional file system.
48Design Issues
- The single most important issue is the
achievement of transparency. - There are several types of transparency that we
might try to achieve - Location transparency users cannot tell where
resources are located. - Migration transparency resources can move at
will without changing names. - Replication transparency users cannot tell how
many copies exist.
49Design Issues
- Concurrency transparency multiple users can
share resources automatically. - Parallelism transparency activities can happen
in parallel without users knowing. - The second key design issue is flexibility.
- Flexibility can be provided by a microkernel (as
opposed to a monolithic kernel) which provides
just - An IPC mechanism.
- Some memory management.
- A small amount of low-level process management
and scheduling. - Low-level input/output.
50Design Issues
- All other OS services are implemented as
user-level services - file system
- directory system
- full process management
- system call handling
- This leads to a highly modular approach in which
new services are easily added without stopping
the system and booting a new kernel. - Services can also be substituted with customized
services.
51Design Issues
- In a uniprocessor system, the monolithic kernel
may have a performance advantage (no context
switches). However in a distributed system, the
advantage is less. - Another design goal for distributed systems is
reliability. - One aspect of reliability is availability, or
uptime. This can be improved by exploiting
redundancy. - Another aspect is security. This issue is even
more difficult in distributed systems then in
uniprocessor systems.
52Design Issues
- A final issue of reliability is fault tolerance.
- Performance in distributed systems is a critical
issue due to the slow communication times. - We can attempt to increase the performance by
selecting the correct grain size of computations. - Jobs which involve fine-grained parallelism will
necessarily spend a large amount of time on
message passing. They are poor candidates for
distributed systems. - Jobs that involve large computations and low
interaction - coarse-grained parallelism - are
better bets for distributed systems.
53Design Issues
- Scalability is another critical issue.
- Scalability can be achieved by avoiding
- Centralized components
- Centralized tables
- Centralized algorithms
- Decentralized algorithms have the following
characteristics - No machine has complete information about the
system state. - Machines make decisions based only on local
information.
54Design Issues
- Failure of one machine does not ruin the
algorithm. - There is no implicit assumption that a global
clock exists.