What is OS?
- A program that acts as an intermediary between a user of a computer and the computer hardware. It’s an interface that host other programs.
- Top-down perspective: hardware abstraction layer, turn hardware into something that applications can use
- e.g: App issue system calls to use OS abstractions
- Easy to use, good for reusability and portable
- Bottom-up perspective: resource manager/coordinator, manage your computer’s resources
- Computer has resources(CPU, memory, disk, device... etc.), and OS must manage them
- Goof for sharing/multiplexing, protectino for apps from each other, and performance
OS abstraction: process
It’s a running program, stream of running instructions + process state
- A key OS abstraction: the applications you use are built of processes
- Process are protected from each other, process = address space
- Hide details of CPU, when & where to run
Unix process-related system calls
int fork(void)
- Create a copy of the invoking process
- Return process ID of new process in “parent”
- Return 0 in “child”
int execv (const char* prog, const char* argv[])
- Replace current process with a new one
- prog: program to run
- argv: arguments to pass to main()
int wait(int* status)
OS abstraction: file
- Array of bytes, persisetnt across reboot
- Nice, clean way to read and write data
- Hide the details of disk devices
- Related abstraction: directory, collection of file entries
OS Structure
- What goes into the kernel
- Kernal: most interesting part of OS
- Privileged: can do everything → so we must be careful
- Manages other parts of OS
- Different structures lead to different
- Perfirmance, functionality, ease of use, security, reliability,... etc
- Tradeoffs depend on technology and workload

