Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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) 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started