Operating System MIST
Operating System MIST
INTRODUCTION TO
OPERATING SYSTEMS
Class 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
◻ Security & protection
Overview: Chapter 1
◻ What is an operating system, anyway?
◻ Operating systems history
◻ The zoo of modern operating systems
◻ Review of computer hardware
◻ Operating system concepts
◻ Operating system structure
User interface to the operating system
Anatomy of a system call
What is an operating system?
◻ A program that runs on the “raw” hardware and supports
Resource Abstraction
Resource Sharing
◻ Abstracts and standardizes the interface to the user across
different types of hardware
Virtual machine hides the messy details which must be performed
◻ Manages the hardware resources
Each program gets time with the resource
Each program gets space on the resource
◻ May have potentially conflicting goals:
Use hardware efficiently
Give maximum performance to each user
1.1 General Definition
Mainboard
1.1 General Definition
1.1 General Definition
mainboard
1.1 General Definition
processor
1.1 General Definition
RAM
1.1 General Definition
hardware directly.
1.1 General Definition
ENIAC 1943
1.2 History of Operating Systems
ENIAC’s backside
1.2 History of Operating Systems
punch card
1.2 History of Operating Systems
1.2 History of Operating Systems
Paper tape
1.2 History of Operating Systems
1.2 History of Operating Systems
http://www.computerhistory.org/babbage/
1.2 History of Operating Systems
Data for
$END
program
$RUN
FORTRAN $LOAD
program
$FORTRAN
$JOB, 10,6610802, ETHAN MILLER
Third generation: multiprogramming
◻ Multiple jobs in memory
Protected from one another
Job 3 ◻ Operating system protected
from each job as well
Job 2 ◻ Resources (time, hardware)
Memory split between jobs
partitions Job 1
◻ Still not interactive
User submits job
Operating Computer runs it
system User gets results minutes (hours,
days) later
Spooling
◻ Original batch systems used tape drives
◻ Later batch systems used disks for buffering
Operator read cards onto disk attached to the computer
Computer read jobs from disk
Computer wrote job results to disk
Operator directed that job results be printed from disk
◻ Disks enabled simultaneous peripheral operation on-line
(spooling)
Computer overlapped I/O of one job with execution of
another
Better utilization of the expensive CPU
Still only one job active at any given time
Spooling
◻ Stands for Simultaneous Peripheral Operation
On-Line
◻ Takes advantage of disk technology (new at this
point)
◻ Allows for overlap of IO from one job with the
computation of another job
◻ While executing current job
Read next job from card reader to disk
Print previous job to printer
◻ Disk is relegated to the role of a partitioned buffer
Job pool
◻ Advent of disk allows for random access
(Tape and card are sequential)
◻ Several jobs can be waiting on the disk
◻ The job pool is a data structure that contains info and
points to the jobs on the disk
◻ We can now have job scheduling to determine the
order in which the jobs run so that CPU utilization can
increase.
Multitasking (Time-sharing)
◻ Extension of Multiprogramming
Need for user interactivity
Instead of switching jobs when waiting for IO, a timer causes jobs to
switch
◻ User interacts with computer via CRT and keyboard
Systems have to balance CPU utilization against response time
Better device management
◻ Need for file system to allow user to access data and code
◻ Need to provide user with an “interaction environment”
Virtual Memory
◻ Programs can be larger than memory
Program loaded into memory as needed
Active program and data “swapped” to a disk until
needed
◻ Memory space treated uniformly
rd
Key Events 3 Generation
◻ 1964-1966 IBM/360 and OS/360
◻ 1964 Dartmouth Time Sharing System
◻ 1965 DEC PDP-8
◻ 1965 MIT – Multics Time sharing System
◻ 1969 – Beginnings of ARPANet
◻ 1969 - Unix
◻ 1971 IBM 4001 – Processor on a chip
◻ 1973 – Ethernet concept Bob Metcalf @ Xerox
Parc
◻ 1974 - Gary Kildall – CP/M OS
◻ 1974 Zilog Z80 Processor
Key Events (cont)
◻ 1974 - Edward Roberts, William
Yates and Jim Bybee
MITS Altair 8800.
■ $375
■ contained 256 bytes of memory
■ no keyboard, no display, and no aux
storage device.
◻ 1976 Steve Jobs and Steve
Wozniak
Apple II
◻ 1977 Commodore PET, Radio
Shack TRS_80
◻ 1979 Unix 3BSD
Fourth Generation : (1980 – 1990)
◻ Personal Computers
◻ Computer dedicated to a single user
◻ IO Devices now consist of keyboards, mice, CGA-VGA
displays, small printers
◻ User convenience and responsiveness
◻ Can adopt lessons from larger operating systems
◻ No need for some of the advanced options at the
personal level
th
Key Events 4 Generation
◻ 1981 IBM PC (8086)
◻ 1981 Osborne 1
◻ 1981 Vic 20
◻ 1981 Xerox Star Workstation
◻ 1984 Apple macintosh
◻ 1984 SunOS
◻ 1985 C++
◻ 1985 MSWindows
◻ 1986 – 386 Chip
th
Key Events 4 Generation (cont)
◻ 1987 OS/2
◻ 1988 Next Unix Workstations
◻ 1989 Motif
◻ 1990 Windows 3,
◻ 1990 Berners-Lee Prototype for the web
Types of modern operating systems
◻ Mainframe operating systems: MVS
◻ Server operating systems: FreeBSD, Solaris
Outside
world
bin cse
faculty grads
ls ps cp csh
elm sbrandt kag amer4
classes research
stuff stuff
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
System calls
◻ Programs want the OS to perform a service
Access a file
Create a process
Others…
◻ Accomplished by system call
Program passes relevant information to OS
OS performs the service if
■ The OS is able to do so
■ The service is permitted for this program at this time
OS checks information passed to make sure it’s OK
■ Don’t want programs reading data into other 1programs’
58 Chapter
Making a system call
0xffffffff
Library
◻ System call:
(read call) read(fd,buffer,length)
◻ Program pushes arguments,
Return to caller
Trap to kernel calls library
3 Trap code in register ◻ Library sets up trap, calls
User
space 8 OS
2
◻ OS handles system call
4 Increment SP 9 7
Call read ◻ Control returns to library
1 Push arguments ◻ Library returns to user
User program
Sys
Kernel code
Dispatc 5 6 call
space
h handle
(OS)
r
0
System calls for files & directories
Call Description
fd = open(name,how) Open a file for reading and/or writing
s = close(fd) Close an open file
n = read(fd,buffer,size) Read data from a file into a buffer
n = write(fd,buffer,size) Write data from a buffer into a file
s = lseek(fd,offset,whence) Move the “current” pointer for a file
s = stat(name,&buffer) Get a file’s status information (in buffer)
s = mkdir(name,mode) Create a new directory
s = rmdir(name) Remove a directory (must be empty)
s = link(name1,name2) Create a new entry (name2) that points to the
same object as name1
s = unlink(name) Remove name as a link to an object (deletes
the object if name was the only link to it)
More system calls
CS 1550,
cs.pitt.edu
(originaly
modified by
Ethan L. Miller
and Scott A.
Brandt)
Call Description
pid = fork() Create a child process identical to the
parent
pid=waitpid(pid,&statloc,options) Wait for a child to terminate
s = execve(name,argv,environp) Replace a process’ core image
exit(status) Terminate process execution and return
status
s = chdir(dirname) Change the working directory
s = chmod(name,mode) Change a file’s protection bits
s = kill(pid,signal) Send a signal to a process
seconds = time(&seconds) Get the elapsed time since 1 Jan 1970
61 Chapter 1
A simple shell
while (TRUE) { /* repeat forever */
type_prompt( ); /* display prompt */
read_command (command, parameters) /* input from terminal */
Service
routines
Utility
routines
Virtual machines
App1 App2 App3
System calls Linux Windows NT FreeBSD
I/O instructions VMware VMware VMware
Calls to simulate I/O Linux
“Real” I/O instructions Bare hardware
◻ First widely used in VM/370 with CMS
◻ Available today in VMware
Allows users to run any x86-based OS on top of Linux or NT
◻ “Guest” OS can crash without harming underlying OS
Only virtual machine fails—rest of underlying OS is fine
◻ “Guest” OS can even use raw hardware
Virtual machine keeps things separated
Microkernels (client-server)
Termina
Client Client Process File Memory
l … User mode
process process server server server
server
Microkernel Kernel mode