1 OS Lecture
1 OS Lecture
1 OS Lecture
Hardware
◦ Provides basic computing resources (CPU, memory,
I/O devices).
Operating System
◦ Controls and coordinates the use of hardware among
application programs.
Application Programs
◦ Solve computing problems of users (compilers,
database systems, video
◦ games, business programs such as banking software).
Users
◦ • People, machines, other computers
OS is the software that acts an intermediary (agent or
mediator) between the user applications and
computer hardware.
Function of OS
◦ Memory Management System
◦ File Management System
◦ Resource Management System
◦ Process Management System
◦ Protection and Security
Protection mechanisms control access of programs and
processes to user and system resources.
◦ Protect user from himself, user from other users,
system from users.
Protection mechanisms must:
◦ Distinguish between authorized and unauthorized
use.
◦ Specify access controls to be imposed on use.
◦ Provide mechanisms for enforcement of access
control.
• Security mechanisms provide trust in system and
privacy
◦ authentication, certification, encryption etc.
Reliability
◦ Does the system do what it was designed to do?
Availability
◦ What portion of the time is the system working?
◦ Mean Time To Failure (MTTF), Mean Time to
Repair
Security
◦ Can the system be compromised by an attacker?
Privacy
◦ Data is accessible only to authorized users
Performance
◦ Latency/response time
◦ How long does an operation take to complete?
◦ Throughput
◦ How many operations can be done per unit of time?
◦ Overhead
◦ How much extra work is done by the OS?
◦ Fairness
◦ How equal is the performance received by different users?
◦ Predictability
◦ How consistent is the performance over time?
Portability
◦ For programs:
◦ Application programming interface (API)
◦ For the kernel
◦ Hardware abstraction layer
Need to understand interaction between the
hardware and software
◦ Need to understand basic principles in the
design of computer systems efficient
resource management, security, flexibility
Because it enables you to do things that are
difficult/impossible otherwise.
Early Operating Systems
Simple Batch Systems
Multi-programmed Batch Systems
Time-sharing Systems
Personal and mobile Computer Systems
Structure
• Large machines run from console
• Single user system
• Programmer/User as operator
• Paper tape or punched cards
Early software
• Assemblers, compilers, linkers,
loaders,
device drivers, libraries of common
subroutines.
Secure execution
• Inefficient use of expensive
resources
• Low CPU utilization, high setup
time. Hardware – expensive ; Human –
cheap
Reduce setup time by batching jobs with similar requirements.
Hire an operator
◦ User is NOT the operator
Automatic job sequencing
◦ Forms a rudimentary OS.
◦ Resident Monitor
Holds initial control, control transfers to job and then back to monitor.
Problem
◦ Need to distinguish job from job and data from program.
◦ Special cards indicate what to do.
◦ User program prevented from performing I/O
Solutions to speed up I/O:
• Offline Processing
◦ load jobs into memory from tapes, card reading
and line printing are done
offline.
◦ User submits card deck
◦ cards put on tape
◦ tape processed by operator
◦ output written to tape
◦ tape printed on printer
◦ Separate user from computer
• Problems
◦ Long turnaround time - up to 2 DAYS!!!
◦ Low CPU utilization
◦ I/O and CPU could not overlap; slow mechanical devices
Spooling (Simultaneous Peripheral Operation On-Line)
◦ Use disk (random access device) as large storage for reading
as many input files as possible and storing output files until
output devices are ready to accept them.
Allows overlap - I/O of one job with computation of another.
Introduces notion (idea or concept) of a job pool that allows
choose next job to run so as to increase CPU utilization
Data moved directly between I/O devices and memory
CPU can work on other tasks
How do we know that I/O is complete?
Polling:
◦ Device sets a flag when it is busy.
◦ Program tests the flag in a loop waiting for completion of
I/O.
Interrupts:
◦ On completion of I/O, device forces CPU to jump to a
specific
instruction address that contains the interrupt service routine.
◦ After the interrupt has been processed, CPU returns to code
it was executing prior to servicing the interrupt.
Use interrupts to run multiple programs
simultaneously
◦ When a program performs I/O, instead of polling,
execute another program till interrupt is received.
Requires secure memory, I/O for each program.
Requires intervention if program indefinite loops.
Requires CPU scheduling to choose the next job to
run.
Hardware – getting cheaper; Human – getting expensive
•Programs queued for execution in FIFO order.
•Like multiprogramming, but timer device interrupts after a quantum (time slice).
◦ Interrupted program is returned to end of FIFO
◦ Next program is taken from head of FIFO
Control card interpreter replaced by command language interpreter.
Interactive (action/response)
◦ when OS finishes execution of one command, it seeks the next
control statement from user.
File systems
◦ online files system is required for users to access data and code.
Virtual memory
◦ Job is swapped in and out of memory to disk.
Hardware – cheap ; Human – expensive