Docsity

Operating Systems: Processes, Scheduling, Memory and File Systems, Study Guides, Projects, Research of Computer Science

Toggle sidebar
bg1
Operating Systems: Processes, Scheduling, Memory and File Sy Page 1 of 3
Operating Systems: Processes, Scheduling, Memory and
File Systems
The mechanisms, the calculations and the concurrency questions exams ask
Computer Science | Undergraduate (Level 5) | December 2026
WHAT IS INSIDE
1. Processes, threads and system calls
2. Scheduling and its metrics
3. Concurrency, synchronisation and deadlock
4. Memory management and file systems
Exam question patterns
Glossary of exam-ready definitions
1. Processes, threads and system calls
A process is a program in execution with its own address space, and a thread is a schedulable execution
stream sharing that address space with its siblings. The trade-off is exactly the sharing: threads communicate
cheaply through shared memory but need synchronisation, while processes are isolated and pay for
communication through IPC. Context switching saves and restores register state and, on a switch between
processes, changes the address space, which is why a thread switch is cheaper than a process switch.
The process state model - new, ready, running, waiting, terminated - is what an exam traces through a fork,
a blocking read and a signal. System calls are the controlled entry into kernel mode: the trap switches
privilege level, the kernel validates arguments and returns a result, and the cost of that transition is what
makes a tight read loop slower than buffered I/O. fork duplicates the address space lazily by copy-on-write
and returns twice, which is why the child must check the returned value.
•PCB - state, registers, scheduling information, memory and open-file tables.
•fork/exec/wait - create, replace image, reap; misordering produces zombies or orphans.
•User versus kernel mode - mode bit enforced by hardware; the trap is the only legitimate crossing.
•Threads - user-level threads are fast but block the process on a blocking call unless the kernel sees them.
2. Scheduling and its metrics
Scheduling questions are marked on the numbers. FCFS is simple and suffers the convoy effect; SJF
minimises average waiting time but needs burst prediction and starves long jobs; round robin bounds
response time with a quantum that trades context-switch overhead against responsiveness; priority and
multilevel feedback queue approximate SJF without knowing the future by penalising jobs that use the
CPU heavily.
Always compute the same four measures so answers are comparable: waiting time (time in the ready
queue), turnaround (completion minus arrival), response (first dispatch minus arrival) and throughput.
Then argue with the numbers: SJF's lower average waiting time is paid for by variance, and a real-time
system cares about the deadline miss rate rather than the average, which is why EDF and rate-monotonic
scheduling appear in embedded cases.
•Convoy effect - one long job ahead of many short ones inflates average waiting time.
•Round-robin quantum - too small wastes switches, too large degenerates to FCFS.
•Starvation and ageing - priority schemes need ageing to guarantee progress.
pf3

Partial preview of the text

Download Operating Systems: Processes, Scheduling, Memory and File Systems and more Study Guides, Projects, Research Computer Science in PDF only on Docsity!

Operating Systems: Processes, Scheduling, Memory and

File Systems

The mechanisms, the calculations and the concurrency questions exams ask Computer Science | Undergraduate (Level 5) | December 2026

WHAT IS INSIDE

  1. Processes, threads and system calls
  2. Scheduling and its metrics
  3. Concurrency, synchronisation and deadlock
  4. Memory management and file systems Exam question patterns Glossary of exam-ready definitions

1. Processes, threads and system calls

A process is a program in execution with its own address space, and a thread is a schedulable execution stream sharing that address space with its siblings. The trade-off is exactly the sharing: threads communicate cheaply through shared memory but need synchronisation, while processes are isolated and pay for communication through IPC. Context switching saves and restores register state and, on a switch between processes, changes the address space, which is why a thread switch is cheaper than a process switch.

The process state model - new, ready, running, waiting, terminated - is what an exam traces through a fork, a blocking read and a signal. System calls are the controlled entry into kernel mode: the trap switches privilege level, the kernel validates arguments and returns a result, and the cost of that transition is what makes a tight read loop slower than buffered I/O. fork duplicates the address space lazily by copy-on-write and returns twice, which is why the child must check the returned value.

  • PCB - state, registers, scheduling information, memory and open-file tables.
  • fork/exec/wait - create, replace image, reap; misordering produces zombies or orphans.
  • User versus kernel mode - mode bit enforced by hardware; the trap is the only legitimate crossing.
  • Threads - user-level threads are fast but block the process on a blocking call unless the kernel sees them.

