Question: Make a context switching operating system. To do this, we switch between three processes . These are subroutines that do different things within our system.
Make a context switching operating system.
To do this, we switch between three processes These are subroutines that do different things within our system. For us they will just print Process Process and Process though you could be more creative if you want, and prints some value that is stored in a register. This register must be reused in all your processes to show that it has been restored.
The only interrupt that LC provides us is keyboard, so any input from the keyboard will cause the program to switch which process is running.
To do this, you need to have a process control block for each of your processes. This holds metadata about your process, which allows us to restore it
fill process ; the struct for the thread is address of the code
fill x ; and the current count
fill x ; this PSR
fill x ; their R
You will need one of these for each process, then create an array of process control blocks.
When an interrupt is received, you must store the current process state, and restore the state of the next process.
This all prints out very fast! Put a sleep in your processes to stop them from printing so quickly
and RR#
sleeploop
add RR#
brnp sleeploop
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
