Question: This is the program I am working with Follow the example for process state transitions, add the events that occur during execution (in addition to
This is the program I am working with

Follow the example for process state transitions, add the events that occur during execution (in addition to the ones that are given). ONLY IN THE AREA WITH THE "?" question mark
-- Event: user runs the program ready
Program P;
-- Event: scheduled to run running (context switch)
read (x);
-- Event: I/O statement blocked
Switch to execute another process (context switch)
-- Event: scheduled to run running (context switch)
compute factorial of x;
print (x);
-- Event: ?
-- Event: ?
pid = fork ();
-- Event: system call Blocked
Switch to kernel mode to handle fork (context switch)
OS creates the child process, put it in ready queue
Switch back to run parent process in user mode (context switch)
if (pid == 0)
-- Event: Event: scheduled to run childe process running (context switch)
{ read (y);
-- Event: ?
-- Event: scheduled to run running (context switch)
compute factorial of y;
print (y);
-- Event: I/O statement blocked
Before blocked, switch to kernel mode to handle read
Switch to execute another process (context switch)
-- Event: scheduled to run running (context switch)
Child process terminates, switch to another process
else /* parent process */
wait (pid);
-- Event: ?
-- while waiting, child processs read (y) is done
-- Event: CPU switches to interrupt handler and put child process in ready state
-- while waiting, child processs print (y) is done
-- Event: ?
-- Event: user runs the program ready
Program Q;
-- Event: scheduled to run running (context switch)
initialize matrix A using random number generator;
-- I/O interrupt: Ps read (x) operation is done
-- Event: CPU switches to interrupt handler and put P in ready state
-- Event: CPU continue to execute the original running process
initialize matrix B using random number generator;
-- I/O interrupt: Ps print (x) operation is done
-- Event: ?
-- Event: ?
create a thread to compute A*B;
-- Event: Nothing, since it is a user level thread
}
please help there are 7 question marks
Program P: read(x); compute factorial of x; print(x); pid = fork(); if (pid == 0) read(y); compute factorial of y; print(y): else /* parent process * wait (pid); -- while waiting, child process's "read (y)" is done -- while waiting, child process's "print (y)" is done Program Q: initialize matrix A using random number generator; -- I/O interrupt: P's "read (x)" operation is done initialize matrix B using random number generator; -- I/O interrupt: P's "print (x)" operation is done create a thread to compute A B; } Program P: read(x); compute factorial of x; print(x); pid = fork(); if (pid == 0) read(y); compute factorial of y; print(y): else /* parent process * wait (pid); -- while waiting, child process's "read (y)" is done -- while waiting, child process's "print (y)" is done Program Q: initialize matrix A using random number generator; -- I/O interrupt: P's "read (x)" operation is done initialize matrix B using random number generator; -- I/O interrupt: P's "print (x)" operation is done create a thread to compute A B; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
