In the MTX kernel, a process gives up CPU by calling tswitch(). Since this is a function call, it is unnecessary to save all the CPU registers. For instance, it is clearly unnecessary to save and...



In the MTX kernel, a process gives up CPU by calling tswitch(). Since this is


a function call, it is unnecessary to save all the CPU registers. For instance, it


is clearly unnecessary to save and restore the AX register. Assume: tswitch() is


modified as follows.


_tswitch:


SAVE: push bp ! save bp only


mov bx,_running


mov 2[bx], sp


FIND: call _scheduler RESUME:


(1). Write assembly code for the RESUME part of the modified tswitch().


(2). Corresponding to this tswitch(), show how to initialize the kernel stack of a


new process to let it resume to the body() function. Test MTX with the modified


tswitch().


(3). Delete the “push bp” instruction. Repeat (2) and (3). Does MTX still work?


(4). Why is it necessary to save the bp register of a process? (HINT:stack frames)

Nov 19, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers