Log In
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
where is the answer for a) ?

2 Answers

11 votes
Best answer

Process state transition diagram for an OS which satisfy below criteria -

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.




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

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


  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
is this deadlock free??why and why not??
It is deadlock free but not starvation free.

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

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.
question and answer are miss-match
Answer is correct but of some other question.

Related questions

5 votes
3 answers
The functionality of atomic TEST-AND-SET assembly language instruction is given by the following C function int TEST-AND-SET (int *x) { int y; A1: y=*x; A2: *x=1; A3: return y; } Complete the following C functions for implementing code for entering and ... and starvation-free? For the above solution, show by an example that mutual exclusion is not ensured if TEST-AND-SET instruction is not atomic?
asked Feb 28, 2018 in Operating System jothee 1.1k views
20 votes
3 answers
The following solution to the single producer single consumer problem uses semaphores for synchronization. #define BUFFSIZE 100 buffer buf[BUFFSIZE]; int first = last = 0; semaphore b_full = 0; semaphore b_empty = BUFFSIZE void producer() { while(1) { produce an ... $p2$, immediately after $c1$ and immediately before $c2$ so that the program works correctly for multiple producers and consumers.
asked Sep 16, 2014 in Operating System Kathleen 2.5k views
26 votes
3 answers
A computer uses $32-bit$ virtual address, and $32-bit$ physical address. The physical memory is byte addressable, and the page size is $4$ $\text{kbytes}$ . It is decided to use two level page tables to translate from virtual address to physical ... entries that can be contained in each page? How many bits are available for storing protection and other information in each page table entry?
asked Sep 16, 2014 in Operating System Kathleen 4.8k views
20 votes
3 answers
The C language is: A context free language A context sensitive language A regular language Parsable fully only by a Turing machine
asked Sep 16, 2014 in Programming Kathleen 4.1k views