A1.3.5 — Multitasking and Resource Allocation [HL]
Multitasking
The OS managing and executing multiple processes concurrently. On a single-core CPU this is achieved by rapidly switching between processes (context switching). On multi-core CPUs, processes can genuinely run in parallel.
- Multithreading: Multiple threads within a single process execute concurrently. Threads share the same memory space. Example: browser rendering a page, running JavaScript, and downloading a file simultaneously.
- Context switching: The OS saves the state of the current process and loads the state of the next. Creates the illusion of parallel execution on a single core.
Resource Allocation
The OS distributes resources (CPU time, memory, storage, I/O) among competing processes fairly and efficiently.
- The OS tracks what resources each process holds and what it is waiting for.
- Allocation decisions consider priority, fairness, and system efficiency.
- The scheduling algorithms from A1.3.3 directly control CPU resource allocation.
Deadlock
Two or more processes each waiting for a resource held by the other so none can proceed.
Example: Process A holds Resource 1, needs Resource 2. Process B holds Resource 2, needs Resource 1. Both wait forever.
- Identification: OS monitors resource dependencies to detect deadlock situations before or as they occur.
- Release: Once detected, OS breaks the cycle by terminating a process, pre-empting a resource, or reallocating resources.
- Prevention: Deadlock avoidance algorithms analyse resource requests and deny those that would create cyclic dependencies.
System Integrity
System integrity means a computer system performs its intended functions correctly and reliably, without unauthorised or unintended alterations.
- Correctness: The system behaves as expected.
- Completeness: All required functions are available.
- Data accuracy: Data is not corrupted or modified without authorisation.
- Protection from manipulation: Prevents tampering with hardware, software, or data state.
- Resilience: The system continues operating correctly even under stress or after failures.
For multitasking: on a single-core CPU, multitasking is achieved through rapid context switching — processes don't literally run at the same time.