Question: There are two programs in execution (process A and process B) on a single CPU system. The following figure represents the machine state right after

 There are two programs in execution (process A and process B)

There are two programs in execution (process A and process B) on a single CPU system. The following figure represents the machine state right after the execution of the statement "me = getpid ()" on Process A, and the CPU is about to execute a user-space subroutine yield (B). Explain and draw what machine state changes will be made right after the call instruction to the subroutine yield (B) on Process A. Note that you are not asked to simulate the entire execution of yield) routine, but you are simply asked to simulate just a call instruction to subroutine yield (B). You must show changes in PC, SP, and user stack area for Process A Process A Process B stack stack return address- Pointer to previous AR p: A magic : 1 PC SP me: A me: B main ) main ) text! me-getpid) yield (B) yield (A); me getpid ( ) yield (A) yield (A); Shared mamory A. Context yield (process *p) yield (process *p) PC int magic 0; saveContext (me) if (magic1) int magic 0; saveContext (me) SP - ->if (magic return: 1) "" return: B. Context else else PC-- magic 1; restoreContext (p) magic-l: restoreContext (p) SP There are two programs in execution (process A and process B) on a single CPU system. The following figure represents the machine state right after the execution of the statement "me = getpid ()" on Process A, and the CPU is about to execute a user-space subroutine yield (B). Explain and draw what machine state changes will be made right after the call instruction to the subroutine yield (B) on Process A. Note that you are not asked to simulate the entire execution of yield) routine, but you are simply asked to simulate just a call instruction to subroutine yield (B). You must show changes in PC, SP, and user stack area for Process A Process A Process B stack stack return address- Pointer to previous AR p: A magic : 1 PC SP me: A me: B main ) main ) text! me-getpid) yield (B) yield (A); me getpid ( ) yield (A) yield (A); Shared mamory A. Context yield (process *p) yield (process *p) PC int magic 0; saveContext (me) if (magic1) int magic 0; saveContext (me) SP - ->if (magic return: 1) "" return: B. Context else else PC-- magic 1; restoreContext (p) magic-l: restoreContext (p) SP

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!