Process vs Thread
Process: independent memory space; threads: lightweight units within a process sharing memory. Threads enable concurrency; processes provide isolation.
CPU scheduling
Algorithms: FCFS, SJF, Priority, Round-Robin. Goals: fairness, throughput, low latency. Modern OS use multi-level feedback queues.
Deadlocks and avoidance
Deadlock requires mutual exclusion, hold-and-wait, no preemption, circular wait. Avoid via ordering locks, timeouts, lock hierarchies.
Virtual memory and paging
Virtual addresses mapped to physical via page tables/TLB. Paging loads only needed pages; reduces memory footprint, enables isolation.
File systems and journaling
Common FS: ext4, NTFS, APFS. Journaling writes intent before data to ensure consistency after crashes. Concepts: inodes, directories, blocks.
Blocking vs Non-blocking I/O
Blocking waits for completion; non-blocking returns immediately. Async I/O uses event loops and callbacks to handle readiness.
OS security primitives
Users/groups, permissions (ACLs), capabilities, sandboxing, SELinux/AppArmor, ASLR, process isolation.
Context switching
Saving/restoring CPU registers, program counter, and memory mappings to switch between processes/threads; contributes to overhead.
System calls
User-space requests services via syscalls (open, read, write, fork). Interfaces differ across OS; use libc wrappers.
Mutex vs Semaphore
Mutex enforces mutual exclusion; semaphore controls access to resources with counters. Avoid deadlocks with ordering/timeouts.
Copy-on-write
Forked processes share pages as read-only until a write occurs, then copy is made; improves performance and memory usage.
Kernel vs User mode
Kernel mode has unrestricted access; user mode is restricted. Transitions occur via traps/interrupts and syscalls.
CPU scheduling algorithms
Compare FCFS, SJF, Priority, Round Robin; trade-offs in throughput, fairness, and response time.
Deadlocks and prevention
Four conditions: mutual exclusion, hold-and-wait, no preemption, circular wait. Prevent via ordering, timeouts, detection and recovery.
Paging vs segmentation
Paging divides memory into fixed-size pages; segmentation uses variable-size logical units. Many systems combine both.
Filesystem journaling
Journaling (ext4, NTFS) logs metadata/data changes to recover after crashes; trade-offs in performance vs reliability.