OSAR Autumn 2001 1 Course Info Course Web page Text Book Andrew S. Tanenbaum, Modern Operating...
-
Upload
wilfred-mcdowell -
Category
Documents
-
view
215 -
download
1
Transcript of OSAR Autumn 2001 1 Course Info Course Web page Text Book Andrew S. Tanenbaum, Modern Operating...
1OSAR Autumn 2001
Course Info
Course Web page http://homer.csm.port.ac.uk/teaching/osarc/
Text Book Andrew S. Tanenbaum, Modern Operating
Systems , 2nd Ed (January 2001) Prentice Hall ISBN: 0130313580
Contact Info Hong Ong - [email protected] Garry Smith - [email protected]
2OSAR Autumn 2001
What is an Operating System (OS)?
An OS is the interface between the user and the hardware It implements a virtual machine that is easier to
program than bare hardware. An OS is the resource allocator
It manages and allocates resources such that the computer hardware can be used in an efficient manner.
Examples of resources: processes, CPU(s), memory, file system, networking, etc.
The goal in OS development is to make the machine convenient to use and efficient.
3OSAR Autumn 2001
Why study Operating Systems?
Most likely you won't write an OS, so why study them?
Primary intersection point. It draws on many CS areas - software engineering, computer
architecture, data structures, networking, algorithms. Can apply techniques (data structures, conflict resolution,
concurrency issues, resource management, etc.) used in OS to other areas.
"Grungy" things sometimes do require modifications to OS you can't do this if you don't understand them!
Curiosity – “look under the hood” “Operating systems are among the most complex
pieces of software yet developed”, William Stallings, 1994
4OSAR Autumn 2001
Introduction - OS Overview
History of Operating Systems. Operating System Components. Computer Hardware Review. Operating System Interface. Operating System Structure.
5OSAR Autumn 2001
History of Operating Systems.
Once upon a time … Human
Computer
6OSAR Autumn 2001
History of Operating Systems (cont)
First generation 1945 - 1955 vacuum
tubes, plug boards
ENIAC (mid-1940’s) Just part of
it!!
7OSAR Autumn 2001
History of Operating Systems (cont)
Second generation 1955 - 1965 transistors, batch systems
Early batch system (overlapped CPU & I/O operations) Buffer slow I/O onto fast tape drives connected to CPU,
replicate I/O devices Spool data to disk
8OSAR Autumn 2001
History of Operating Systems (cont)
Third generation 1965 – 1980 ICs and
multiprogramming Multiple jobs are on
disk, waiting to run Multi-programming –
run several programs at the same time
IBM 360 series (mid-1960s)
9OSAR Autumn 2001
History of Operating Systems (cont)
Interactive timesharing Lots of cheap terminals and one computer
All users interact with the system at once Debugging is much easier
Disks are cheap so put programs and data online 1 punch card = 100 bytes
New problems: Need pre-emptive scheduling to maintain adequate
response time Need to avoid thrashing (swapping programs in and out
of memory too often) Need to provide adequate security measures
UNIX developed at Bell Labs (Thompson, Ritchie)
10OSAR Autumn 2001
History of Operating Systems (cont)
Fourth generation 1980 – present Personal computing
CPUs are cheap enough for everyone, yet powerful enough to be useful.
SUPERBOWLIBM 8086
vs.
The only real competitor left…There can be only one…IBM PC
11OSAR Autumn 2001
More Recent Development in OS
Parallel Operating Systems. Distributed Operating Systems. Clustered Operating Systems. Real time Operating Systems. Embedded Operating Systems.
12OSAR Autumn 2001
Parallel Operating Systems
Symmetric multiprocessing (SMP) Each processor runs an identical copy of the
operating system. Many processes can run at once without
performance deterioration. Most modern operating systems support SMP
Asymmetric multiprocessing Each processor is assigned a specific task;
master processor schedules and allocated work to slave processors.
More common in extremely large systems
13OSAR Autumn 2001
Distributed Operating Systems
Distribute the computation among several physical processors.
Loosely coupled system – each processor has its own local memory; processors communicate with one another through various communications lines, such as high-speed networks or telephone lines.
Advantages of distributed systems. Resources Sharing Computation speed up – load sharing Reliability Communications
Requires networking infrastructure. Local area networks (LAN) or Wide area networks (WAN) May be either client-server or peer-to-peer systems.
14OSAR Autumn 2001
Clustered Operating Systems
Clustering allows two or more systems to share storage. Also known as SAN (Systems Area Network).
Provides high reliability. Asymmetric clustering: one server runs the
application while other servers standby. Symmetric clustering: all N hosts are
running the application
15OSAR Autumn 2001
Real time Operating Systems
Often used as a control device in a dedicated application such as controlling scientific experiments, medical imaging systems, industrial control systems, and some display systems.
Real-Time systems may be either hard or soft real-time. Hard - Deadlines are urgent; “Everything”
must be bounded Soft - Deadlines should be met, but if occasionally
a deadline can't be met, likely no one dies
16OSAR Autumn 2001
Embedded Operating Systems
Personal Digital Assistants (PDAs) Some Issues:
Limited memory “Slow” processors Small display screens.
17OSAR Autumn 2001
OS’s: The Bad News...
Modern operating system are: Enormous
Small OS = 100K lines of code Big OS = 10M lines
Complex Poorly understood – too large for one person to
comprehend. (Always) full of bugs and (often)
unreliable Dependent on hardware in strange ways
(makes porting difficult)
18OSAR Autumn 2001
OS Components
19OSAR Autumn 2001
Hardware Components
Components of a simple personal computer
Monitor
Bus
20OSAR Autumn 2001
CPU
(a) A three-stage pipeline(b) A superscalar CPU
21OSAR Autumn 2001
CPU Protection
Sharing system resources requires operating system to ensure that an incorrect program cannot cause other programs to execute incorrectly.
Provide hardware support to differentiate between at least two modes of operations. User mode – execution done on behalf of a user. Monitor mode (also kernel mode or system
mode) – execution done on behalf of operating system.
22OSAR Autumn 2001
CPU Protection (cont)
Mode bit added to computer hardware to indicate the current mode: kernel (0) or user (1).
When an interrupt or fault occurs hardware switches to kernel mode.
Privileged instructions can be issued only in monitor mode.
kernel user
Interrupt/fault
set user mode
23OSAR Autumn 2001
Memory Structure
Typical memory hierarchy numbers shown are rough approximations
24OSAR Autumn 2001
Cache
Use of high-speed memory to hold recently-accessed data.
Requires a cache management policy. Caching introduces another level in storage
hierarchy. This requires data that is simultaneously stored in more than one level to be consistent.
25OSAR Autumn 2001
Memory
Volatile Random Access Memory (RAM)
Ranges from tens to hundreds of Megabytes, Program that can not fit into cache go to Memory.
Complementary Metal Oxide Semiconductor (CMOS) For storing the current time and date, and system setup
parameters. Non-Volatile
Write once Read only Memory (ROM)
Write many EEPROM (Electrically Erasable Programmable ROM)
Flash RAM (special type of EEPROM); The difference is Flash RAM write in block.
Usually, use for storing BIOS (bootstrap loader)
26OSAR Autumn 2001
Memory Protection
One base-limit pair and two base-limit pairs
27OSAR Autumn 2001
I/O Devices
I/O devices and the CPU can execute either synchronously or asynchronously.
Each device controller is in charge of a particular device type.
Each device controller has a local buffer. CPU moves data from/to main memory to/from
local buffers I/O is from the device to local buffer of
controller. Device controller informs CPU that it has
finished its operation by causing an interrupt.
28OSAR Autumn 2001
I/O Devices Protection
All I/O instructions are privileged instructions.
Must ensure that a user program could never gain control of the computer in monitor mode (I.e., a user program that, as part of its execution, stores a new address in the interrupt vector).
29OSAR Autumn 2001
OS Interfaces (Shell, API)
Command interpreter: Interface between OS and your fingers (or mouth…or toes!)
Commands to manipulate files, run and kill programs, access remote machines, change protections on files, etc.
Some OS’s have “built-in” command interfaces, some allow an interface to be “plugged in”
Unix: “shell” (csh, tcsh, bash, ash, zsh, …)
30OSAR Autumn 2001
System calls - Programmer Interface
System calls are the programmer’s interface to the operating system
In modern systems, generally available from a high-level language such as C
Examples: fopen(), ioctl() (see MOS Fig 1.18 for more systems calls)
Previously: Most of OS was written in assembly and system calls were made from assembly language
31OSAR Autumn 2001
System Structure…Or Not?
Simplest system structure: little or none Example: MS-DOS Written to squeeze the most out of limited
hardware Small, some structure, but programmer is
free to go around whatever structure is present anyway
32OSAR Autumn 2001
UNIX (Traditional)
Two “layers” Systems programs, user programs monolithic (one big “blob” of code) kernel
provides: file system scheduling device management etc.
Components are separated by “discipline” and hacking requires care
33OSAR Autumn 2001
Complications & Solutions, Cont.
Use microkernel approach instead: Make kernel very small (provides only a limited
amount of the total OS functionality, like inter-process communication & basic H/W control)
“Plug in” virtual memory system, file system, etc.
Gives encapsulation w/o strict layering
34OSAR Autumn 2001
Virtual Machines
Virtual machine: fancy software which exports an interface that looks like a particular type of “machine”
Can create illusions of multiple computer systems, which can be like the physical hardware or completely different!
35OSAR Autumn 2001
Popular Virtual Machine OS: VM (IBM)
Each user on the machine can run an entirely different OS
One application: Can debug OS while others are working
Another application: Can work on custom OS modifications without taking the system down
What’s more, VM can run VM! Why?
36OSAR Autumn 2001
Virtual Machines, Cont.
Sometimes a VM environment actually produces a virtual machine that's faster than the real thing…on the same hardware! Example: VDM's under OS/2 (Virtual Dos
Machines) How can this be?
VM’s can be very difficult for OS’s like MS-DOS. Why?
37OSAR Autumn 2001
The Java Virtual Machine
Java achieves (relative) platform-independence through the JVM (Java Virtual Machine)
JVM (java) is implemented for each target platform
Java compiler (javac) emits bytecode (as *.class files) rather than architecture-specific machine code
JVM interprets the bytecode
38OSAR Autumn 2001
The Java Virtual Machine, Cont.
Problem: Speed! Java code typically executes more slowly than
“equivalent” C or C++ code Solutions … (more like workaround!)
JIT (Just In Time) compiler, which compiles the bytecode into native machine code immediately before execution
AOT (Ahead of Time) compiler, which compiles the bytecode into native machine code.
Interesting issue: caching
39OSAR Autumn 2001
Summary
A pseudo definition of OS: A software program that acts as an intermediary
between a user or an application program of a computer and the computer hardware
A brief history of OS. A high-level of overview of OS
From top-down perspective, CPU, Memory, Disk, I/O and interrupt handling
From bottom-up perspective, Command interpreter and system calls.
From within, Operating Systems structure.
40OSAR Autumn 2001
For the rest of this semester …
Process Management Threads, scheduling, mutual exclusion, deadlock
, IPC, etc. Memory Management
Paging, caching, swapping I/O System Management
File, Disk, Clock, device driver. Protection and Security. Intro to Distributed Systems.