Introduction - Department of Computer Science and Information

Download Report

Transcript Introduction - Department of Computer Science and Information

OPERATING SYSTEMS
Lecturer: Szabolcs Mikulas
Office: B38B
E-mail: [email protected]
URL: 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
1
OUTLINE
1. Introduction
2. Processes and threads
3. Deadlock
4. Memory management
5. Input/output
6. File systems
7. Multimedia operating systems
8. Multiple processor systems
9. Security
UNIX and Windows are to be used as running case
studies.
2
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
3
Introduction
• A computer system consists of
– hardware
– system programs
– application programs
4
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
5
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
6
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
7
Second Generation (2)
• Structure of a typical FMS job – 2nd generation
8
Third Generation
Third generation:
• Multiprogramming
• Timesharing
• MULTICS => UNIX
9
Fourth Generation
Fourth generation (1980- ) - Personal computers
•
•
•
•
MS-DOS,
Graphical User Interface (GUI),
Windows,
Network and distributed OSs
10
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
11
Computer Hardware Review
Monitor
Bus
• Components of a simple personal computer
12
Processors
(a) A three-stage pipeline
(b) A superscalar CPU
13
Memory
• Typical memory hierarchy
– numbers shown are rough approximations
14
Hard Disk
Structure of a disk drive
15
Base-Limit Pairs
One base-limit pair and two base-limit pairs
16
Interrupt
(a)
(b)
(a) Steps in starting an I/O device and getting interrupt
(b) How the CPU is interrupted
17
Pentium System
Structure of a large Pentium system
18
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
19
A Process Tree
A created two child processes, B and C
B created three child processes, D, E, and F
20
Deadlock
(a) A potential deadlock. (b) An actual deadlock.
Read-write example
21
Main Memory
Holds executing programs
Multiple programs - protection
Large programs - virtual memory
22
File System
File system for a university department
23
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
24
Mounting
• Before mounting,
– files on floppy are inaccessible
• After mounting floppy on b,
– files on floppy are part of file hierarchy
25
Pipe
Two processes connected by a pipe
e.g. sort <in|head -30
26
System Calls
• Interface between OS and user programs (to
perform privileged operations)
• Machine dependent, but procedure libraries
27
Steps in Making a System Call
There are 11 steps in making the system call
read (fd, buffer, nbytes)
28
Some System Calls For Process Management
29
Some System Calls For File Management
30
Some System Calls For Directory Management
31
Some System Calls For Miscellaneous Tasks
32
Shell
• A stripped down shell:
while (TRUE) {
type_prompt( );
read_command (command, parameters)
/* repeat forever */
/* display prompt */
/* input from terminal */
if (fork() != 0) {
/* Parent code */
waitpid( -1, &status, 0);
} else {
/* Child code */
execve (command, parameters, 0);
}
}
/* fork off child process */
/* wait for child to exit */
/* execute command */
33
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
34
Mount
mount(/dev/fd0,/mnt,0)
(a) File system before the mount
(b) File system after the mount
35
Windows System Calls
Some Win32 API calls
36
Monolithic System
Simple structuring model for a monolithic system
37
Layered System
Structure of the THE operating system
• MULTICS - concentric rings
38
Virtual Machines
Structure of VM/370 with CMS
CMS: Conversational Monitor System
VM: Virtual Machine Monitor - multiprogramming
• MS-DOS on Pentium
• JVM
39
Exokernels
Similar to VM, but
• Restriction to allocated resources
• No need for remap
40
Client-Server Model
Microkernel
• handles communication
• provides low-level resource management
Cf. Mechanism versus policy
41
C-S Model in a DS
The client-server model in a distributed system
42