Professional Documents
Culture Documents
Assignment 3 - Ps
Assignment 3 - Ps
Assignment 3 - Ps
PROCESS SCHEDULING
SEMESTER 2 2023/2024
PREPARED FOR:
DR. ABDUL AZIZ K ABDUL HAMID
PREPARED BY:
AMAL HAZIRAH BINTI SAIFUDDIN (S67202)
1. Explain the difference between preemptive and nonpreemptive scheduling.
Preemptive scheduling: The Operating System can interrupt a running process or thread
and allocate the CPU to another process. This interruption based on priorities, time
slices or other criteria. The operating system has control over the CPU and can prempt
a process even if it still actively using the CPU. This allows for better responsiveness
and fairness among processes but may incur some overhead due to frequent context
switches.
2. Suppose that the following processes arrive for execution at the times indicated. Each
process will run for the amount of time listed. In answering the questions, use
nonpreemptive scheduling, and base all decisions on the information you have at the time
the decision must be made.
a. What is the average turnaround time for these processes with the FCFS scheduling
algorithm?
Completion time:
P1:8
P2:12
P3:13
b. What is the average turnaround time for these processes with the SJF scheduling
algorithm?
Completion time:
P1:8
P2:8+4 = 12
P3:12+1=13
Completion time:
P1:1+8 = 9
P2: 1 +4 = 5
P3: 5+1 = 6