Introduction - Faruk Hadziomerovic

Download Report

Transcript Introduction - Faruk Hadziomerovic

Chapter 1
Introduction
1.1 What is an operating system
1.2 History of operating systems
1.3 The operating system zoo
1.4 Computer hardware review
1.5 Operating system concepts
1.6 System calls
1.7 Operating system structure
1
Introduction
A computer system consists of
– hardware
– system programs
– application programs
2
What is an Operating System
• It is an extended machine
– Hides the messy details which must be performed
– Presents user with a virtual machine, easier to use
• It is a resource manager
– Each program gets time with the resource
– Each program gets space on the resource
3
History of Operating Systems
• First generation 1945 - 1955
– vacuum tubes, plug boards
• Second generation 1955 - 1965
– transistors, batch systems
• Third generation 1965 – 1980
– ICs and multiprogramming
• Fourth generation 1980 – present
– personal computers
4
Batch Operating System 2nd generation
Structure of a typical FMS (Fortran Monitor System) job
5
Batch OS speed-up
Early batch system
a.
b.
c.
bring cards to 1401
read cards to tape
put tape on 7094 which
does computing
d. load 7094 with system tape
e. put result tape from 7094 to 1401
f. 1401 prints output
6
Multiprogramming System 3rd generation
To use (expensive) CPU during
Intensive I/O one needs many jobs
ready to run (in memory). So when
Job1 needs I/O CPU waiting for data
in/out (spooling – Simultaneous
Peripheral Operation On Line) Job 2
can run by CPU, or Job3 etc.
Consequence: short jobs wait
disproportional time to finish due
to the long jobs. With multi-users
on-line terminals the short jobs wait
long. Solution is time sharing.
Timesharing on modified 7094 CTSS (Compatible Time
Sharing System) MIT 1962 followed by MULTIX 1972
(MULTiplexed Information and Computing Service) on
GE-645 mainframe, followed by Bell Labs stripped down
version called UNIX.
7
Batch (multiprogramming and time sharing) vs. Multiuser
submitted
jobs
(spooling)
Video
terminal
disk
I/O
CPU
finished
jobs
disk
Video
terminal
a. Multiprogramming
Video
terminal
Video
terminal
time
slice
submitted
jobs
CPU
Main
frame
disk
I/O
finished
jobs
b. Timesharing - CTSS
disk
c. Multiuser - UNIX
8
The Operating System Zoo
•
•
•
•
•
•
Mainframe operating systems
Server operating systems
Multiprocessor operating systems
Personal computer operating systems
Real-time operating systems
Embedded operating systems e.g. PDA
(Personal Digital Assistant)
• Smart card operating systems (credit cards
containing CPU chip)
9
Personal Computers: 4-th generation
•
•
•
•
•
•
•
1974 Intel 8080 made first CPU on a chip asked its consultant Gary Kildall
operating system to test it. Kildall hooked Shugart Associates floppy disk to it
and wrote first CP/M operating system for this PC. Kildall formed Digital
Research company with rights to sell CP/M. For 5 years they rewrote it for
other CPUs like Zilog Z80 with many application programs on it.
In early 1980 IBM searched for OS for its PC. They contacted Bill Gates for
OS and he suggested Digital Research. Kildall didn’t want to sell to non-end
user like IBM. IBM asked Bill Gates to write OS for them. Bill approached
Seattle Computer Products that had DOS (Disk Operating System) and bought
a license for U$ 50,000 and delivered it as MS-DOS (from his Microsoft
company).
1983 IBM released PC with Intel 80286 and Microsoft delivered MS-DOS.
Later Microsoft incorporated many features of Unix -> Xenix.
1984 Xerox changed CLI (Command Language Interface) to GUI (Graphical
User Interface) invented by Doug Engelbart at Stanford Research Institute
1960.
1988 Steve Jobs co-inventor of Apple (first PC) visited Xerox and applied GUI
to Apple OS in PC called Macintosh.
1995 Microsoft followed Apple and built Windows i.e. MS-DOS with GUI.
Windows 95, 98, NT -> 2000, Millenium,
10
Computer Hardware Review (1)
Monitor
Bus
Components of a simple personal computer
11
Computer Hardware Review (2)
A three-stage pipeline
A superscalar CPU
Specialized Execution units: one for integer arithmetic, one for floating
point arithmetic one for Boolean operations, with two parallel instruction
fetch.
Most CPU have kernel (supervisor or privileged) mode and user mode
controlled by bit in PSW.
12
Computer Hardware Review (3)
Typical memory hierarchy
(numbers shown are rough approximations)
13
Computer Hardware Review (4)
Structure of a disk drive
14
Single user vs. multi-user memory map
Memory allocation using base registers.
Base-limit pair and two base-limit pairs
15
I/O devices and interrupt
(a)
(b)
(a) Steps in starting an I/O device and getting interrupt
(b) How the CPU serves an interrupt.
16
Structure of a large Pentium system
IDE - Integrated Drive Electronics
ISA - Industry Standards Associate 16.67 MB/s
PCI – Peripheral Component Interconnect 528 MB/s USB – Universal Serial Bus 1.5 MB/s
SCSI – Small Computer System Interface 160 MB/s (fast disks etc.)
17
Process Tree
A created two child processes, B and C
B created three child processes, D, E, and F
Every process has a process identifier (integer) called PID (process
identifier).
18
Memory map of a process
• Processes have three segments: text, data, stack
19
Batch multiprogramming OS
Disk
Card
reader
Console
Main
memory
CPU
Video
memory
Line
printer
a. Computer infrastructure.
software processes
Input
spooler
executive
output
spooler
hardware processes
(drivers)
Card
reader
disk
Line
printer
b. OS processes.
20
States of a user job in a batch system
running
in input
spooler
spooling
complete
in the
executive
ready
execution
complete
in output
spooler
blocked
21
Unix as multiuser OS
Init {
for (i=1; i=no_of_terminals; i++) {
If (fork()!=0) {
wait /*parent*/
else
exec(getty, param, ttyn)
}
Video
terminal
Video
terminal
Video
terminal
getty {
prompts login
checks name and password
if ok spawns a shell
}
Video
terminal
Main
frame
22
Stripped down shell
while (TRUE) {
type_prompt( );
read_command (command, parameters)
terminal */
if (fork() != 0) {
/* Parent code */
waitpid( -1, &status, 0);
to exit */
}
else {
/* Child code */
execve (command, parameters, 0);
}
/* repeat forever */
/* display prompt */
/* input from
/* fork off child process */
/* wait for all children
/* execute command */
23
Process interact: client-server model
24
Two processes connected by a pipe
> ls
> ls | grep d
fred
billie
doug
jeneanne
fred
doug
grep (global regular expression print) prints lines with “expression” in it.
25
Four way stop - deadlock example
(a) A potential deadlock. (b) an actual deadlock.
Example:
Process 1:
Print on Lp
Open file
Process 2:
Open file
Print on Lp
26
OS as a file system manager
Every process has a working directory.
File must be opened when system returns small integer called file id or I-number in Unix.
27
Unix device mounting
•
•
Unix does not allow device to be specified by drive name (like DOS example A:
etc.). MOUNT system call inserts I/O device files into any regular directory.
I/O devices look like special files kept in /dev directory (example: /dev/lp).
a) Before mounting files on floppy are inaccessible.
b) After mounting floppy on b, files on floppy are part of file hierarchy.
28
Mount System Call
File system before the mount
File system after
the mount
mount(“/dev/fd0”, “/mnt”, 0)
where 3-rd parameter is read-write or read-only.
29
File linking (same file under two names)
(a) Two directories before linking (memo as note)
link(“/usr/jim/memo”, “usr/ast/note”)
(b) The same directories after linking.
30
Simple structuring model for a monolithic system
(kernel mode)
Main program calls service procedures (by systems calls)
that calls utility procedures in kernel mode (using Traps).
31
Steps in Making a System Call
There are 11 steps in making the system call
read (fd, buffer, nbytes)
32
Some System Calls For Process Management
33
Some System Calls For File Management
lseek returns pointer to the position in a file with fd=file descriptor pointer, offset (bytes),
whence is either from beginning of a file, current position, or end of the file.
34
Some System Calls For Directory Management
35
Some System Calls For Miscellaneous Tasks
36
System Calls Unix vs. Windows
Some Win32 API (Application Program Interface) calls
37
Structure of the THE operating system
38
Structure of VM/370 with CMS
CMS – Conversational Monitor System
39
The client-server model in a distributed system
40
The metric prefixes
41