1/16
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
Multitasking
Execute multiple tasks seemingly simultaneously by quickly switching between processes
Resource allocation
Each task receives necessary resources (CPU time, memory, I/O devices) to execute properly
I. Task scheduling
Scheduler decides order in which processes are executed to maximize CPU utilization and system responsiveness
II. Resource contention
Multiple processes compete for same resources so must manage contention = prevent conflicts, ensure fair and efficient resource usage
Semaphore (RESOURCE CONTENTION TOOL)
Synchronization tool to control access to shared resources in concurrent system (multiple processes can access same resources)
- Integer variable that can be incremented (signal) or decremented (wait) automatically
- Prevents data corruption (multiple processes write to same log file which can't handle all of them)
- 2 types
Semaphore type: Binary/mutex (RESOURCE CONTENTION TOOL)
Can only be 0 (locked) or 1 (available), lock to ensure mutual exclusion
Semaphore type: Counting (RESOURCE CONTENTION TOOL)
Can be any non-negative value, allowing multiple instances of resources to be managed (decrease by 1 everytime its accessed by a process, other processes must wait if it goes to 0)
Lock (RESOURCE CONTENTION TOOL)
Ensures only one process can use shared resource as time
- Different types: binary locks (mutexes), readers-writer locks (multiple may read but only one can write)
Monitor (RESOURCE CONTENTION TOOL)
Manages access to shared resources safely = only one process can use certain variables at a time
- Like a container holding shared variables (metadata - data about the data like access date and time, etc) and code (methods) that work with them
- Process uses a monitor's method = automatically locks the monitor so no other process can use until the first one is done
- Has condition variables that let processes wait for certain events to happen and notify others when they occur
= easier to manage and coordinate tasks between different processes safely
III. Deadlock prevention
To ensure availability and protection of resources and data, and reliability of execution through avoiding indefinite blockinb
Deadlock - multiple processes stuck forever, each waiting for other's resources
Deadlock avoidance (DEADLOCK PREVENTION)
(eg Banker's algorithm) System only allocates resources if it can guarantee that all processes can eventually finish without entering unsafe state
Deadlock detection (DEADLOCK PREVENTION)
Regularly check for stuck processes
Deadlock recovery (DEADLOCK PREVENTION)
Stop process/es to break the cycle or reallocate resources differently
Pre-empt resources (DEADLOCK PREVENTION)
Requeue processes/resources
Rollback (DEADLOCK PREVENTION)
Restore to a previous state
IV. Manage context-switching efficiently
Context-switching - shifting between processes
- ^ context switches = ^ processing overheads (consuming resources not related to direct goal) = v overall system performance
V. Ensure data consistency and integrity
Essential when multiple processes access shared data (see Security function of OS)