Operating Systems

Download Report

Transcript Operating Systems

OPERATING SYSTEMS
BIT 1003
OUTLINE
Introduction, concepts, review & historical
perspective
 Processes

Synchronization
 Scheduling
 Deadlock

Memory management, address translation, and
virtual memory
 Operating system management of I/O
 File systems

WHY SHOULD I STUDY
OPERATING SYSTEMS?

Need to understand interaction between the
hardware and applications


Need to understand basic principles in the design
of computer systems


New applications, new hardware..
efficient resource management, security, flexibility
Increasing need for specialized operating systems
e.g. embedded operating systems for devices - cell
phones, sensors and controllers
 real-time operating systems - aircraft control,
multimedia services

4
THE SERVICES OPERATING SYSTEMS
PROVIDE INCLUDE:
Management of I/O
 Management of memory
 Scheduling of user processes (start, interrupt,
and stop)
 A secure and reliable environment for programs
and users
 A convenient interface for users
 Networking services
 Messaging and synchronization services between
processes
 Utility “system software” such as editors, loaders,
help, etc.

OPERATING SYSTEM TIMELINE

First generation: 1945 – 1955



Second generation: 1955 – 1965



Integrated circuits
Multiprogramming
Fourth generation: 1980 – present



Transistors
Batch systems
Third generation: 1965 – 1980



Vacuum tubes
Plug boards
Large scale integration
Personal computers
Next generation: ???


Systems connected by high-speed networks?
Wide area resource management?
FIRST GENERATION: DIRECT INPUT

Run one job at a time
Enter it into the computer (might require rewiring!)
 Run it
 Record the results


Problem: lots of wasted computer time!
Computer was idle during first and last steps
 Computers were very expensive!


Goal: make better use of an expensive
commodity: computer time
SECOND GENERATION: BATCH SYSTEMS
Bring cards to 1401
 Read cards onto input tape
 Put input tape on 7094
 Perform the computation, writing results to
output tape
 Put output tape on 1401, which prints output

THIRD GENERATION: MULTIPROGRAMMING

Multiple jobs in memory

Job 3
Protected from one
another
Operating system
protected from each job
as well
 Resources (time,
hardware) split between
jobs
 Still not interactive

Job 2
Memory
partitions
Job 1
Operating
system



User submits job
Computer runs it
User gets results minutes
(hours, days) later
TIMESHARING

Multiprogramming allowed several jobs to be
active at one time
Initially used for batch systems
 Cheaper hardware terminals -> interactive use


Computer use got much cheaper and easier
No more “priesthood”
 Quick turnaround meant quick fixes for problems

TYPES OF MODERN OPERATING SYSTEMS
Mainframe operating systems: MVS
 Server operating systems: FreeBSD, Solaris
 Multiprocessor operating systems: Cellular IRIX
 Personal computer operating systems: Windows,
Unix
 Real-time operating systems: VxWorks
 Embedded operating systems
 Smart card operating systems
Some operating systems can fit into more than
one category

MANAGEMENT OF INPUT AND
OUTPUT
Outside
world
Video
controller
Hard drive
controller
CPU
Memory
USB
controller
Network
controller
Computer internals
(inside the “box”)
ANATOMY OF A DEVICE REQUEST
(INTERRUPT)
3
CPU
1
5 Interrupt
controller
6
2
Disk
controller
4
1: Interrupt
Instructionn
Instructionn+1
Operating
system
3: Return
Interrupt handler
2: Process interrupt

Left: sequence as seen by hardware




Request sent to controller, then to disk
Disk responds, signals disk controller which tells interrupt
controller
Interrupt controller notifies CPU
Right: interrupt handling (software point of view)
DIRECT MEMORY ACCESS



A improvement in efficiency is possible when the I/O
device is relatively fast, like a disk drive or a tape
drive.
The computer design may include one or more direct
memory access (DMA) controllers (or channels).
A DMA controller is a computer within the computer
that specializes in I/O, and its purpose is to
drastically reduce the number of interrupts that the
OS must service.
MEMORY MANAGEMENT


The operating system is responsible for assigning
to processes memory in which to execute.
Operating system is responsible for managing a
whole array of memories in support of processes,
principally main memory, cache memory, and
disk memory.
STORAGE PYRAMID
Capacity
Better

< 1 KB
Registers
1 ns
1 MB
Cache (SRAM)
2–5 ns
256 MB
Main memory (DRAM)
50 ns
40 GB
Magnetic disk
5 ms
> 1 TB
Magnetic tape
50 sec
Goal: really large memory with very low latency



Access latency
Latencies are smaller at the top of the hierarchy
Capacities are larger at the bottom of the hierarchy
Solution: move data between levels to create illusion
of large memory with low latency
Better
DISK DRIVE STRUCTURE

Up to two surfaces per
platter
 One or more platters per
disk


Data in concentric tracks

Tracks broken into sectors



head
Data stored on surfaces
256B-1KB per sector
platter
track
cylinder
Cylinder: corresponding
tracks on all surfaces
Data read and written by
heads
Actuator moves heads
 Heads move in unison

sector
surfaces
spindle
actuator
1
7
MEMORY
Address
0x2ffff
0x2b000
Address
User program
and data
0x27fff
User program
and data
0x23000
0x1dfff
Limit
0x2ffff
0x2d000
User data
0x2bfff
0x29000
User data
0x24fff
Base
0x23000


Base2
Limit1
Base1
0x1dfff
Operating
system
0
User program
Limit2
Operating
system
0
Single base/limit pair: set for each process
Two base/limit registers: one for program, one for
data
1
8
OPERATING SYSTEMS CONCEPTS
 Processes
(and trees of processes)
 Deadlock
 File
systems & directory trees
 Pipes
PROCESSES

Address space (memory) the
program can use
 State (registers, including
program counter & stack
pointer)

A
B
C
D


E
Process: program in execution
F
G
OS keeps track of all
processes in a process table
Processes can create other
processes





Process tree tracks these
relationships
A is the root of the tree
A created three child
processes: B, C, and D
C created two child processes:
E and F
D created one child process:
G
DEADLOCK
Potential deadlock
Actual deadlock
HIERARCHICAL FILE SYSTEMS
INTERPROCESS COMMUNICATION
Processes want to exchange information with each
other
 Many ways to do this, including



Network
Pipe (special file): A writes into pipe, and B reads from it
A
B
2
3
EXERCISES
 6.1,
6.2, 6.4