Cpu scheduling calculate with line, graphy, bar
Computer Science
ScanSolve AI Answer
Answer
4.25
7.75
CPU scheduling determines which process gets the CPU and for how long, aiming to optimize system performance. Here's how to calculate and visualize scheduling with an example.
Let's use the following processes:
| Process | Arrival Time (AT) | Burst Time (BT) |
|---|---|---|
| P1 | 0 | 5 |
| P2 | 1 | 3 |
| P3 | 2 | 2 |
| P4 | 3 | 4 |
We will calculate:
- Completion Time (CT): Time when a process finishes execution.
- Turnaround Time (TAT): .
- Waiting Time (WT): .
1. First-Come, First-Served (FCFS)
Processes are executed in the order they arrive.
Gantt Chart:
| P1 | P2 | P3 | P4 |
0 5 8 10 14
Calculations:
- P1:
- Starts at 0, Finishes at 5
- P2:
- Starts at 5, Finishes at
- P3:
- Starts at 8, Finishes at
- P4:
- Starts at 10, Finishes at
Average Metrics:
2. Shortest Job First (SJF) - Non-Preemptive
The process with the shortest burst time among the available processes is executed next.
Gantt Chart:
| P1 | P3 | P2 | P4 |
0 5 7 10 14
Calculations:
- P1: (Only process at AT=0)
- Starts at 0, Finishes at 5
- P3: (At time 5, P2, P3, P4 are available. P3 has BT=2, which is shortest)
- Starts at 5, Finishes at
- P2: (At time 7, P2, P4 are available. P2 has BT=3, which is shortest)
- Starts at 7, Finishes at
- P4: (At time 10, only P4 is available)
- Starts at 10
Was this helpful?
Try one yourself
A new problem that tests the same skill.
Still stuck on this one?
Ask a follow-up, and the answer starts from this question.
Got a different question?Ask your own question
More Computer Science Questions
QIn liner graphically numbers of p and cQCalculate the average waiting time and turnaround time for processes P1, P2, P3, P4 using FCFS, SJF…QDraw Gantt charts and calculate average waiting times for SRTN and RR scheduling algorithms given…QShortest job first as a type of CPU scheduling . It's advantages and in disadvantages. Anwers should…QRound robbing as a CPU scheduling method. Anwers should be in English