📄 text_a1.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0041)http://www.cs.iit.edu/~sun/html/t_a1.html -->
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META http-equiv=Content-Type <title></TITLE>
<META content="MSHTML 6.00.2900.2627" name=GENERATOR></HEAD>
<BODY background=text_a1.files/test_bg.gif>
<P align=center><FONT size=4>CSC 4103 - Operating System</FONT></P>
<P align=center><FONT size=4>Dr. Xian-He Sun</FONT></P>
<P align=center><FONT size=4>Answer of Sample Exam #1 </FONT></P>
<P>Name ___________________________________( Last, First )</P>
<P>Score _________________________ (100 pts.)</P>
<P>Make sure there are ten problems. Read each problem very carefully before
answering it. Try to make your answer short and clear.</P>
<P>1. Define operating systems in terms of what they do? (5 pts.)</P>
<P>Their primary goal is convenience of the user; the secondary goal is
efficient operation and allocation of all resources.</P>
<P>2. What is process? (5 pts.)</P>
<P>A program in execution.</P>
<P>3. How is an interrupt executed? (5 pts.)</P>
<P>The I/O driver send a signal through a special interrupt line to the CPU when
it has finished with an I/O request.</P>
<P>4. What are the five major intellectual achievement of OS development? (5
pts.)</P>
<P>Process, Memory management, Information protection and security, Scheduling
and resource management, System structure</P>
<P>5.What is multiprogramming? (5 pts.)</P>
<P>In multiprogramming, several programs are in memory concurrently; the system
switches among the programs for efficient processing, and minimal idle time.</P>
<P>6. Define the difference between preemptive and nonpreemptive scheduling? (6
pts.)</P>
<P>Preemptive scheduling allows a process to be interrupted in the midst of its
execution, taking the CPU away and allocating it to another process.
Nonpreemptive scheduling ensures that a process relinquishes control of the CPU
only when it finishes with its current CPU burst.</P>
<P>7. What is FCFS? What is SJF? What is RR? ( 9pts.)</P>
<P>First-Come-First-Serve, Shortest Job First, Round-Robin</P>
<P>8. Semaphore is a tool of process synchronization. Critical region is a
high-level language construct for process synchronization. Transform the 'wait'
and 'signal' operation on a semaphore 'S' into equivalent critical regions
without busy waiting. (20 pts.)</P>
<P>This problem is a part of Homework 6.9</P>
<P>Wait(S): <B>Region </B>S <B>when</B> S>0 <B>do</B> S := S - 1 </P>
<P>Signal(S): <B>Region </B>S <B>do</B> S := S +1;</P>
<P>9. Consider the following snapshot of a system answer the following questions
using the banker's algorithm </P>
<P>( show your work, 20 pts.)</P>
<DIV align=center>
<CENTER>
<TABLE cellSpacing=0 cellPadding=0 border=1>
<TBODY>
<TR>
<TD>
<P align=center>Process </P></TD>
<TD>
<P align=center>Allocation </P></TD>
<TD>
<P align=center>Max </P></TD>
<TD>
<P align=center>Available </P></TD></TR>
<TR>
<TD> </TD>
<TD>
<P align=center>A B C D </P></TD>
<TD>
<P align=center>A B C D </P></TD>
<TD>
<P align=center>A B C D </P></TD></TR>
<TR>
<TD>
<P align=center>P1 </P></TD>
<TD>
<P align=center>0 0 1 2 </P></TD>
<TD>
<P align=center>0 0 1 2 </P></TD>
<TD>
<P align=center>1 5 2 0 </P></TD></TR>
<TR>
<TD>
<P align=center>P2 </P></TD>
<TD>
<P align=center>1 3 5 4 </P></TD>
<TD>
<P align=center>2 3 5 6 </P></TD>
<TD> </TD></TR>
<TR>
<TD>
<P align=center>P3 </P></TD>
<TD>
<P align=center>0 6 3 2 </P></TD>
<TD>
<P align=center>0 6 5 2 </P></TD>
<TD> </TD></TR>
<TR>
<TD>
<P align=center>P4 </P></TD>
<TD>
<P align=center>1 0 0 0 </P></TD>
<TD>
<P align=center>1 7 5 0 </P></TD>
<TD> </TD></TR>
<TR>
<TD>
<P align=center>P5 </P></TD>
<TD>
<P align=center>0 0 1 4 </P></TD>
<TD>
<P align=center>0 6 5 6 </P></TD>
<TD> </TD></TR></TBODY></TABLE></CENTER></DIV>
<P>(a) Is the system in a safe state?</P>
<P>(b) If a request from process P4 arrives for (0, 4, 2, 0) can the request be
granted immediately?</P>
<P>See homework 7.11</P>
<P>10. Mutual exclusion can be provided by using <B>Lock</B> and<B> Unlock</B>
functions as follows</P>
<P align=center><B>Lock</B>(gate);</P>
<P align=center>critical section;</P>
<P align=center><B>Unlock</B>(gate);</P>
<P>(a) Use hardware instruction <B><I>Swap</I></B><I> </I>to implement the
function <B>Lock</B> and <B>Unlock</B>. (15 pts.)</P>
<P>(b) Does your implementation satisfy the <B><I>Bounded Waiting</I></B>
requirement? If it does not, give a solution which satisfies this requirement.
(10 pts.)</P>
<P>See figure 6.7 and 6.8 of the text.</P></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -