Operating Systems Unit 8: – Virtual Memory management Operating Systems.
Operating Systems - Introduction · An Operating System implements a virtual machine whose...
Transcript of Operating Systems - Introduction · An Operating System implements a virtual machine whose...
![Page 1: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/1.jpg)
IntroductionCS 4410
Operating Systems
Summer 2019
Edward Tremel
[R. Agarwal, L. Alvisi, A. Bracy, M. George, E. Sirer, R. Van Renesse]
![Page 2: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/2.jpg)
Course Logistics
2
![Page 3: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/3.jpg)
• University is officially closed today• Tomorrow is also a “break” day• Summer session classes must meet
anyway (on both days)
Happy Independence Day!
3
![Page 4: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/4.jpg)
• PhD student in Computer Science• About to graduate• Previously: Brown class of 2013• Research: distributed systems,
datacenter networking, data privacy• Advised by Prof. Ken Birman
Who am I?
4
![Page 5: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/5.jpg)
• Every day, 11:30-12:45, in Gates G01
• Policies:• Sit near the front – this classroom is too big• No cell phones or laptops out during class• Studies show that classrooms without laptops
are far more effective
• Please ask questions!• Small class, time for everyone to participate
Class Setup
5
![Page 6: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/6.jpg)
Website: http://www.cs.cornell.edu/courses/cs4410/• Contains schedule, syllabus, links• Lecture slides will be posted here
CMS: https://cmsx.cs.cornell.edu• Assignments and due dates• Submission and grades
Piazza: https://piazza.com/cornell/summer2019/cs4410• Announcements by the instructor• Ask and answer questions
Important Information
6
![Page 7: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/7.jpg)
Office Hours• MWF 1-2 pm, T/Th 2-3 pm• Gates 445
Piazza• For help with assignments, concepts• Private posts for communicating with just the
instructor
Please no emails to personal email accounts
Getting Help
7
![Page 8: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/8.jpg)
Homework (5)• Due each Monday before class (except Jul 8)• Mix of written and programming problems
Quizzes (5)• In-class quizzes, one each Wednesday
Grade Weights• Homework: 45%• Quizzes: 25%• Final: 25%• Class Participation: 5%
Assignments and Grades
8
![Page 9: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/9.jpg)
Closed-book exams, no calculators/phones
All submitted work must be your own• OK to discuss concepts together• Don’t share or copy solutions• Don’t look up solutions to similar problems• Don’t copy course materials
Academic Integrity
9
![Page 10: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/10.jpg)
Introduction to Operating Systems
![Page 11: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/11.jpg)
• Software that manages a computer’s resources
• Makes it easier to write the applications you want to write
• Makes you want to use the applications you wrote by running them efficiently
Meet the OS
11
![Page 12: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/12.jpg)
An Operating System implements a virtual machine whose interface is more convenient*than the raw hardware interface
* easier to use, simpler to code, more reliable, more secure...
“All the code you did not write”
What is an OS?
12
Operating System
Application Application Application Application Application
Hardware
OS Interface
Physical Machine Interface
![Page 13: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/13.jpg)
Referee • Manages shared resources: CPU, memory,
disks, networks, displays, cameras, etc.
Illusionist• Look! Infinite memory! Your own private
processor!
Glue• Offers set of common services (e.g., UI routines)
• Separates apps from I/O devices
OS Wears Many Hats
13
![Page 14: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/14.jpg)
OS as Referee
14
Resource allocation• Multiple concurrent tasks, how does OS
decide who gets how much?Isolation• A faulty app should not disrupt other apps
or OS• OS must export less than full power of
underlying hardwareCommunication/Coordination• Apps need to coordinate and share state
![Page 15: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/15.jpg)
OS as Illusionist (1)
15
Illusion of resources not physically presentVirtualization: • processor, memory, screen space, disk, network• the entire computer:• fooling the illusionist itself!• ease of debugging, portability, isolation
Operating System (VMM)
App
Hardware
Virtual MachineInterface
App Guest OS Guest OS
App App
Operating System
Application Application Application Application Application
Hardware
OS Interface
Physical Machine Interface
![Page 16: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/16.jpg)
Illusion of resources not physically present• Atomic operations• HW guarantees atomicity at word level
- what happens during concurrent updates to complex data structures?
- what if computer crashes during a block write?
• At the hardware level, packets are lost…
• Reliable communication channels
OS as Illusionist (2)
16
![Page 17: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/17.jpg)
OS as Glue
17
Offers standard services to simplify app design and facilitate sharing• send/receive of byte streams• read/write files • pass messages• share memory• UI
Decouples HW and app development
![Page 18: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/18.jpg)
A Short History of
Operating Systems
18
![Page 19: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/19.jpg)
History of Operating Systems
Phase 1: Hardware expensive, humans cheap
User at console: single-user systems
Batching systems
Multi-programming systems
19
![Page 20: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/20.jpg)
Hand programmed
machines (1945-1955)
Single user systems
OS =
loader + libraries
Problem:
low utilization of
expensive components
20
![Page 21: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/21.jpg)
Batch Processing
(1955-1965)
OS = loader +
sequencer +
output processor
Tape
Input
PrinterOperating System
“System Software”
User Program
User Data
Output
Compute
Tape
Card Reader
21
![Page 22: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/22.jpg)
Multiprogramming
(1965-1980)
Keep several jobs in memory
Multiplex CPU between jobs.
Operating System
“System Software”
User Program 1
User Program 2
User Program n
system call Read(var)begin
StartIO(input device)WaitIO(interrupt)EndIO(input device)...
end Read
program Pbegin
...Read(var)...
end P
22
![Page 23: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/23.jpg)
Multiprogramming
(1965-1980)
Keep several jobs in memory
Multiplex CPU between jobs.
Operating System
“System Software”
User Program 1
User Program 2
User Program n
Process 1 I/O Device
k: read()
k+1:
endio()interrupt
main{
}
OS
read{
startIO()
waitIO()
23
![Page 24: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/24.jpg)
Multiprogramming
(1965-1980)
Keep several jobs in memory
Multiplex CPU between jobs.
Operating System
“System Software”
User Program 1
User Program 2
User Program n
Process 1 I/O Device
k: read()
k+1:
endio{interrupt
main{
}
OS
read{
startIO()
schedule()
Process 2
main{}
schedule()
24
![Page 25: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/25.jpg)
History of Operating Systems
Phase 1: Hardware expensive, humans cheap
User at console: single-user systems
Batching systems
Multi-programming systems
Phase 2: Hardware cheap, humans expensive
Timesharing: Users use cheap terminals and
share CPU
25
![Page 26: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/26.jpg)
Timesharing
(1970-)
Timer interrupt used to multiplex CPU between jobs
Operating System
“System Software”
User Program 1
User Program 2
User Program n
Process 1
k:
k+1:
main{
OS
schedule(){
Process 2
main{}
timerinterrupt
timerinterrupt
schedule(){
}
schedule(){
}
timerinterrupt
26
![Page 27: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/27.jpg)
History of Operating Systems
Phase 1: Hardware expensive, humans cheap
User at console: single-user systems
Batching systems
Multi-programming systems
Phase 2: Hardware cheap, humans expensive
Timesharing: Users use cheap terminals and
share CPU
Phase 3: H/W very cheap, humans very expensive
Personal computing: One system per user
Distributed computing: many systems per user
Ubiquitous computing: LOTS of systems per user27
![Page 28: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/28.jpg)
Operating Systems for
PCs
Personal computing systems
Single user
Utilization no longer a concern
Emphasis on user interface and API
Evolution
Initially: OS as a simple service provider (libraries)
Now: Multi-application with support for coordination
28
![Page 29: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/29.jpg)
THE END
29
![Page 30: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/30.jpg)
To Learn:• How to manage complexity through
appropriate abstractions- infinite CPU, infinite memory, files, locks, etc.
• About design• performance vs. robustness, functionality
vs. simplicity, HW vs. SW, etc.
• How computers work
Because OSs are everywhere!
Why Study Operating Systems?
30
![Page 31: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/31.jpg)
31
Where’s the OS? Las Vegas
![Page 32: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/32.jpg)
32
Where’s the OS? New York
![Page 33: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/33.jpg)
33
![Page 34: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/34.jpg)
34
![Page 35: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/35.jpg)
35
![Page 36: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/36.jpg)
• The world is increasingly dependent on computer systems- Connected, networked, interlinked
• There is huge demand for people who deeply understand and can build robust systems (most people don’t and can’t)
• OS is a great example of a complex system that must be robust
System Building is Hard
36
![Page 37: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/37.jpg)
• Structure: how is the OS organized?
• Concurrency: how are parallel activities
created and controlled?
• Sharing: how are resources shared?
• Naming: how are resources named by users?
• Protection: how are distrusting parties
protected from each other?
• Security: how to authenticate, authorize, and
ensure privacy?
• Performance: how to make it fast?
Issues in OS Design
37
![Page 38: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/38.jpg)
• Reliability: how do we deal with failures??
• Portability: how to write once, run anywhere?
• Extensibility: how do we add new features?
• Communication: how do we exchange
information?
• Scale: what happens as demands increase?
• Persistence: how do we make information
outlast the processes that created it?
• Accounting: who pays the bill and how do we
control resource usage?
More Issues in OS Design
38
![Page 39: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/39.jpg)
Ostensibly, operating systems• architecting complex software• identifying needs and priorities• separating concerns• implementing artifacts with desired properties
In reality, software design principles• OSes happen to illustrate organizational
principles and design patterns
What’s this course about?
39
![Page 40: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/40.jpg)
• Devices and Architecture• Processes and Threads• Scheduling and Synchronization• Writing correct multithreaded programs
• Memory management• Filesystems and storage• Networking• Security
Topics (OS components)
40
![Page 41: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/41.jpg)
Activity: Keyboard Design
41
![Page 42: Operating Systems - Introduction · An Operating System implements a virtual machine whose interface is more convenient* ... Ubiquitous computing: LOTS of systems per user 27. Operating](https://reader034.fdocuments.net/reader034/viewer/2022050310/5f71f562911cd215926a800c/html5/thumbnails/42.jpg)
• Logic gates
• Switches for keys
• Tri-state buffers
• Encoders, multiplexers, latches…
Simple “Soviet-Era” keyboard• Only 1 key pressed at a time• CPU just needs to know which key
Keyboard Components
42
?