Chapter 1: Introduction and History
Chapter 1: Introduction and History
User programs
programming environment
Operating system interface
Operating system
Hardware interface
Hardware
What does the OS achieve?
Make it easy to write programs
Add more powerful instructions to the hardware
instruction set.
What kind of instructions are added?
Common functions used by many different applications.
E.g. write (fileno, buf, len);
Resource virtualization
E.g. the illusion of Infinite memory.
What does the OS achieve?
Make it easy to run programs
How does a program run on the raw machine?
The program is in memory, starting from program
counter (pc), run one instruction, goto the next
instruction, run until the halt instruction.
How do you run a program?
g++ helloworld.cpp and then a.out.
The OS must fill the gap between how
you run a program and how the
hardware runs a program. The OS must
be able to:
Take the user command (g++, a.out, etc) – shell
Find the executable file (g++ or a.out) – File system
Load the executable into memory – memory management
Set the registers properly (e.g. pc = starting address of the
executable)
When there are multiple programs running, the OS must
make each program feel like it solely owns the whole
machine (CPU, memory, registers) – virtual machine for
each process
Manage processes.
OS functionality: Implements the OS interface
+ resource management
What does an OS achieve?
Ithides the complexity and limitations of
hardware (hardware interface) and
creates a simpler, more powerful
abstraction (OS interface).
Hardware reality vs. OS
abstraction
Reality Abstraction
A single CPU Multiple CPUs
Limited RAM capacity Infinite capacity
Mechanical disk Memory speed access
Insecure and Reliable and secure
unreliable networks
Many physical A single machine
machines
What are the general OS
functions?
Standard services
Screen display, disk accesses, etc
Coordination among applications
Protection, correctness, efficiency, and
fairness
Coordination
Example: Protection
Applications should not crash one another
Address space: all memory addresses that an
application can touch.
Address space for one process is separated from
address space for another process and from the OS.
Applications should not crash the OS
Dual-mode operations
Kernel mode: some instructions can only be executed by
the OS (must be executed with a kernel mode).
User mode: an application can only access its own
address space
Examples of kernel mode instructions?
What is the operating system?
OS is the software layer between the
hardware and user programs.
OS is the ultimate API.
OS is the first program that runs when the
computer boots up.
OS is the program that is always running.
OS is the resource manager.
OS is the creator of the virtual machine.
Resources managed by OS
CPU: process management
Memory: memory management
Storage: storage and file management
I/O devices: I/O management
Who needs OS?
OS makes a computer easier to use
All general purpose computers need OS.
Abetter question: Who does not need
OS?
Some very specialized systems that
usually do one thing (OS can be
embedded in the application).
Microwave oven control
MP3 players, etc.
History of OS: Change!
1980 2000 Factor
Speed CPU 1 MIPS 1,000 MIPS 1,000
Memory 500 ns 2 ns 250
Disk 18 ms 2 ms 9
Modem 300 bits/sec 56 Kbits/sec 200
Capacity Memory 64 Kbytes 128 Mbytes 2,000
Disk 1 Mbytes 6 Gbytes 6,000
Cost Per MIP $100K <= $1 100,000
Other Address bits 8 64 8
Users/machine 10s <=1 .01
History Phase I: Hardware
Expensive, Humans Cheap
Hardware:mainframes
OS: human operators
Handle one job (a unit of processing) at a
time
Computer time
wasted while
operators walk
around the
machine room
OS Design Goal
Efficient use of the hardware
Batch system: collects a batch of jobs
before processing them and printing out
results
Job collection, job processing, and printing out
results can occur concurrently
Multiprogramming: multiple programs
can run concurrently
Example: I/O-bound jobs and CPU-bound jobs
History Phase II: Hardware
Cheap, Humans Expensive
Hardware: terminals
OS design goal: more efficient use of
human resources
Timesharing systems: each user can
afford to own
terminals to interact
with machines
History Phase III: Hardware Very
Cheap, Humans Very Expensive
Hardware: personal computers
OS design goal: allowing a user to
perform many tasks at the same time
Multitasking: the ability to run multiple
programs on the same machine at the
same time
Multiprocessing: the ability
to use multiple processors
on the same machine
History Phase IV: Distributed
Systems
Hardware: computers with networks
OS design goal: ease of resource
sharing among machines
The Bottom Line