Question: Question 3 . In this question, events are given during the execution of a grading program. You are supposed to understand the process state transition

Question 3. In this question, events are given during the execution of a grading program. You are supposed to understand the process state transition and fill out those blanks and choose the right options. Hint: state transition occurs when some particular events happen. Please use one of ready, running, blocked states as the possible state for the process. When you need to determine the running mode, please use either user or kernel. [Please check and understand these concepts through reading either from the slides or textbook][40 points: two for each cell in the answer table]
int exam_grade (int m1, int m2, int m3)
{
int exam_sum;
exam_sum =0.3*m1+0.5*m2+0.2*m3;
return exam_sum;
}
-- Event: user runs the program, the process is in _____ state (Q1).
main ()
{
-- Event: when scheduler chooses this program to run, the process is in ____________state (Q2) and in ____________ mode (Q3)
for (i=1; i<=24; i++)
{ scanf ("%d %d %d", &t1, &t2, &t3);
-- Event: I/O statement, the process is in __________ state (Q4).
Before state transition, switch to __________ mode (Q5)to handle scanf.
Q6, in the multiprogramming environment, will the OS switch to execute another process? Yes [] No []
-- Event: I/O is done, I/O device sends an interrupt. Interrupt makes the current running process stops temporarily. CPU switches to interrupt handler and this process is put to __________ state(Q7). CPU continues to execute the original running process (we are assuming non-preemptive scheduling is used)
-- Event: scheduled to run This process runs. (There is a context switch)
scanf ("%d %d %d ", &P1, &P2, &P3);
scanf ("%d %d %d", &m1, &m2, &m3);
scanf ("%d %d %d %d", &h1, &h2, &h3, &h4);
-- Event: I/O statement, the process is in ____________ state (Q8).
-- Event: I/O completion, the process is in ___________ state (Q9).
-- Event: scheduled to run running (context switch)
Project_total =(P1+P2+P3);
Homework_total =(h1+h2+h3+h4)/4;
Exam_total = exam_grade(m1, m2, m3);
-- Event: procedure call, the process is in _______ state (Q10) and
the program is in ________ mode (Q11).
total1=(t1+t2+t3)*0.1+Project_total*0.50+ Homework_total*0.1+ Exam_total*0.3);
-- Event: interrupted due to time quantum expiration, the state of the process will be changed from __________state (Q12) to ____________state (Q13), before the transition, the CPU will handle the timeout and switch to execute another process (context switch)
-- Event: scheduled to run, the state of process will be changed from __________state (Q14) to ___________state (Q15)(context switch)
total2= scale_the_grade(Project_total, Homework_total, m1, m2, m3);
if (total1> total2) total = total1;
else total = total2;
-- Event: I/O device interrupts to signal the completion of an I/O of a different process
Switch to _______ mode (Q16) to run interrupt handler (context switch), the current process is in ___________ state (Q17).
Switch back to run this process in ______ mode(Q18)
if (extra =0) final = total;
else final =(float) Bonus(total, extra);
printf ("%.1f ", final);
scanf ("%c", &ch); printf ("
");
}
fork ();
-- Event: system call
Kernel trap, switch to kernel mode to handle fork (context switch)
OS creates the child process, put it in ___________ queue (Q19)
}
Fill the answers into the following table. Please utilize the following options for process states: 'ready,' 'running,' and 'waiting.' When referring to mode, choose between 'user mode' and 'kernel mode.' For events, consider using terms such as "interrupt," 'CPU scheduled,''I/O request,''I/O completion,' 'system call,' etc.
Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 Q9 Q10
Q11 Q12 Q13 Q14 Q15 Q16 Q17 Q18 Q19

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!