In: Computer Science
For each time 2, 4, 8 and 16, identify which state process is in. If a process is blocked, further identify the event on which is it blocked.
in Operating System
At time 2: P0 is ready.
Above statement means that P0 is newly created process which is in READY state.In Ready state,system is in main memory.
At time 4: P0 is selected by CPU scheduler
Above statement means that P0 is being scheduled by CPU scheduler.now,if we ignore context switching time then as soon as process is scheduled it starts its execution in processor.so,At time 4 , P0 is in RUN state.In RUN state,process P0 is residing in Processor.if system is uniprocessor then there will be only one process at a time in RUN state.
At time 8: P0 executes a command to read from disk 0
From above we can conclude then from time= 4 to time = 8 process P0 was executing in processor.however,at time = 4,P0 needs to read a disk 0.so,due to this , process moves from RUN to BLOCK state.In Block state,process reside in main memory. P0 was blocked when P0 executes a command to read from disk 0(required event)
At time 16: An interrupt occurs from disk unit 0: P0's read is complete.
From above statement,we can conclude that from time = 8 to time = 16,process P0 was in BLOCK state executing a read operation on disk.At time = 16,its I/O is complete so disk will generate interrupt indicating completion of its I/O.assuming,there is no delay in responding interrupt,process P0 moves to READY state.since,it is in READY state,process P0 is residing in main memory.