It is a test so I don't have any files to upload. The test will only have questions on XINU programming. XINU needs to be installed first and the programming questions need to be answered.

1 answer below »
It is a test so I don't have any files to upload. The test will only have questions on XINU programming. XINU needs to be installed first and the programming questions need to be answered.
Answered Same DayFeb 11, 2021

Answer To: It is a test so I don't have any files to upload. The test will only have questions on XINU...

Piyush answered on Feb 19 2021
116 Votes
cfile_c_636861270682646333_36788_1.docx
Midterm Exam
Question 1:
The main function above creates five processes with equal priorities. Main function itself has the same priority.

A) Assuming that all of these processes are running some CPU-intensive jobs that are long enough to take at least several seconds; indicate the context switches that will have taken place un
til the return statement in main gets executed.
Solution:
· Main process is running
Context switch from ……main…….. to ……p1…….
· P1 is running
Context switch from ……p1…….. to ……p2…….
· P2 is running
Context switch from ……p2…….. to ……p3…….
· P3 is running
Context switch from ………p3….. to ……p4…….
· P4 is running
Context switch from ……p4…….. to ……p5…….
· P5 is running
Context switch from ……p5…….. to ……p1…….
· P1 is running again and finishes its job.
Context switch from ……p1…….. to ……p2…….
· P2 is running.
Context switch from ………p2….. to ……p3…….
· P3 is running.
Context switch from ……p3…….. to ……p4…….
· P4 is running.
Context switch from ……p4…….. to ……p5…….
· P5 is running
Context switch from ……p5…….. to ………p2….
· P2 is running and finishes its job
Context switch from ……p2…….. to ……p3…….
· P3 is running and finishes its job
Context switch from ……p3…….. to ……p4…….
· P4 is running and finishes its job
Context switch from ……p4 …….. to ………p5….
· P5 is running and finishes its job and finally transfers the control to parent process main.
Context switch from ……p5…….. to ……main…….
· Main returns and finishes the task.
B) Fill in the proctab and queuetab given below after the main function has exited and the next process has just returned from its resched call (you should be able to tell which one this will be).
You can show only the process state on the proctab.
Assume that the “main” process is out of the picture now. So, P1 has pid 1 and process 2 has pid 2 and process i has pid i.
For parts (B, C, and D), only fill in the places that can be determined by the given information.
where “queuetab” used in this question looks like
        Process ID
        Key/priority
        Next
        Previous
where “procetab” looks like
        Process ID
        State
C) Now, assume that the process that has just returned from its resched in B, executed the following statement,
resume ( create ( p6 , 1024 , 40 , "p6" , 0 ));
where p6 has been defined as
This resume will result in a context switch to p6 since it has a higher priority. Now, show the proctab and queuetab again right after the next process starts its execution as a result of the suspend call in p6 (you should be able to tell which one will run next from your queutab), while still assuming that none of the processes created in main has exited.
Hint: the table below should reflect the status after the suspension of P6. So, another process should be CURR.
D) Now, assume that the process that has just returned from its resched in C, executed the following statements,
where p7 is defined as
This resume will result in a context switch to p7 since it has a higher priority. Now, show the proctab and queuetab again right after the next process starts its execution as a result of the wait call in p7 still assuming that none of the processes created so far has exited.
Hint: the table below should reflect the status after the waiting of P7. So, another process should be CURR.
Question 2:
For this question, it is required to add new commands to the Xinu shell.
The steps to follow for addıng a new Shell command.
1. Add a new file called shell/xsh XXX.c, where XXX is the name of your shell command. This file should be structured as follows:
/* xsh_XXX.c - xshXXX*/
#include ...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here