03/25 Lecture 01
Know the hardware, the following is a list of hardware that we are going to discuss this quarter (in this class)
Hardware List:
- CPU
- We are mostly only going to care about single core CPU in this course
- recall registers:
- %rip: address of the next instruction
- OS is responsible for setting up %rip for start of process
- %rsp: store the stack pointer of the current process(top of the stack)
- DRAM (physical memory)
- slower compare to CPU (that’s why we use the cache -recall 351)
- data and instructions must be first loaded to DRAM before it runs
- Why? so they can have physical address
- DRAM is volatile
- it lose data between power cycles
- Memory is byte addressable
- means we can read and write any byte directly
- Disk
- there are HDD and SSD
- even though SSDs are way faster than HDDs, they are still a lot slower than memory
- cheap
- persistent
- means they preserve data between power cycles
- block addressable
- Data can only be read and written with page sized chunks
- IO Devices (not important)
- input
- output
- monitor
- headphones
- speakers
- Network Adapter (NIC)
OS Roles
What is Operating System?
Things to know:
- a program abstract and manage hardware for user programs
- We want the OS to have: (from textbook, where it has more details)
- Reliability
- Security
- Privacy
- Fair Resource Allocation
OS need to provide abstractions for user processes
- OS Abstractions:
- CPU ⇒ processes
- DRAM ⇒ Virtual Memory
- Storage ⇒ Files, Directories
- Network ⇒ TCP, UPD, …
- Why do we need to provide these abstractions?
- Ease of use for the user process
- provide simplified services to user
- storage ⇒ files: creates names files, folders to organize, user do not need to deal with pages
- DRAM ⇒ virtual memory: a process owns the entire address space (351 covered this)
- mask hardware limits
- file system: hides block sized by bytes
- virtual memory: allows process to user more than physically available
- Common Interface
- allows process to share files with each other
- portable interface (a good example would be the POSIX file system)
- managed access
- resource management
- schedule processes onto a single CPU
- sharing of physical memory (v table)
- isolation
- process can’t read each other’s memory
- process can’t read OS’ memory
- managed (controlled) sharing
03/27 Lecture 02
OS prevent process from doing certain things
How?
- Option 1 (almost always wrong):
- OS can look through process’ binary file and detect bad instruction
- Why not?
- process might dynamically change its code