1 operating systems lecturer: szabolcs mikulas office: b38b e-mail: [email protected] url:...
TRANSCRIPT
![Page 1: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/1.jpg)
1
OPERATING SYSTEMS
Lecturer: Szabolcs MikulasOffice: B38BE-mail: [email protected]: http://www.dcs.bbk.ac.uk/~szabolcs/os.html
Textbook:A.S. Tanenbaum, Modern Operating Systems,Second edition, Prentice Hall, 2001,ISBN 0-13-031358-0
![Page 2: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/2.jpg)
2
OUTLINE
1. Introduction2. Processes and threads3. Deadlock4. Memory management5. Input/output6. File systems7. Multimedia operating systems8. Multiple processor systems9. Security
UNIX and Windows are to be used as running case studies.
![Page 3: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/3.jpg)
3
Introduction
Chapter 1
1.1 What is an operating system1.2 History of operating systems1.3 The operating system zoo1.4 Computer hardware review1.5 Operating system concepts1.6 System calls1.7 Operating system structure
![Page 4: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/4.jpg)
4
Introduction
• A computer system consists of– hardware– system programs– application programs
![Page 5: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/5.jpg)
5
What is an Operating System• It is an extended, or virtual, machine
– provides a simple, high-level abstraction, i.e., hides the “messy details” which must be performed
– presents user with a virtual machine, easier to use– provides services; programs obtain these by
system calls
• It is a resource manager– provides orderly and controlled allocation for
programs in terms of time and space, multiplexing
![Page 6: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/6.jpg)
6
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
![Page 7: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/7.jpg)
7
Second Generation
Early batch system– bring cards to 1401– read cards to tape– put tape on 7094 which does computing– put tape on 1401 which prints output
![Page 8: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/8.jpg)
8
Second Generation (2)
• Structure of a typical FMS job – 2nd generation
![Page 9: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/9.jpg)
9
Third Generation
Third generation:• Multiprogramming • Timesharing• MULTICS => UNIX
![Page 10: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/10.jpg)
10
Fourth Generation
Fourth generation (1980- ) - Personal computers
• MS-DOS, • Graphical User Interface (GUI),• Windows,• Network and distributed OSs
![Page 11: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/11.jpg)
11
The Operating System Zoo
• Mainframe operating systems
• Server operating systems
• Multiprocessor operating systems
• Personal computer operating systems
• Real-time operating systems
• Embedded operating systems
• Smart card operating systems
![Page 12: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/12.jpg)
12
Computer Hardware Review
• Components of a simple personal computer
Monitor
Bus
![Page 13: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/13.jpg)
13
Processors
(a) A three-stage pipeline(b) A superscalar CPU
![Page 14: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/14.jpg)
14
Memory
• Typical memory hierarchy– numbers shown are rough approximations
![Page 15: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/15.jpg)
15
Hard Disk
Structure of a disk drive
![Page 16: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/16.jpg)
16
Base-Limit Pairs
One base-limit pair and two base-limit pairs
![Page 17: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/17.jpg)
17
Interrupt
(a) Steps in starting an I/O device and getting interrupt(b) How the CPU is interrupted
(a) (b)
![Page 18: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/18.jpg)
18
Pentium System
Structure of a large Pentium system
![Page 19: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/19.jpg)
19
Processes• Program in execution
• Address space: list of memory locations for read and write - code, data, stack
• Process table: one entry for each process,
contains: list of open files,
state
UID etc.
• Communication, scheduling
![Page 20: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/20.jpg)
20
A Process Tree
A created two child processes, B and C
B created three child processes, D, E, and F
![Page 21: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/21.jpg)
21
Deadlock
(a) A potential deadlock. (b) An actual deadlock.
Read-write example
![Page 22: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/22.jpg)
22
Main Memory
Holds executing programs
Multiple programs - protection
Large programs - virtual memory
![Page 23: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/23.jpg)
23
File System
File system for a university department
![Page 24: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/24.jpg)
24
Files• Abstract model of device independent files
• Hierarchy, directories, operations
• Absolute and relative path names - root and working directory
• Special files (for I/O devices): – block s.f.– character s.f.
• Security
![Page 25: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/25.jpg)
25
Mounting
• Before mounting, – files on floppy are inaccessible
• After mounting floppy on b,– files on floppy are part of file hierarchy
![Page 26: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/26.jpg)
26
Pipe
Two processes connected by a pipe
e.g. sort <in|head -30
![Page 27: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/27.jpg)
27
System Calls
• Interface between OS and user programs (to perform privileged operations)
• Machine dependent, but procedure libraries
![Page 28: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/28.jpg)
28
Steps in Making a System Call
There are 11 steps in making the system call read (fd, buffer, nbytes)
![Page 29: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/29.jpg)
29
Some System Calls For Process Management
![Page 30: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/30.jpg)
30
Some System Calls For File Management
![Page 31: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/31.jpg)
31
Some System Calls For Directory Management
![Page 32: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/32.jpg)
32
Some System Calls For Miscellaneous Tasks
![Page 33: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/33.jpg)
33
Shell
• A stripped down shell:
while (TRUE) { /* repeat forever */ type_prompt( ); /* display prompt */ read_command (command, parameters) /* input from terminal */ if (fork() != 0) { /* fork off child process */ /* Parent code */ waitpid( -1, &status, 0); /* wait for child to exit */} else { /* Child code */ execve (command, parameters, 0); /* execute command */ }}
![Page 34: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/34.jpg)
34
Link
Link(/usr/jim/memo,/usr/ast/note)
(a) Two directories before linking/usr/jim/memo to ast's directory
(b) The same directories after linking
![Page 35: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/35.jpg)
35
Mount
mount(/dev/fd0,/mnt,0)
(a) File system before the mount
(b) File system after the mount
![Page 36: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/36.jpg)
36
Windows System Calls
Some Win32 API calls
![Page 37: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/37.jpg)
37
Monolithic System
Simple structuring model for a monolithic system
![Page 38: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/38.jpg)
38
Layered System
Structure of the THE operating system
• MULTICS - concentric rings
![Page 39: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/39.jpg)
39
Virtual Machines
Structure of VM/370 with CMSCMS: Conversational Monitor System
VM: Virtual Machine Monitor - multiprogramming
• MS-DOS on Pentium
• JVM
![Page 40: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/40.jpg)
40
Exokernels
Similar to VM, but
• Restriction to allocated resources
• No need for remap
![Page 41: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/41.jpg)
41
Client-Server Model
Microkernel
• handles communication
• provides low-level resource management
Cf. Mechanism versus policy
![Page 42: 1 OPERATING SYSTEMS Lecturer: Szabolcs Mikulas Office: B38B E-mail: szabolcs@dcs.bbk.ac.uk URL: szabolcs/os.html Textbook: A.S](https://reader035.vdocument.in/reader035/viewer/2022062308/56649b57550346318e8d57df/html5/thumbnails/42.jpg)
42
C-S Model in a DS
The client-server model in a distributed system