Operating Systems Flashcards
Key Roles of an OS
1) Hide hardware complexity (e.g. no need to think about how to interact with hdd)
2) manage underlying HW resources (allocates memory for apps)
3) provides isolation and protection (apps shouldn’t access other app’s memory)
What is an OS? (3 things)
A layer of software systems that:
1) directly has priviliged access to underlying HW
2) manages hw on behalf of 1 or more apps according to predefined policies
3) ensures that apps are isolated and protected from one another
List abstractions:
1) process, thread, file, socket memory page
List mechanisms:
2) create, schedule, open, write, allocate
policies:
used to determine exactly how the mechanism will be used to manage underlying hw (LRU)
Give an example of abstractions, mechanism and policies:
Abstraction: memory page
Mechanism: “allocate”
policy: determines when to move page from DRAMto disk (LRU)
Separation of Mechanism and policy:
memory management mechanisms should be generalized to these different policies (LRU, LFU for memory)
optimize for common case
understanding the common case helps OS implement correct policy basedon generalized mechanism
user-mode
unprivileged
where most apps run
kernel mode:
OS operates in kenernel mode with direct access to HW
privileged
user kernel mode crossing
1) app wants direct acess to HW so it uses a system call
2) control is switched to OS which can flip a bit in cpu to allow app access to HW
3) if privileged instructions are encountered in non-privileged execution, the app becomes trapped at which point the OS can grant access or terminate
trapped
when a privileged instruction is encountered by HW in non-privileged execution
system call definition:
an interface that can be invoked by app to allow privileged access of HW resources for the app on behalf of OS (e.g. open, send, mmap)
System call flow:
1) app needs access to HW so makes system call
2) control is passed to OS which accesses HW
3) execution control and data is passed back to app process from OS
Monolithic kernel Pros and Cons:
Pros: everything included inlining, compile time optimizations Cons: no customization not portable large memory footprint that may impact performance