Networks and Operating Systems Introduction To Operating Systems
Networks and Operating Systems Introduction To Operating Systems
ch
@spcl_eth
spcl.inf.ethz.ch
@spcl_eth
Administrivia
Two parts:
Networks Adrian Perrig
Operating Systems Torsten Hoefler
Lecture:
Thu 8-10am, CAB G61
Fri 10am-noon, CAB G61
spcl.inf.ethz.ch
@spcl_eth
More Administrivia
Course webpage (the authoritative information source)
http://spcl.inf.ethz.ch/Teaching/2014-osnet/
All slides will be there before the lecture (so you can take notes)
Exercises are:
Theoretical: Analysis of performance properties
Practical: Trying out stuff + Programming exercises
spcl.inf.ethz.ch
@spcl_eth
Exam
(No mid-term.)
Final exam: tbd (Session)
Material:
Covered in the lectures, and/or
Learned during the lab exercises
spcl.inf.ethz.ch
@spcl_eth
Course Outline
20.02.: OS Introduction
21.02.: Processes
27.02.: Scheduling
28.02.: Synchronization
13.03.: Memory Management
14.03.: Demand Paging
22.05.: Applications
23.05.: Security
30.05.: New Internet Architectures
5
spcl.inf.ethz.ch
@spcl_eth
Birds-eye perspective
Networks
bridge space
Databases
bridge time
spcl.inf.ethz.ch
@spcl_eth
Introduction: Why?
Roles of the OS
Referee
Illusionist
Glue
Structure of an OS
spcl.inf.ethz.ch
@spcl_eth
Goals
spcl.inf.ethz.ch
@spcl_eth
The Book
On the web:
http://ospp.cs.washington.edu/
spcl.inf.ethz.ch
@spcl_eth
10
spcl.inf.ethz.ch
@spcl_eth
spcl.inf.ethz.ch
@spcl_eth
Introduction to
Operating Systems
12
spcl.inf.ethz.ch
@spcl_eth
13
spcl.inf.ethz.ch
@spcl_eth
14
spcl.inf.ethz.ch
@spcl_eth
15
spcl.inf.ethz.ch
@spcl_eth
Systems calls
Concurrency and asynchrony
Processes and threads
Security, authorization, protection
Memory, virtual memory, and paging
Files and file systems, data management
I/O: Devices, Interrupts, DMA
Network interfaces and protocol stacks
16
spcl.inf.ethz.ch
@spcl_eth
17
Goals:
what makes a good OS?
spcl.inf.ethz.ch
@spcl_eth
18
Goals:
what makes a good OS?
spcl.inf.ethz.ch
@spcl_eth
19
Goals:
what makes a good OS?
spcl.inf.ethz.ch
@spcl_eth
20
Goals:
what makes a good OS?
spcl.inf.ethz.ch
@spcl_eth
21
Goals:
what makes a good OS?
spcl.inf.ethz.ch
@spcl_eth
22
Goals:
what makes a good OS?
spcl.inf.ethz.ch
@spcl_eth
23
spcl.inf.ethz.ch
@spcl_eth
Operating Systems
Applications
Operating
System
Hardware
24
spcl.inf.ethz.ch
@spcl_eth
Operating Systems
Applications
Operating
System
Operating Systems
(rest of this course!)
Hardware
25
spcl.inf.ethz.ch
@spcl_eth
Operating Systems
Applications
Operating
System
Parallel Programming
Operating Systems
(rest of this course!)
Hardware
26
spcl.inf.ethz.ch
@spcl_eth
Operating Systems
Applications
Operating
System
Hardware
Parallel Programming
Operating Systems
(rest of this course!)
Computer Architecture and
Systems Programming
27
spcl.inf.ethz.ch
@spcl_eth
28
spcl.inf.ethz.ch
@spcl_eth
OS roles
Referee
Illusionist
Glue
29
spcl.inf.ethz.ch
@spcl_eth
The Referee:
Resource Manager
Application
Application
Application
System calls
Operating
System
Hardware
30
spcl.inf.ethz.ch
@spcl_eth
The OS as Referee
Sharing:
Multiplex hardware among applications
CPU, memory, devices
Applications shouldnt need to be aware of each other
Protection:
Ensure one application cant r/w anothers data
In memory, on disk, over network
Ensure one application cant use anothers resources
CPU, storage space, bandwidth,
Communication:
Protected applications must still communicate
31
spcl.inf.ethz.ch
@spcl_eth
The OS as Referee
Sharing:
Multiplex hardware among applications
CPU, memory, devices
Applications shouldnt need to be aware of each other
Protection:
Ensure one application cant r/w anothers data
In memory, on disk, over network
Ensure one application cant use anothers resources
CPU, storage space, bandwidth,
Communication:
Protected applications must still communicate
32
spcl.inf.ethz.ch
@spcl_eth
The OS as Referee
Sharing:
Multiplex hardware among applications
CPU, memory, devices
Applications shouldnt need to be aware of each other
Protection:
Ensure one application cant r/w anothers data
In memory, on disk, over network
Ensure one application cant use anothers resources
CPU, storage space, bandwidth,
Communication:
Protected applications must still communicate
33
spcl.inf.ethz.ch
@spcl_eth
Efficiency:
Best use of complete machine resources
Minimize e.g. power consumption
Predictability:
Guarantee real-time performance
34
spcl.inf.ethz.ch
@spcl_eth
Efficiency:
Best use of complete machine resources
Minimize e.g. power consumption
All in mutual
Guarantee real-time performance
contradiction
Predictability:
35
spcl.inf.ethz.ch
@spcl_eth
Example: Threads
Threads are virtual CPUs
Physical resource: CPUs
Virtual resource: Threads
Mechanism: pre-emption, timeslicing, context switching, scheduling
36
spcl.inf.ethz.ch
@spcl_eth
The Illusionist
Virtualization:
OS creates illusion of a real resource
Processor, storage, network, links,
37
spcl.inf.ethz.ch
@spcl_eth
How?
1.
Multiplexing
2.
Emulation
3.
Aggregation
38
spcl.inf.ethz.ch
@spcl_eth
Why?
1.
Sharing
2.
Sandboxing
3.
Decoupling
4.
Abstraction
39
spcl.inf.ethz.ch
@spcl_eth
40
spcl.inf.ethz.ch
@spcl_eth
41
spcl.inf.ethz.ch
@spcl_eth
Many uses:
42
spcl.inf.ethz.ch
@spcl_eth
43
Example: Windows
spcl.inf.ethz.ch
@spcl_eth
44
spcl.inf.ethz.ch
@spcl_eth
Virtual
circuits
Real circuits
VCI=346
VCI=1044
VCI=1044
VCI=56
45
spcl.inf.ethz.ch
@spcl_eth
Example: VLANs
Methods: multiplexing
Mechanisms: port assignment, tags
C D
I
J
K
M
S1
S2
S1
S2
N
N
G H
46
spcl.inf.ethz.ch
@spcl_eth
Glue: the OS as
Abstract Machine
Applications
Virtual machine interface
Operating
System
Physical machine
interface
Hardware
47
spcl.inf.ethz.ch
@spcl_eth
The OS as Glue
Provides high-level abstractions
Easier to program to
Shared functionality for all applications
Ties together disparate functions and services
48
spcl.inf.ethz.ch
@spcl_eth
Services provided by an OS
Program execution
Load program, execute on 1 or more processors
49
spcl.inf.ethz.ch
@spcl_eth
50
spcl.inf.ethz.ch
@spcl_eth
General OS structure
Application
Application
Server process
(daemon)
System Library
System Library
System Library
System calls
User mode
Privileged mode
Kernel
CPU
CPU
Device
Device
51
spcl.inf.ethz.ch
@spcl_eth
52
spcl.inf.ethz.ch
@spcl_eth
General OS structure
Application
Application
Server process
(daemon)
System Library
System Library
System Library
System calls
User mode
Privileged mode
Kernel
CPU
CPU
Device
Device
53
spcl.inf.ethz.ch
@spcl_eth
Kernel
That part of the OS which runs in privileged mode
Large part of Unix and Windows (except libraries)
Small part of L4, Barrelfish, etc. (microkernels)
Does not exist in some embedded systems
54
spcl.inf.ethz.ch
@spcl_eth
55
spcl.inf.ethz.ch
@spcl_eth
General OS structure
Application
Application
Server process
(daemon)
System Library
System Library
System Library
System calls
User mode
Privileged mode
Kernel
CPU
CPU
Device
Device
56
spcl.inf.ethz.ch
@spcl_eth
System Libraries
Convenience functions
strcmp(), etc.
Common functionality
57
spcl.inf.ethz.ch
@spcl_eth
General OS structure
Application
Application
Server process
(daemon)
System Library
System Library
System Library
System calls
User mode
Privileged mode
Kernel
CPU
CPU
Device
Device
58
spcl.inf.ethz.ch
@spcl_eth
Daemons
Processes which are part of the OS
Microkernels: most of the OS
Linux: increasingly large quantity
Advantages:
Modularity, fault tolerance
Easier to schedule
59
spcl.inf.ethz.ch
@spcl_eth
60
spcl.inf.ethz.ch
@spcl_eth
Startup
Exception: caused by user program
Interrupt: caused by something else
System calls
61
spcl.inf.ethz.ch
@spcl_eth
User mode
Privileged mode
System calls
62
spcl.inf.ethz.ch
@spcl_eth
User process
runs
User mode
Privileged mode
System calls
63
spcl.inf.ethz.ch
@spcl_eth
User process
runs
Execute
syscall
User mode
Privileged mode
System calls
64
spcl.inf.ethz.ch
@spcl_eth
User process
runs
Execute
syscall
User mode
Privileged mode
System calls
65
spcl.inf.ethz.ch
@spcl_eth
User process
runs
Execute
syscall
User mode
Privileged mode
Execute kernel
code
System calls
66
spcl.inf.ethz.ch
@spcl_eth
User process
runs
Execute
syscall
Process resumes
User mode
Privileged mode
Execute kernel
code
System calls
67
spcl.inf.ethz.ch
@spcl_eth
68
spcl.inf.ethz.ch
@spcl_eth
User-level upcall
Much like an interrupt, but to user-level
69