Operating System EXAM NOTES
Operating System EXAM NOTES
Operating System EXAM NOTES
P3 2 10 23 21 11 P4 P4 P4 P1 P1 P3 P3 P5 P2
0 3 5 7 8 11 12 15 21 30
P4 3 11 34 31 20
P AT BT CT TAT WT
Formula Used:
- TAT : CT- AT P1 3 4 11 8 4
- WT : TAT - BT
P2 5 9 30 25 16
- ATAT : TAT Sum / # of Ps
- AWT : WT Sum / # of Ps P3 8 4 15 7 3
B. Shortest-Job-First (SJF) P4 0 7 7 7 0
- Length of the process matters P5 12 6 21 9 3
- Non-preemptive
- Criteria: Burst Time
D. Round-Robin Scheduling (RR)
- Ensures fairness in CPU allocation
Example:
- Each process runs for a fixed time
Given: P AT BT
quantum before moving to the next in a
P1 3 4
circular queue
P2 5 9
P3 8 4
Example:
P4 0 7
Given: P AT BT
P5 12 6
P1 0 8
Answer:
P2 1 5
P4 P1 P3 P5 P2 P3 2 10
0 7 11 15 21 30 P4 3 11
Answer:
P AT BT CT TAT WT P1 P2 P3 P4 P1 P3 P4 P4
0 5 10 15 20 23 28 33 34
P1 3 4 11 8 4
P AT BT CT TAT WT
P2 5 9 30 25 16
P1 0 8 23 23 15
P3 8 4 15 7 3
P2 1 5 10 9 4
P4 0 7 7 7 0
P3 2 10 28 26 16
P5 12 6 21 9 3
P4 3 11 34 31 20
Topic 4: Process Synchronization Hardware-based Approach Solutions
A. Test and Set Lock
Definition B. Swap
Process Synchronization, or concurrency, C. Unlock and Lock
is a process that operates in the system
and has the ability to both affect and be Semaphores
affected by other processes. It is a technique which helps manage
concurrent processes from accessing the
Race Condition same shared data at the same time. It
A race condition is when multiple uses integers (non-negative numbers)
processes interact with the same data and is also used to solve critical section
simultaneously without proper problems.
synchronization.
Types of Semaphores
Common Syntax of a System Process 1. Binary Semaphores (0 and 1s)
2. Counting Semaphores
(Unrestrained number of values)