in Operating System edited by
3,810 views
15 votes

Draw the process state transition diagram of an OS in which (i) each process is in one of the five states: created, ready, running, blocked (i.e., sleep or wait), or terminated, and (ii) only non-preemptive scheduling is used by the OS. Label the transitions appropriately.

in Operating System edited by
3.8k views

2 Comments

where is the answer for a) ?
0
0

Subscribe to GO Classes for GATE CSE 2022

2 Answers

14 votes
 
Best answer

Process state transition diagram for an OS which satisfy the below two criteria will be as follows:

  1. each process is in one of the five states: created, ready, running, blocked (i.e., sleep or wait), or terminated, and
  2. only non-preemptive scheduling is used by the OS.

If in question it is asked about the preemptive scheduling then after the $\textsf{running state}$ a process directly go to $\textsf{ready state}.$

edited by

2 Comments

Galvin says Blocked to Ready also makes for pre-emptive scheduling.  Don't know why.
0
Yes it's possible if a higher priority process comes to the ready state from blocked state then we need preemption.
2
9 votes

B.

  1. 1st blank $-$ TestandSet(mutex).
    2nd blank $-$ mutext $=0$;
     
  2. no.
     
  3. say given procedure is not atomic. 1st execute process $p1$. After $A1 \ p1$ is preempted. 2nd process $p2$ now executes full code and enters critical section.  $P1$ resumes and completes the code and enters critical section. So $2$ processes are now in critical section.
edited by

6 Comments

is this deadlock free??why and why not??
0
It is deadlock free but not starvation free.
14

It's correct: TestandSet(mutex) but use & i.e. TestandSet(&mutex)

1
It is deadlock free because if any one process executes the enter-cs method and calls the atomic TEST-AND-SET instruction, it will be returned what the value of the mutex was when it called the atomic TEST-AND-SET instruction, hence the loop will only terminate if the value of mutex was 0 when the function was called. This will only happen when mutex is assigned to 0 which is in the leave-cs method. So busy waiting will occur, but it will never happen that all processes get blocked, never to be resumed.
0
question and answer are miss-match
1
Answer is correct but of some other question.
0

Related questions