Professional Documents
Culture Documents
3
Course: Operating System
Submitted by:
Name Roll No
Wardah Saleem F-101032
Sara Najam F-101046
3. Which type of scheduler performs the process swapping from RAM to Hard drive?
Medium-term scheduling performs the process swapping from RAM to Hard Drive.
13. The scheduling decision to switch from running to waiting state is preemptive or non-
preemptive?
Non-preemptive Scheduling is used when a process terminates, or a process switches
from running to waiting state.
14. The scheduling decision to switch from running to ready state is preemptive or non-
preemptive?
Preemptive scheduling is used when a process switches from running state to ready state or
from waiting state to ready state.
15. The scheduling decision to switch from waiting to ready state is preemptive or non-
preemptive?
Preemptive scheduling is used when a process switches from running state to ready state or
from waiting state to ready state.
29. What is the FCFS (First Come First Serve) Scheduling Algorithm?
First Come First Serve (FCFS) is an operating system scheduling algorithm that automatically
executes queued requests and processes in order of their arrival.
30. Is FCFS (First Come First Serve) preemptive or non-preemptive?
FCFS is a non-preemptive scheduling algorithm. First come first serve scheduling
algorithm states that the process that requests the CPU first is allocated the CPU first. It
is implemented by using the FIFO queue. When a process enters the ready queue, its PCB
is linked onto the tail of the queue. When the CPU is free, it is allocated to the process at
the head of the queue.
Q.No.2: Consider the following processes with CPU burst time, priority and
arrival time;
FCFS:
Criteria: lower number Higher Priority
Process Burst Time Priority Arrival Time Completion Turn Around Waiting Time
time Time
T.A= C.T – A.T W.T= T.A – B.T
P1 10 3 0 9 9 1
P2 1 1 0 1 1 0
P3 2 5 0 12 12 10
P4 1 4 0 10 10 9
As, the arrival time of the processes is zero. So, the completion time and
turn around time will be same.
Gant Chart:
Ready queue:
P2 P1 P4 P3 P1
Running queue:
P2 P1 P4 P3 P1
0 1 3 4 6 14
Q.No.3: Write the C++ program for the processes in Q.No.2 using FCFS
Scheduling Scheme. Also calculate the average waiting time and
average turnaround time.
C++ code:
Output:
________________________________________________________