Assignment must use the xinu library here: https://github.com/xinu-os/xinu Question 1: (85 points/100) In this question, you are required to simulate the starving problem that a process may suffer if...

1 answer below »

Assignment must use the xinu library here:
https://github.com/xinu-os/xinu




Question 1: (85 points/100)


In this question, you are required to simulate the starving problem that a process may suffer if all other processes in the system have higher priority than its priority.


It is required to create at least two processes (P1 and P2) with priorities 40 and 35 for example. You should create a third process (Pstarv) with less priority such as 25.


You need to put P1 and P2 in the sleep state every couple of seconds to simulate a context switch between P1 and P2. When P1 sleeps, P2 will run and when P2 sleeps, P1 will run. Until now, Pstarv will not be able to run since its priority is the lowest priority. You need to fix that. You are required to change/update/increase the priority of Pstarv each time a context switch occurs.


So, after a number of context switches, Pstarv will finally be able to run to print its ID and print a celebration message that it is finally running and celebrate that you will get a good grade as well.


Feel free to assume any missing information such as should you have a flag or an argument to decide which process you are interested to avoid starvation, should you use shell commands or not, should you increase the Pstarv priority by 1 or by 5…..… etc.


P1 and P2 are not supposed to know anything about the Pstarv process. Do not hardcode it inside P1 or P2. So, you should not include the code of increasing the Pstarv priority in P1 nor P2.




Question 2: (15 points/100)


You can think of the starvation problem in Question 1 but instead of incrementing the priority of the Pstarv every time a context switch occurs, the priority increment of Pstarv should occur every two seconds the Pstarv process is in the ready queue without getting the CPU while another CPU bound process should reduce its priority by dividing its priority by two each second. CPU bound process is the process that uses up its quantum completely. Whenever we find that we are at the end of a timeslice, we should set the cpu usage flag for the current process to CPU ALL to represent CPU bound process. By using this technique and after a few seconds, Pstarv priority will increase and other CPU bound processes priority will decrease to the point that Pstarv will be able to run.



Answered 452 days AfterMar 20, 2021

Answer To: Assignment must use the xinu library here: https://github.com/xinu-os/xinu Question 1: (85...

Jahir Abbas answered on Jun 16 2022
90 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here