Professional Documents
Culture Documents
Operating System Solved Tutoral Two
Operating System Solved Tutoral Two
1. Using the process state diagrams of Figure 1, explain why there’s no transition:
a. From the READY state to the WAITING state
ANSWER
From the READY state to the WAITING state: This is because the READY state
represents processes that are ready to execute, but are waiting for CPU time. They are not blocked
or waiting for any resource. The WAITING state, on the other hand, represents processes that are
waiting for some event or resource to become available. Therefore, there is no direct transition
from the READY state to the WAITING state.
This is because a process in the WAITING state is blocked, waiting for some resource or
event to occur. When that resource or event becomes available, the process transitions to the
READY state, and it's up to the scheduler to decide when to allocate CPU time to it, and hence
move it to the RUNNING state
2. Explain with diagram the process states?
❖ A process goes through various states during its lifetime. The process states diagram is a
visual representation of these states. The most common states are:
NEW: The process is being created or initialized.
READY: The process is waiting for CPU time to be allocated.
RUNNING: The process is currently being executed by the CPU.
WAITING: The process is waiting for some event or resource to become available.
TERMINATED: The process has completed its execution and is about to be terminated.
A process can also be in other states, such as SUSPENDED or BLOCKED, depending on the
operating system and its implementation.
Figure 2
Draw a timeline for each of the following scheduling algorithms. (It may behelpful to first
compute a start and finish time for each job.)
a) FCFS
0 10 22 25 26 41
A B C D E
IN ADDITION
JOB ARRIVAL CPU COMPLETION TURN WAITING RESPONSE
AROUND TIME(W.T) TIME
TIME CYCLE TIME (CT)
TIME
WT=T.A.T –
Time the (T.A.T)
Busting
process
T.A.T=CT tine/cpu
finished look
– A.R cycle/execution
on the graph
A 0 10 10 10 0 0
B 2 12 22 20 8 8
C 3 3 25 23 20 22
D 6 1 26 20 19 25
E 9 15 41 32 17 26
AVERAGE TURNAROUND TIME =10 + 20+23+20+32/5
AVERAGE WAITING TIME = 0+8+20+19+17/5
NOTE FOR NON PREEMPTIVE, WAITING TIME = RESPONSE TIME BUT NOT FOR
PREEMPTIVE POLICY
b) SJN
0 3 6 7 14 26 41
A C D A B E
c) SRT
0 3 6 7 14 26 41
A C D A B E
d) Round robin (using a time quantum of 5, ignore context switching and natural
wait)
0 5 10 13 14 19 24 29 34 36 41
A B C D E A B E B E
6. Draw and explain the differences between two, five and seven process state diagrams.
A process is a program in execution and it is more than a program code called as text section and
this concept works under all the operating system because all the task perform by the operating
system needs a process to perform the task
The process executes when it changes state. The state of a process is defined by the current
activity of the process. It is important to know that only one process can be running on any
processor at any instant. Many processes may be ready and waiting.
Two-State Process Model
The simplest model in the process state will be a two-state model as it consists of only two states
that are given below:
Running State- A state in which the process is currently being executed.
Not Running State- A state in which the process is waiting for execution.
7. Find the average waiting time and average turnaround time for executing the following
processes using the following scheduling algorithms :
a) FCFS
c) SRTF
d) Round robin (quantum = 4)