Uploaded by minatosnow

Operating Systems Introduction

advertisement
02.05.2019
Lecture
Operating Systems
SS 2019
Prof. Dr. Werner Filip
filip@fb2.fra-uas.de
1
General Topics
Content
1.
Introduction
2
2.
P
Processes
and
d Process
P
M
Management
t
3.
Memory Management
4.
File Systems
5.
Input/Output
6.
Multiple Processor Systems
Operating Systems
Prof. Dr. Werner Filip
2
1
02.05.2019
Reference
• A. S. Tanenbaum, H. Bos
General Topics
G
Modern Operating Systems,
Systems 4th Ed.,
Ed Pearson,
Pearson 2015
• A. S. Tanenbaum
Moderne Betriebssysteme, Pearson Studium, 2016
• A. Silberschatz, P. Galvin, G. Gagne
Operating Systems Concept,
Concept 9th Ed.,
Ed J.
J Wiley & Sons,
Sons 2013
Operating Systems
Prof. Dr. Werner Filip
3
Introduction
Chapter 1
Introduction
Operating Systems
Prof. Dr. Werner Filip
4
2
02.05.2019
Outline
Introduction
• What is an Operating System
• The history of Operating Systems
• Hardware of Operating System
• Important
I
t t concepts
t off Operating
O
ti Systems
S t
Operating Systems
Prof. Dr. Werner Filip
5
What is an Operating System
Introduction
A modern computer consists of:
•
•
•
•
•
•
One or more processors
O
Main memory
Disks
Printers
Various input/output devices
...
Managing all these components requires a layer of
software – the operating system
Operating Systems
Prof. Dr. Werner Filip
6
3
02.05.2019
What is an Operating System
Introduction
• A modern computer is very complex.
–
–
–
–
Networking
Disks
Video/audio card
….
• It is impossible for every application
programmer to understand every detail
• A layer of computer software is introduced to
provide a better, simpler, cleaner model of the
resources and manage them
Operating Systems
Prof. Dr. Werner Filip
7
What is an Operating System
• On top of hardware is OS
Introduction
• Most computers have two modes of operation:
– Kernel mode and user mode
– OS runs in kernel mode, which has complete access to
all hardware and can execute any instruction
– Rest of software runs in user mode, which has limited
capability
– Shell or GUI is the lowest level of user mode software
Operating Systems
Prof. Dr. Werner Filip
8
4
02.05.2019
Introduction
What is an Operating System
Where the operating system fits in.
Operating Systems
Prof. Dr. Werner Filip
9
What is an Operating System
Introduction
• Two functions:
– From top to down: provide application programmers a
clean abstract set of resources instead of hardware ones
– From down to top: Manage hardware resources
Operating Systems
Prof. Dr. Werner Filip
10
5
02.05.2019
What is an Operating System
Introduction
o Users use various OS
• Windows, Linux, Mac OS etc.
o User interacts with shell or GUI
• they use OS to get their work done
Operating Systems
Prof. Dr. Werner Filip
11
Introduction
Operating System as a Resource Manager
•
Allow multiple programs to run at the same time
•
Manage and protect memory
memory, I/O devices,
devices and
other resources
•
Includes multiplexing (sharing) resources in two
different ways:
• In time
• In space
Operating Systems
Prof. Dr. Werner Filip
12
6
02.05.2019
Operating System as a Resource Manager
Introduction
• Modern OS runs multiple programs of multiple
users at the same time
– Imagine what would happen if several programs want to
print at the same time?
– How to account the resource usage of each process?
– Resources can be multiplexed:
• How to ensure fairness and efficiency?
y
Operating Systems
Prof. Dr. Werner Filip
13
Operating System
• Operating system is a software
Introduction
– Is
I a complex
l software
ft
– Runs in kernel mode
– Manages hardware
– Provide a friendly interface for application programmer
Operating Systems
Prof. Dr. Werner Filip
14
7
02.05.2019
History of Operating Systems
• First generation 1945 - 1955
Introduction
– vacuum tubes,
tubes plug boards
• Second generation 1955 - 1965
– transistors, batch systems
• Third
hi d generation
i
1965 - 1980
– ICs (Integrated Circuits) and multiprogramming
Operating Systems
Prof. Dr. Werner Filip
15
History of Operating Systems
• Fourth g
generation 1980 - 1990
Introduction
– personal computers
• Fifth generation 1990 - present
– mobile computers
Operating Systems
Prof. Dr. Werner Filip
16
8
02.05.2019
Introduction
1st: vacuum tubes
• Large and slow
• Engineers design, build, operate and maintain the
computer
• All programming is done with machine language,
or by wiring circuits using cables
• Insert plugboards into the computer and operate
y numerical calculations
• The work is mainly
Operating Systems
Prof. Dr. Werner Filip
17
Introduction
1st: vacuum tubes
Operating Systems
Prof. Dr. Werner Filip
18
9
02.05.2019
Introduction
2nd: transistors and batch systems
• Also called mainframes
• Computers are managed by professional operators
• Programmers use punch card to run programs;
operators operate (load compiler, etc.) and
collect output to the user
• Complains soon come:
– Human Operation between computer operation
– Lead to batch system
– Collect a batch of jobs in the input room, then read them
into a magnetic tape; the same for output
Operating Systems
Prof. Dr. Werner Filip
19
Introduction
2nd: transistors and batch systems
Early batch system
–
–
–
–
Operating Systems
bring cards to 1401
read cards to tape
put tape on 7094 which does computing
put tape on 1401 which prints output
Prof. Dr. Werner Filip
20
10
02.05.2019
Introduction
2nd: transistors and batch systems
• Structure of a typical FMS job – 2nd generation
FMS – Fortran Memory System
Operating Systems
Prof. Dr. Werner Filip
21
Introduction
2nd: transistors and batch systems
Operating Systems
Prof. Dr. Werner Filip
22
11
02.05.2019
Introduction
2nd: transistors and batch systems
Operating Systems
Prof. Dr. Werner Filip
23
3rd: IC and Multiprogramming
• OS/360: “a dinosaur”
Introduction
– Aims to adapts 1401/7409, covers all trades of life
– However, OS/360 introduces several key techniques
• Multi-programming: solve the problem of CPU idling
• Spooling: simultaneous peripheral operation on line
– Whenever a job finishes, OS load a new job from
disk to the empty-partition
pyp
Operating Systems
Prof. Dr. Werner Filip
24
12
02.05.2019
Introduction
3rd: IC and Multiprogramming
• Multiprogramming system
– three jobs in memory
Operating Systems
Prof. Dr. Werner Filip
25
Introduction
3rd: IC and Multiprogramming
Operating Systems
Prof. Dr. Werner Filip
26
13
02.05.2019
3rd: IC and Multiprogramming
Introduction
• Problems:
– 3rd generation OS was well suited for big scientific
calculations and massive data processing
– But many programmers complain a lot … for not be
able to debug quickly…
– And the solution to this problem would be ... ?
– Timesharing:
• a variant of multiprogramming
• sharing of a computing resource among many users by
means of multiprogramming
Operating Systems
Prof. Dr. Werner Filip
27
3rd: IC and Multiprogramming
Introduction
• A system to be remembered: MULTICS
– A machine that would support hundreds of
simultaneous timesharing users (like a web server
nowadays)
– Introduces many brilliant ideas but enjoys no
commercial success
– Its step-child is the well-known and time-honored
UNIX
– System V/ FreeBSD, MINIX, Linux
Berkeley Software Distribution (BSD)
Operating Systems
Prof. Dr. Werner Filip
28
14
02.05.2019
4th: Personal Computers
• Computers have performance similar to 3rd
generation, but prices drastically different
Introduction
• CP/M (Control Program for Microcomputers)
– First disk-based OS
• 1980, IBM PC, Basic Interpreter, DOS, MS-DOS
• GUI--Lisa—Apple: user friendly
• MS-DOS
MS DOS with GUI
GUI– Win95/98/ – WinNT/XP…
WinNT/XP
Operating Systems
Prof. Dr. Werner Filip
29
Introduction
4th: Personal Computers
Operating Systems
Prof. Dr. Werner Filip
30
15
02.05.2019
5th: Mobile Computers
Introduction
Mobile devices - designed for many applications.
• Mobile Internet devices
• Tablet computers
• Wearable computers
• Calculator watches
• Smartwatch
• Head-mounted displays
• Personal digital assistants
• Enterprise digital assistants
• Calculators
• Handheld game consoles
• Portable media players
• Digital media player
• Digital still cameras
• Digital video cameras
• Digital camcorders
• Mobile phones
• Smartphone
• Pagers
• Personal navigation devices
•…
Operating Systems
Prof. Dr. Werner Filip
31
Introduction
5th: Mobile Computers
Operating Systems
Prof. Dr. Werner Filip
32
16
02.05.2019
Introduction
5th: Mobile Computers
Operating Systems
Prof. Dr. Werner Filip
33
Introduction
5th: Mobile Computers
libguides.riphah.edu.pk
Operating Systems
Prof. Dr. Werner Filip
34
17
02.05.2019
Computer Hardware Review
Introduction
Monitor
Bus
• Components of a simple personal computer
Operating Systems
Prof. Dr. Werner Filip
35
Computer Hardware Review
Introduction
Monitor
Bus
Operating Systems
Prof. Dr. Werner Filip
36
18
02.05.2019
Hardware: processor
• Brain of computer
– Fetches instruction from memory and execute
Introduction
– Cycle
C l off CPU (Central Processing Unit):
• fetch, decode, execute
– CPU has registers to store variable and temporary
result: load from memory to register; store from
register to memory
– Program
g
counter: next instruction to fetch
– Stack pointer: the top of the current stack
– ...
Operating Systems
Prof. Dr. Werner Filip
37
Introduction
Computer Hardware Review
• Typical memory hierarchy
Operating Systems
Prof. Dr. Werner Filip
38
19
02.05.2019
Introduction
Computer Hardware Review
• Typical memory hierarchy
Operating Systems
Prof. Dr. Werner Filip
39
Memory
Introduction
Questions when dealing with cache:
•
When to pput a new item into the cache?
•
Which cache line to put the new item in?
•
Which item to remove from the cache when a slot is
needed?
•
Where to put a newly evicted item in the larger
memory??
Operating Systems
Prof. Dr. Werner Filip
40
20
02.05.2019
Introduction
Disks
Structure of a disk drive
Operating Systems
Prof. Dr. Werner Filip
41
Introduction
Disks
•
•
•
•
•
•
•
Cheap and large: two orders better than RAM
Slow: three orders worse than RAM
M h i l movementt to
Mechanical
t fetch
f t h data
d t
One or more platter
Information is stored on concentric circles
Arm, track, cylinder, sector
Disk helps to implement Virtual Memory
– When not enough memory is available, disks are used
as the storage, and memory as cache
RAM - Random Access Memory
Operating Systems
Prof. Dr. Werner Filip
42
21
02.05.2019
Introduction
I/O Devices
(a)
((b))
(a) Steps in starting an I/O device and getting interrupt
(b) How the CPU is interrupted
Operating Systems
Prof. Dr. Werner Filip
43
I/O Devices
• Two parts: a controller and a device
Introduction
• Controller: to provide a simpler interface to OS
• Device driver: talks to controller, give
commands and accepts response
• Busy waiting/interrupt/DMA (direct memory access)
Operating Systems
Prof. Dr. Werner Filip
44
22
02.05.2019
Booting the Computer
• BIOS — basic input/output system
Introduction
– On the motherboard (now parentboard), low-level I/O
software
ft
– Checks RAM, keyboard and other basic devices
– Determine the boot device: floppy, CD-ROM, disk
– First sector of the boot-device is read into memory
– The sector contains program to check which partition
is active
– Then a secondary boot-loader is read into memory
and reads in operating system from the active partition
Operating Systems
Prof. Dr. Werner Filip
45
Introduction
Computer Hardware Review
Structure of a large Pentium system
ISA - Industry Standard Bus
USB - Universal Serial Bus
Operating Systems
PCI - Peripheral Component Interconnect
SCSI – Small Computer System Interface
Prof. Dr. Werner Filip
46
23
02.05.2019
The Operating System Zoo
• Mainframe operating systems
Introduction
• Server operating systems
• Multiprocessor operating systems
• Personal computer operating systems
• Real-time operating systems
• Embedded operating systems
• Smart card operating systems
Operating Systems
Prof. Dr. Werner Filip
47
Introduction
Operating System Concepts
• A process tree
– A created two child processes, B and C
– B created three child processes, D, E, and F
Operating Systems
Prof. Dr. Werner Filip
48
24
02.05.2019
Introduction
Operating System Concepts
intersection
(a) a potential deadlock.
(b) an actual deadlock.
Operating Systems
Prof. Dr. Werner Filip
49
Introduction
Operating System Concepts
File system for a university department
SOSP - Symposium on Operating Systems Principles
Operating Systems
Prof. Dr. Werner Filip
50
25
02.05.2019
System Calls
Introduction
• System calls - interface for users to contact OS
and hardware
• System calls vary from system to system, but
the underlying concepts are similar
Operating Systems
Prof. Dr. Werner Filip
51
Introduction
Steps in Making a System Call
SP - Stack Pointer
There are 11 steps in making the system call
read (fd, buffer, nbytes)
Operating Systems
Prof. Dr. Werner Filip
52
26
02.05.2019
Introduction
Some System Calls For Process Management
Operating Systems
Prof. Dr. Werner Filip
53
Introduction
Some System Calls For File Management
Operating Systems
Prof. Dr. Werner Filip
54
27
02.05.2019
Introduction
Some System Calls For Directory Management
Operating Systems
Prof. Dr. Werner Filip
55
Introduction
Some System Calls For Miscellaneous Tasks
Operating Systems
Prof. Dr. Werner Filip
56
28
02.05.2019
Introduction
System Calls
(a) File system before the mount
(b) File system after the mount
Operating Systems
Prof. Dr. Werner Filip
57
Introduction
System Calls
Some UNIX and Win32 API calls
Operating Systems
Prof. Dr. Werner Filip
58
29
02.05.2019
Operating System Structure
Monolithic systems – basic structure:
Introduction
•
•
•
A main program that invokes the requested service
procedure.
procedure
A set of service procedures that carry out the system
calls.
A set of utility procedures that help the service
procedures.
Operating Systems
Prof. Dr. Werner Filip
59
Introduction
Operating System Structure
Structure of the THE operating system
Technical High School Eindhoven, E.W.Dijkstra 1968
Operating Systems
Prof. Dr. Werner Filip
60
30
02.05.2019
Introduction
Operating System Structure
Structure of VM/370 with CMS
VM/CMS (Virtual Machine / Conversational Monitor System) – IBM
Operating Systems
Prof. Dr. Werner Filip
61
Introduction
Operating System Structure
a type 1 hypervisor.
a type 2 hypervisor.
hypervisor or virtual machine monitor (VMM) is a piece of
computer software, firmware or hardware that creates and runs
virtual machines
Operating Systems
Prof. Dr. Werner Filip
62
31
02.05.2019
Introduction
Operating System Structure
The client-server model
Operating Systems
Prof. Dr. Werner Filip
63
Introduction
Operating System Structure
The client-server model in a distributed system
Operating Systems
Prof. Dr. Werner Filip
64
32
Download