-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmanual.txt
More file actions
49 lines (41 loc) · 1.76 KB
/
manual.txt
File metadata and controls
49 lines (41 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
add support for rest of algos
add support for multiple cpu
write report
add githooks for format code
refractor cpu_scheduling/cpu_thread.c
io process is same as cpu -> single threaded
A. First In First Out (FIFO)
Data structure: simple queue.
Dequeue rule: head of queue.
CPU runs that process until it finishes.
No preemption.
B. Non-preemptive Shortest Job First (SJF)
Data structure: priority queue, ordered by burst time.
Dequeue rule: pick the process with smallest CPU burst among those ready.
CPU runs it until it finishes.
Still no preemption.
C. Preemptive Shortest Job First (SRTF – Shortest Remaining Time First)
Data structure: priority queue, ordered by remaining burst time.
Dequeue rule: always pick process with shortest remaining time.
Preemption happens: if a new process arrives with shorter burst than the current one → current is paused and re-enqueued.
So here dequeue isn’t just at completion—it can happen mid-burst.
Event-driven approach:
Preemption check is triggered only on process arrival.
Arrival thread signals the scheduler.
Scheduler compares new front vs current.
Tick-driven approach:
Every CPU tick, scheduler compares current vs ready_queue.front.
If no new arrivals, condition will always fail anyway.
If new arrivals, condition succeeds immediately.
D. Round Robin (RR)
Data structure: simple queue (like FIFO).
Dequeue rule: head of queue.
CPU runs that process for time_quantum only.
If process finishes early → remove.
If not → preempt and re-enqueue at tail.
Preemption always after quantum.
👉 So:
A = normal queue.
B = priority queue (non-preemptive).
C = priority queue (preemptive).
D = queue + time slicing.