Operating Systems I

Download Report

Transcript Operating Systems I

Operating Systems I
An Introduction
to
Operating System
Concepts
CMSC 104
1
What’s an Operating System?
“The Boss”
 “The Big Cheese”
 “The Godfather”
 “The Power Behind the Scenes”
 A control program the manages all the
resources of the computer on which it
runs.

CMSC 104
2
OS Introduction

Most computers multitask (do many
things “at once”)
o read/write disks and tapes
o send/receive network traffic
o run several programs.

CMSC 104
Resources must be shared and
programs coordinated
3
OS Introduction

The operating system manages multitasking systems.
o What resources are available.
o Who gets to use them.
--- “Not now Bobby, it’s Sally’s turn.” -- Also provides:
o standard interfaces (ways to use) to
computer hardware
o standard utility programs supporting other
software.
CMSC 104
4
“McDonalds Model” of an Operating
System
Fries
Customers
(Applications)
Grill
Counter
Drinks
Crew
(Operating System)
Crew Serves Customers. Customers Don’t Cross Counter
CMSC 104
5
Operating System Evolution
“Batch” Operating Systems

“One-at-a-time” in a “batch”
o Usually single-task
o Execution required significant setup of
equipment and software
o Each program was a job (“batch job”)
o OS designed to simplify setup and
transition between jobs
CMSC 104
6
Batch Operating Systems (cont’d)

Operators served as “High Priests.”
o Users didn’t touch computers
•User’s “submitted” jobs
•Picked up program output
•Written/punched input and instructions
•Printed/punched output and error reports
o Turn around: minutes to days
“Error 410: Unterminated Do Loop, line 66”
CMSC 104
7
Operating System Evolution
Interactive Processing

OS for Interactive Processing
o Started with “operator-like” single user
o Users interact directly via remote terminals
(workstations) --- “On-Line processing”
o Users demand timely response
o Machines too expensive for single users
N.B. “real-time” means “must respond in
limited time or fail” --- not on-line system
CMSC 104
8
Operating System Evolution
Time-Sharing Systems
Really “time-slicing” systems
 Operating system:

o puts jobs in a “circular queue”
o gives each job a predetermined “time slice”
o swaps old job out and new one in at the
end of each slice
o repeats fast enough to give illusion of
simultaneously execution
CMSC 104
9
Operating System Evolution
Time-Sharing Systems (continued)

“Radar O’Reilly” model of operating
systems
o Read the mail
o Make the coffee
o Check on Hawkeye
o Answer the phone

CMSC 104
Only one job at a time, but all progress
“on the average.”
10
Operating System Evolution
Time Sharing (cont’d)

Other Benefits:
o best allocation of user time --- no “dead
time” at the keyboard
o no waiting for peripherals --- other
processes can execute while one waits.

Costs:
o complexity
CMSC 104
11
Operating System Evolution
Examples

Batch Systems:
o IBM 1620, early MITS

Interactive systems:
o DOS, early MacOS, VIC20, Commodore
64

Time-Sharing systems:
o Unix, Linux, Multics, IBM MVS, DEC VMS
o Windows 95/98/NT, later MacOS
CMSC 104
12
Different Operating Systems on the
Same Machine ?

Only one at a time
o VAX: VMS or Ultrix
o IBM PCs: Linux or Windows or OS/2

Emulators let one OS act like another
o “Soft-PC”: Mac
Windows
o “Wine” and “Wabi”: Linux
Windows
o Cygnus Windows: Win95/98/NT
Unix
o Not always complete
CMSC 104
13
Inside the Operating System
The OS Shell

Defines interface between OS and
users
o Windows GUI
o UNIX command line
o UNIX users can choose among a variety of
shells
•csh is the “C shell”
•tcsh is an enhanced “C shell”
o Shell programming
CMSC 104
14
Inside the Operating System
OS Shell interface
Users
Users
O/S
Users
shell
CMSC 104
15
Inside the Operating System
Different Shells/Same Results
BASH
Different
Command
Sets
SH
CSH
Operating
System
Same
Results
TCSH
CMSC 104
16
Inside the Operating System
The OS Kernel
Central part (“hard nugget”) of
Operating System
 Kernel Components

o File Manager
o Device Drivers
o Memory Manager
o Scheduler
o Dispatcher
CMSC 104
17
Inside the Opeating System
File Manager

Maintains information about the files
that are available on the system
o location
o size, type, and protections
o what storage is still available

CMSC 104
Files usually allowed to be grouped in
directories or folders. Allows
hierarchical organization.
18
Inside the Operating System
Device Drivers
Software to communicate with
peripheral devices or controllers
 Each driver is unique
 Translates general requests into specific
steps for that device

“read poker.exe”
CMSC 104
Device
Driver
“read device 0xA3,
cylinder 3, track 13,
sector 43”
19
Inside the Operating System
Memory Manager
Controls use of main memory
 Allocates memory for each program and
its data
 Reclaims memory when programs
release it (or finish).
 Is supposed to know what areas are
free.
“Memory leak”
manager loses track

CMSC 104
20
Inside the Operating System
Memory Manager (cont’d)

Virtual memory (“Imaginary memory”)
o Programs only need their current data in
memory. (“What’s your VIN?”)
o Store remainder on disk & keep location.
o Bring other data back (and put this data
out) when other data is needed.
o Creates the illusion of additional memory
by rotating (swapping) programs and data
between main memory and mass storage
CMSC 104
21
Inside the Operating System
Virtual Memory for People
Calendar
You
Sticky
notes
Notebooks
CMSC 104
22
Inside the Operating System
Scheduler
Maintains a record of processes that are
present, adds new processes, removes
completed processes
 Tracks

o memory area(s) assigned
o priority
o state of readiness to execute (ready/wait)
CMSC 104
23
Inside the Operating System
Dispatcher
Executes processes when scheduled
and ready
 Gives each process a small (50 ms)
time slice in which to execute
 Stops process when time is up.
 Waits for scheduler to update process
record
 Starts next scheduled process.

CMSC 104
24
What’s a Process
The dynamic activity of executing a
program
 The process state is a “snapshot” of
the machine, including values of the
CPU registers, program counter and
other memory cells
 A single program can be associated
with multiple processes simultaneously

CMSC 104
25
Inside the Operating System
Types of software

Applications software
Do something “for the outside world.”
 Often transportable


System Software
Performs tasks supporting operation of
computer systems (“not outside world”)
e.g. operating systems
 Usually tightly coupled to hardware

CMSC 104
26
Inside the Operating System
Types of software (cont’d)

Utility software
o provides fundamental not included OS
(check spelling, count words, calculator)
o “extend” the OS (or “support” applications)
o Distinction between applications and
utilities is often vague
o Distinction between OS and utilities is also
vague
CMSC 104
27
Inside the Operating System
Utilities
Operating Systems usually come with
some associated utility programs
 UNIX usually has the text editors emacs
and vi (and sometimes pico)
 UNIX has its own sort utility
 UNIX has its own mail utility

(The contraction “it’s” means “it is,” not “belonging to it.”)
CMSC 104
28
Inside the Operating System
Summary
Shell -- interface to user
 File Manager -- manages mass memory
 Device Drivers -- communicate with
peripherals
 Memory manager -- manages main
memory
 Scheduler & Dispatcher -- manage
processes

CMSC 104
29