Insight on these questions would be greatly appreciated. Would like to know if I
ID: 3845117 • Letter: I
Question
Insight on these questions would be greatly appreciated. Would like to know if I am correct.
D Question 1 12.5 pts During a he kernel saves the context of the old process and loads the context of the new process ready to run context switch D Question 2 12.5 pts Two processes. A and B, are running on a system. Process A runs on the CPU and makes a blocking readU system call. While the l O operation is pending, the OS schedules process B that runs until the CPU is interrupted by the HDD controller indicating A's l/o d operation has completed. Then, the OS schedules ba A to run on the CPU. Indicate the correct order in which the following operations were pertormed rea by the OS from when process A was running add CPU state from PCBB save CPU state into PCBA load CPU state from PCBA save CPU state into PCBBExplanation / Answer
The image is not very clear but still some questions are readable. Here you go with the insight:
1) Context Switch, that is correct. When CPU actually switches to another process, the system has to save the data of the old process and load the data for new process, that is context switching only.
2) While A process was already running, and as it makes a blocking read() system call the state of PCBA will be saved first and then load the state of PCBB, now, A has completed it's operation so we will save the state of PCBB and load PCBA. Hence, the order is:
save CPU state into PCBA
load CPU state from PCBB
save CPU state into PCBB
load CPU state from PCBA
3) Rendezvous is also caleed as synchronous message passing, in this the processes halt at a point and exchange information. It can happen when process run independently up until that point, exchange data at the rendezvous point and then continue independently after that point. So, your options seems corrent to me.
4) True is the right option. How? The ready queue actually contains all the processes that are waiting to be scheduled on a CPU and which are not waiting for any sort of I/O operations, as we have all the I/O bound processes then all the process will be schedule and waiting for I/O and ready queue will be almost empty.
5) fork() is used to create a new process and newly created becomes the child of the calling process. first fork() will create 1 child process and second fork() will create 2 child processes, in total 3.
The total number of processes is however given by 2n and if we subtract 1 (the parent process) then the answer should be 3.
6) The process memory structure basically includes: text segment, initialized data, uninitialized data, stack and heap. So, I guess your answer is right.
7) The text is not very clear,I am not able to read the complete question but I am trying to rule out the option.No process starts from running state hence, it needs to be created first i.e. new --> read and waiting for the read. So, option B is gone. Then it has to terminate hence option A is gone. I can see there is no ready after waiting(read) in D, hence it is also gone. Option C should be the correct choice.
8) There is no figure provided, not the text is very clear.
I hope I was able to satisfy you, if you have any doubts let me know in the comments !