2. Scheduling and its metrics

Scheduling questions are marked on the numbers. FCFS is simple and suffers the convoy effect; SJF minimises average waiting time but needs burst prediction and starves long jobs; round robin bounds response time with a quantum that trades context-switch overhead against responsiveness; priority and multilevel feedback queue approximate SJF without knowing the future by penalising jobs that use the CPU heavily.

Always compute the same four measures so answers are comparable: waiting time (time in the ready queue), turnaround (completion minus arrival), response (first dispatch minus arrival) and throughput. Then argue with the numbers: SJF's lower average waiting time is paid for by variance, and a real-time system cares about the deadline miss rate rather than the average, which is why EDF and rate-monotonic scheduling appear in embedded cases.

  • Convoy effect - one long job ahead of many short ones inflates average waiting time.
  • Round-robin quantum - too small wastes switches, too large degenerates to FCFS.
  • Starvation and ageing - priority schemes need ageing to guarantee progress.

Operating Systems: Processes, Scheduling, Memory and File Systems

  • Real-time - EDF is optimal for preemptive uniprocessor deadlines; rate-monotonic suits fixed periods.

3. Concurrency, synchronisation and deadlock

A race condition arises when the result depends on interleaving, and the critical section requirements are mutual exclusion, progress and bounded waiting. Spinlocks busy-wait and suit short critical sections on multicore; semaphores block and suit longer ones; a monitor makes the locking implicit with condition variables. The classic bugs are worth naming: a signal before wait is lost, and two condition variables with one lock produce the wrong wake-up.

Deadlock needs four conditions together - mutual exclusion, hold and wait, no preemption and circular wait

  • and remedies map onto them: prevention breaks a condition, avoidance uses Banker's algorithm against the claim matrix, detection builds a wait-for graph and recovers by preemption or rollback. The examinable distinction is that avoidance needs future claims, so it is safe but conservative, while detection is optimistic and needs a recovery path.
    • Atomicity - test-and-set and compare-and-swap are the hardware primitives.
    • Lost wake-up - always wait inside a while loop rechecking the predicate.
    • Banker's algorithm - a state is safe if some sequence of completion exists.
    • Priority inversion - priority inheritance fixes a low-priority holder blocking a high-priority waiter.

4. Memory management and file systems

Paging removes external fragmentation by mapping fixed-size pages to frames through a page table; the TLB caches translations, and the cost of a miss is the reason locality matters. Demand paging brings pages in on fault, and the page replacement choice decides the fault rate: FIFO suffers Belady's anomaly , optimal is a bound not an implementation, and LRU approximates it with a clock algorithm.

The working set is the set of pages a process needs over a window, and thrashing happens when the sum of working sets exceeds physical memory, so the system spends its time faulting. Adding memory or reducing multiprogramming are the real fixes; a local replacement policy only contains the damage. File systems add allocation (contiguous, linked, indexed), the inode as the metadata record, directory structures and the cached buffer that hides disk latency, with journaling buying crash consistency at the cost of extra writes.

  • Effective access time - hit ratio times TLB time plus the miss path; the standard calculation.
  • Belady's anomaly - more frames can mean more faults under FIFO, never under LRU or optimal.
  • Thrashing - the fix is fewer resident processes, not a faster replacement policy.
  • Inode - direct, single, double and triple indirect blocks; compute maximum file size from these. Mechanism Solves Cost or risk Threads Cheap concurrent execution Shared state needs synchronisation Round-robin Bounded response time Context-switch overhead at small quantum Semaphore Mutual exclusion across processes Misuse causes deadlock or lost wake-up Paging with TLB External fragmentation Translation cost and page faults Journaling file system Crash consistency Write amplification and recovery time

Numerical questions in this module are decided by the trace: draw the Gantt chart or the page table, state the formula once, then substitute. An answer with the right number and no working loses the method marks.