






























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
L24: Operating Systems Overview. Quick Virtual Memory Review. ❖ What do Page Tables map? ❖ Where are Page Tables located?
Typology: Lecture notes
1 / 38
This page cannot be seen from the preview
Don't miss anything!































CSE369, Autumn 2016
L01: Intro, Combinational Logic
CSE410, Winter 2017
L24: Operating Systems Overview
Teaching Assistants:
Justin Hsia
Kathryn Chan, Kevin Bi, Ryan Wong, Waylon Huang, Xinyu Sui
Slides adapted from CSE451 materialby Gribble, Lazowska, Levy, and Zahorjan
CSE369, Autumn 2016
L01: Intro, Combinational Logic
CSE410, Winter 2017
L24: Operating Systems Overview
What do Page Tables map?
Where are Page Tables located?
How many Page Tables are there?
Can your program tell if a page fault has occurred?
True / False: Virtual Addresses that are contiguous will alwaysbe contiguous in physical memory
TLB stands for _______________________ and stores_______________
CSE369, Autumn 2016
L01: Intro, Combinational Logic
CSE410, Winter 2017
L24: Operating Systems Overview
“I don't know” – Ed Lazowska, longtime OS researcher
Nobody knows
The book has some ideas – see Section 1.
They’re programs – big, hairy programs
CSE369, Autumn 2016
L01: Intro, Combinational Logic
CSE410, Winter 2017
L24: Operating Systems Overview
“The OS is everything you don’t need to write in order to runyour application”
This depiction invites you to think of the OS as a library
In some ways, it is:
All operations on I/O devices require OS calls (
syscall
s)
In other ways, it isn't:
You use the CPU/memory without OS calls
It intervenes without having been explicitly called
CSE369, Autumn 2016
L01: Intro, Combinational Logic
CSE410, Winter 2017
L24: Operating Systems Overview
Can deal with high‐level abstractions (files) instead of low‐level hardware details (device registers)
Abstractions are
reusable
across many programs
Device independence: 3com card or Intel card?
CSE369, Autumn 2016
L01: Intro, Combinational Logic
CSE410, Winter 2017
L24: Operating Systems Overview
Gives each process the illusion of its own virtual machine
Protects
programs from each other
Fairly
multiplexes
resources across programs
Share
one computer across many users
Allows for
concurrent
execution of multiple programs
CSE369, Autumn 2016
L01: Intro, Combinational Logic
CSE410, Winter 2017
L24: Operating Systems Overview
Concurrency:
How are parallel activities (computationand I/O) created and controlled?
Scale:
What happens as demands or resourcesincrease?
Persistence:
How do you make data last longer thanprogram executions?
Distribution:
How do multiple computers interact witheach other?
Accounting:
How do we keep track of resource usage,and perhaps charge for it?
There are tradeoffs, not right and wrong!
CSE369, Autumn 2016
L01: Intro, Combinational Logic
CSE410, Winter 2017
L24: Operating Systems Overview
Timer (clock) operation
Synchronization instructions (
e.g.
atomic test‐and‐set)
Memory protection
I/O control operations
Interrupts and exceptions
Protected modes of execution (kernel vs. user)
Privileged instructions
System calls (and software interrupts)
Virtualization architectures
CSE369, Autumn 2016
L01: Intro, Combinational Logic
CSE410, Winter 2017
L24: Operating Systems Overview
Saves the current PC
Sets the execution mode to privileged
Sets the PC (
%rip
) to a handler address
Caller puts arguments in a place callee expects
One of the arguments is the
syscall
number
Callee (OS) saves caller’s state (registers, other control state)so it can use the CPU
OS must verify caller’s arguments, then runs handler code
OS returns using a special instruction
Also sets execution mode to user
open
is
syscall
2
mov
$0x2,%eax
syscall #
return
value
in
%rax
cmp
$-4095,%rax
CSE369, Autumn 2016
L01: Intro, Combinational Logic
CSE410, Winter 2017
L24: Operating Systems Overview
user mode kernel mode
Chrome: read(int fileDescriptor, void *buffer, int numBytes)
Save user PCPC = trap handler addressEnter kernel mode Save process stateVerify
syscall
number
Find
sys_read()
handler in vector table
trap handler
sys_read()
kernel routine Verify argumentsInitiate readChoose next process to runSetup return valuesRestore app state
sysret
instruction
PC = saved PCEnter user mode
CSE369, Autumn 2016
L01: Intro, Combinational Logic
CSE410, Winter 2017
L24: Operating Systems Overview
CSE369, Autumn 2016
L01: Intro, Combinational Logic
CSE410, Winter 2017
L24: Operating Systems Overview
Hardware (CPU, devices)
Application Interface (API)
Hardware Abstraction Layer
File
Systems
Memory Manager
Process
Manager
Network
Support
Device Drivers
Interrupt Handlers
Boot &
Init
Acrobat
Powerpoint
Chrome
Operating System
Portable
User Apps
Slack
CSE369, Autumn 2016
L01: Intro, Combinational Logic
CSE410, Winter 2017
L24: Operating Systems Overview
Users’ programs
Batch jobs or scripts
System programs
Print spoolers, name servers, file servers, network daemons, …
PC, registers, VM, OS resources (
e.g.
open files), etc…
The program itself (code and data)
The OS’s
process module
manages these processes
Process A:
code, stack
PC, registers
page tables
resources
CSE369, Autumn 2016
L01: Intro, Combinational Logic
CSE410, Winter 2017
L24: Operating Systems Overview
trap or
exception
interrupt
dispatch interrupt
Running
Ready
Blocked
Finished(“Zombie”)
terminate