To Operating System for Sys. Adamin.
Question 1: Briefly explaining WHAT CONDITIONS cause a process to move between each
of the following 3 states indicated by each arrow (from 1 to 6). Label it N/A if it doesn’t
happen. [5 points]
1
Running
2
Ready
3
5
4
6
Waiting
Question 2. 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.
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
main ()
{
Q1_______
-- Event: when the following condition occurs _________ →
process is in running state and
the program is in
user
kernel mode. (
right mode from the above options)
Q3,
state.
Q2,
the
please choose the
for (i=1; i 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
user
kernel mode to run interrupt
handler (context switch) (
the above options).
state.
Q13,
Q12,
please check the correct one from
the current process is in ___________
→ Switch back to run this process in _________ mode
(context switch)
if (extra = 0) final = total;
else final = (float) Bonus(total, extra);
printf (" %.1f ", final);
scanf ("%c", &ch); printf ("\n");
}
fork ();
-- Event: system call
→ Kernel trap, switch to kernel mode to handle fork
(context switch)
Q14,
OS creates the child process, put it in ___________ queue
}
Please fill the answer into the following table, for the process states, please consider
‘ready’, ‘running’, ‘blocked’, for the mode, please consider ‘user mode’ and ‘kernel
mode’, for the events, please consider “interrupt”, ‘cpu scheduled’, ‘i/o request’, ‘i/o
completion’, ‘system call’.
Q1
Q2
Q3
Q4
Q5
Q6
Q7
Q8
Q9
Q10
Q11
Q12
Q13
Q14
Question 3. Case study, in this task, you need to study a process state transition for
any real system (linux, wondows, mac, android, ios, etc.). What you need to do is
draw the process state transition diagram and describe the conditions for every
transition.
To Operating System for Sys. Adamin.
Question 1: Briefly explaining WHAT CONDITIONS cause a process to move between each
of the following 3 states indicated by each arrow (from 1 to 6). Label it N/A if it doesn’t
happen. [5 points]
1
Running
2
Ready
3
5
4
6
Waiting
Question 2. 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.
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
main ()
{
Q1_______
-- Event: when the following condition occurs _________ →
process is in running state and
the program is in
user
kernel mode. (
right mode from the above options)
Q3,
state.
Q2,
the
please choose the
for (i=1; i 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
user
kernel mode to run interrupt
handler (context switch) (
the above options).
state.
Q13,
Q12,
please check the correct one from
the current process is in ___________
→ Switch back to run this process in _________ mode
(context switch)
if (extra = 0) final = total;
else final = (float) Bonus(total, extra);
printf (" %.1f ", final);
scanf ("%c", &ch); printf ("\n");
}
fork ();
-- Event: system call
→ Kernel trap, switch to kernel mode to handle fork
(context switch)
Q14,
OS creates the child process, put it in ___________ queue
}
Please fill the answer into the following table, for the process states, please consider
‘ready’, ‘running’, ‘blocked’, for the mode, please consider ‘user mode’ and ‘kernel
mode’, for the events, please consider “interrupt”, ‘cpu scheduled’, ‘i/o request’, ‘i/o
completion’, ‘system call’.
Q1
Q2
Q3
Q4
Q5
Q6
Q7
Q8
Q9
Q10
Q11
Q12
Q13
Q14
Question 3. Case study, in this task, you need to study a process state transition for
any real system (linux, wondows, mac, android, ios, etc.). What you need to do is
draw the process state transition diagram and describe the conditions for every
transition.
Purchase answer to see full
attachment