Operating System Flashcards
Name some elements in an Operation System
CPU, main memory, storage devices (disk), network interconnects (Wifi/Eth), GPU, USB drives, resource management
Main roles of an Operating System
Resource management (scheduler, memory manager, accessing hw) of hardware
Provide isolation and protection among processes and hardware
Abstract hardware details and complex tasks
Enforce working policies
Abstraction
- simplifying concepts that describe entities that the O/S supports.
- techniques used to hide the underlying details of hardware by providing an API that is simpler to reason about than reasoning about the underlying hardware directly.
ex: process, thread, file, socket, memory page
Mechanism (Arbitration)
what the O/S does (scheduling, synchronization, etc.)
ex: create, schedule, open, write, allocate
Memory storage types in increasing order of Cost
CPU cache (order of cycle) - most frequently used
DRAM (order of hundreds of cycles) - for active processes not currently running on CPU or running on CPU but too large to store in cache
Disk - for storage of applications and data usually not active processes
What O/S mechanisms are in place to maintain isolation and protection among processes
kernel-level access is “privileged” mode to access O/S items e.g. main memory or other hardware
“Trap Method” - traps user-level instructions via system call (e.g., open, send, malloc with required arguments are written and relevant data saved to well-defined location) attempts to cross the boundary are interrupted. The privilege bit on the CPU is checked. If allowed, control is passed to kernel and user-level process is in synchronous mode and waits for system call to complete.
Why is crossing User/Kernel boundary is expensive
All the below are costs
- Trap method: checks cause of trap, privilege access bit memory accesses, appropriate thing to do
- accessing additional memory locations for data
- CPU cache changes are made
- takes lots of instructions
Characteristics of Monolithic O/S
every possible service for applications or hw is part of O/S
+ Very large footprint and compile time optimizations
- hard to maintain and upgrade, not portable, poor performance cuz looking through lots of memory
Characteristics of Modular O/S
Basic services and APIs in O/S, standard interfaces,
+ less resource intensive, easy to customize and install ideal modules
- harder to optimize, hard to maintain cuz of different code bases
Characteristics of Microkernel O/S
Minimum necessary functionality, system calls, and communication. Microkernel has entirely its own address space. Only very basic primitives and small footprint
+ very robust & secure, lower overhead and better performance, easy to verify correctly fxns, good for critical operations that require correct performance (embedded devices, control systems)
- requires frequent interprocess (user level process to kernel to another user level process) communication and interactions, not portable because of specialized hw, difficult to find compatible sw for specialized hw,
Linux O/S uses what kind of O/S?
Modular
Mac O/S uses what kind of O/S?
at its core is a microkernel with a BSD on top which connects to various standard O/S support. Modular + microkernel
What does the principle of separation of mechanism and policy mean?
Implement flexible mechanisms to support many policies. Different use cases result in different policies making sense
What does the principle optimize for the common case mean?
Need to understand how the O/S will be used, the common case. Then choose the policy based on the available mechanisms and abstractions of the O/S
What is policy in the context of an O/S?
rules to manipulate data to/from memory and to schedule competing processes