How does a program run?
- Von Neumann model of computing: It fetches instructions from the memory, decode it, and then execute it, and move on to the next instruction. This happens millions of times per sec.
- Virtualization: The OS takes a physical resource(such as the processor, or memory, or a disk) and transform it into a more general, powerful, and easy-to-use virtual form of itself. Thus, we sometimes refer to the operating system as a virtual machine.
- A typical OS will expose a few hundred system calls that are available to applications. (Standard library)
- OS is also referred as Resource Manager for allocations of the usage of resources
Virtualization of CPU: turning a single CPU into a seemingly infinite number of CPUs and allows multiple programs to seemingly run at once
Virtualization of memory: Memory is just an array of bytes; to read memory, one must specify an address to be able to access the data stored there; to write (or update) memory, one
must also specify the data to be written to the given address. Memory is accessed all the time when a program is running.
Each process accesses its own private virtual address space
PID: process identifier. Unique per running process.
1 | pthread_t is the data type used to uniquely identify a thread in C. It's returned by pthread_create() and used by the application in function calls that require a thread identifier. |
Threads Can be thought as a funciton running within the same memory space as other functions, with more than one of them active at a time.
Persistence Keep data persisted all the time
Design Goals
- Build up abstractions
- High performance, minimize the overheads of the OS
- Provide protection between applications. Isolating processes from one another is the key to protection.
- High Reliability