Operating Systems
87 flashcards by MentisLibrary
Processes and threads, scheduling, virtual memory and paging, file systems, deadlock, and concurrency primitives. The classic OS curriculum, condensed into cards you can actually review.
- What does an operating system do?
- It manages hardware resources and provides an abstraction layer so programs can use CPU, memory, storage, and devices without knowing their details.
- What is the kernel?
- The core of the operating system, running with full hardware privileges and mediating every access to resources.
- User mode versus kernel mode
- Two CPU privilege levels: user mode restricts access to hardware and privileged instructions, kernel mode allows everything.
- What is a system call?
- The controlled entry point through which a user program requests a service from the kernel, causing a switch into kernel mode.
- Monolithic versus microkernel
- A monolithic kernel runs drivers and filesystems inside kernel space; a microkernel keeps only the minimum there and pushes the rest into user-space servers.
- What is a process?
- A running program together with its own address space, open file descriptors, and execution state.
- What is a thread?
- An independent path of execution inside a process, sharing the process's memory and file descriptors but with its own stack and registers.
- Process versus thread, key difference
- Processes are isolated and communicate through explicit IPC; threads share memory directly, which is faster but requires synchronization.
- What is in a process control block?
- The kernel's record of a process: its id, state, register snapshot, memory mappings, open files, priority, and accounting data.
- What are the process states?
- New, ready, running, waiting or blocked, and terminated.
- What is a context switch?
- Saving one thread's CPU state and restoring another's so the CPU can run something else.
- What does fork do?
- Creates a nearly identical copy of the calling process, returning 0 in the child and the child's pid in the parent.
- What does exec do?
- Replaces the current process image with a new program, keeping the same process id.
- What is a zombie process?
- A finished process whose exit status has not yet been collected by its parent, so its entry stays in the process table.
- What is an orphan process?
- A process whose parent exited before it did, which is then reparented to init or systemd.
- What is a daemon?
- A long-running background process with no controlling terminal, usually started at boot.
- What is a signal?
- An asynchronous notification delivered to a process, which may be handled, ignored, or fatal.
- Difference between SIGTERM and SIGKILL
- SIGTERM asks the process to shut down and can be handled for cleanup; SIGKILL destroys it immediately with no chance to clean up.
- What is inter-process communication?
- Mechanisms letting isolated processes exchange data: pipes, message queues, shared memory, sockets, and signals.
- What is a pipe?
- A unidirectional in-kernel byte buffer connecting one process's output to another's input.
- What is shared memory?
- A memory region mapped into several processes' address spaces so they can read and write the same physical pages.
- What is CPU scheduling?
- Deciding which ready thread runs next on a CPU and for how long.
- Preemptive versus cooperative scheduling
- A preemptive scheduler can interrupt a running task at any time; a cooperative one waits for the task to yield.
- First-come, first-served scheduling
- Runs processes in arrival order with no preemption.
- Shortest job first scheduling
- Runs the process with the smallest expected burst time next, minimizing average waiting time.
- Round robin scheduling
- Gives each ready process a fixed time slice in rotation.
- Priority scheduling and starvation
- Higher-priority tasks run first, which can leave low-priority tasks waiting indefinitely.
- Multilevel feedback queue
- Several queues with different priorities and time slices, where a task that uses its full slice moves down and an interactive one stays high.
- What is priority inversion?
- A high-priority task blocked on a lock held by a low-priority task, which is itself preempted by medium-priority work.
- What is a real-time operating system?
- An OS that guarantees a bounded response time for its tasks.