Chap 01
Chap 01
Computer Systems II
Gordon College
– Theoretical
• Operating Systems (3rd Edition Gary Nutt)
• Lecture and Projects
Slide 1-3
Why Study Operating Systems?
• Understand the model of operation
– Easier to see how to use the system
– Enables you to write efficient code
• Learn to design an OS
• Even so, OS is pure overhead of real work
• Application programs have the real value to
person who buys the computer
Slide 1-4
Software
SoftwareAPI
API
Command
Command
Line Loader
Loader
System Software
Line Window
Interpreter
Interpreter Window
System
System
Libraries
Libraries
Libraries
Libraries
Compiler
Compiler Libraries
Libraries
Database
Database OS
OS
Management
Management
System
System
Hardware
Slide 1-7
Application Software, System Software, and the OS
Human-Computer Interface
Application Software
API
System Software
(More Abstract Resources)
OS Interface
Trusted OS
(Abstract Resources)
Software-Hardware Interface
Hardware Resources
Slide 1-8
The OS as Resource Manager
•Process: An executing program
•Resource: Anything that is needed for a
process to run
–Memory
–Space on a disk
–The CPU
Application
Programmer
OS Programmer
int fprintf(…) {
...
void write() { write(…)
load(…); …
seek(…) }
load(…);
seek(…); out(…)
out(…); }
User Interface
Application
Middleware
Hardware Resources
Slide 1-12
Abstract Machines
Abstract
Machines
Idea
Program
Program Result
Result
Physical
Machine
Idea
Program
Program Result
Result
…
…
…
Idea
Program
Program Result
Result
Slide 1-13
Resource Sharing
OS Resource Sharing
PPi Memory
i Memory
PPk Memory
k Memory
…
Time-multiplexed PPj Memory
j Memory
Physical Processor
Space-multiplexed
Physical Memory
Slide 1-16
Multiprogramming(2)
• Technique for sharing the CPU among
runnable processes
– Process may be blocked on I/O
– Process may be blocked waiting for other
resource, including the CPU
• While one process is blocked, another
might be able to run
• Multiprogramming OS accomplishes CPU
sharing “automatically” – scheduling
• Reduces time to run all processes
Slide 1-17
How Multiprogramming Works
Process 1
Process 2
Process 3
Time-multiplexed CPU
Process 4
Space-multiplexed Memory
Speeding Up the Car Wash Slide 1-18
Vacuum
Wash Dry
Inside
Vacuum
Inside
Wash Dry
Multiprogramming Performance
Pi’s Total Execution Time, ti
Time
0 ti
(a) Pi’s Use of Machine Resources
P1
P2
…
Pi
…
PN
Time
• Batch processing
• Timesharing
• Personal computer & workstations
• Process control & real-time
• Network
• Distributed
• Small computers
Slide 1-21
Batch Processing
Job 3
Job 19
• Uses multiprogramming
• Job (file of OS commands) prepared offline
• Batch of jobs given to OS at one time
• OS processes jobs one-after-the-other
• No human-computer interaction
• OS optimizes resource utilization
• Batch processing (as an option) still used
today
Slide 1-23
A Shell Script Batch File
cc -g -c menu.c
cc -g -o driver driver.c menu.o
driver < test_data > test_out
lpr -PthePrinter test_out
tar cvf driver_test.tar menu.c driver.c test_data test_out
uuencode driver_test.tar driver_test.tar >driver_test.encode
Slide 1-24
Timesharing Systems
Abstract
Machines
Result
Physical
Command Machine
Result
Command
…
Result
Command
Timesharing Systems(2) Slide 1-25
• Uses multiprogramming
• Support interactive computing model
(Illusion of multiple consoles)
• Different scheduling & memory allocation
strategies than batch
• Tends to propagate processes
• Considerable attention to resource isolation
(security & protection)
• Tend to optimize response time
Slide 1-26
Personal Computers
• CPU sharing among one person’s processes
• Power of computing for personal tasks
– Graphics
– Multimedia
• Trend toward very small OS
• OS focus on resource abstraction
• Rapidly evolved to “personal multitasking”
systems
Slide 1-27
Process Control & Real-Time
• Computer is dedicated to a single purpose
• Classic embedded system
• Must respond to external stimuli in fixed
time
• Continuous media popularizing real-time
techniques
• An area of growing interest
Slide 1-28
Networks
Distributed OS
Timesharing
Network OS
Memory Mgmt
Scheduling PC & Wkstation Client-Server Model
Batch Protection
System software
Protocols
Win32
Win32API
API
Win32
Win32API
APISubset
Subset
Win32
Win32API
APISubSet
SubSet
Windows
WindowsCE CE
(Pocket
(PocketPC)
PC)
Windows
Windows95/98/Me
95/98/Me
Windows
WindowsNT/2000/XP
NT/2000/XP
Slide 1-34
Summary