作者newacc (XD)
看板NTU-Exam
標題[試題] 101下 陳建錦 作業系統 期中考
時間Thu Apr 25 20:28:40 2013
課程名稱︰作業系統
課程性質︰必修
課程教師︰陳建錦
開課學院:管院
開課系所︰資管系
考試日期(年月日)︰2013/4/16
考試時限(分鐘):3hr
是否需發放獎勵金:是,謝謝
試題 :
Operating Systems - Midterm Examination
April 16, 2013 Total: 101 points
1. Hardware devices signal interrupts when important events occur (e.g.,
hard-disk data are available):
(a) (5 points) Show the advantage of interrupt-based operations over
busy-waiting.
(b) (10 points) Describe the process of hardware interrupt handling. You
need to mention device controller, interrupt-request line, state saving,
interrupt vector, interrupt-specific handler.
2. (5 points) What role do device controllers and device drivers play in a
computer system?
3. (10 points) What is the dual-mode operation and how does it ensure the
proper execution of the operating system?
4. System calls:
(a) (10 points) How does an API function invoke a system call? You need to
mention software interrupt, dual-mode, system call number (index), and
table of code pointer.
(b) (5 points) Explain why programs mostly access system services via API
functions rather than making system call directly.
(c) (5 points) Describe an appropriate method used to pass "MANY"
parameters to the operating system during system calls.
5. (5 points) What are the advantages of the modular kernel approach over the
layered and microkernel design techniques?
6. Show the state of a process:
(a) (3 points) after it is selected by a long-term scheduler
(b) (3 points) before it is selected by a short-term scheduler
(c) (3 points) after it is selected by a short-term scheduler
(d) (3 points) before it invokes a blocking system call
(e) (3 points) after it invokes a blocking system call
(f) (3 points) after the blocking system call is complete
(g) (3 points) after it is interrupted by a hardware interrupt
7. Multithread model:
(a) (5 points) Describe the pros and cons of the many-to-one thread model.
(b) (5 points) Describe the pros and cons of the one-to-one thread model.
8. (15 points) Complete the following C++ program which serves as a simple
shell interface. The shell accepts user commands and the executes each
command in a separate process. The shell allows the child process to run
in the background (or concurrently) if the command ends with '&'. For
simplicity, we assume that users never enter invalid commands and no
arguments follow a command.
int main(void)
{
char inputBuffer[80]; // buffer to hold command entered
bool background; // true if a command is followed by '&'
while (_)
{
cout << endl << " COMMAND->" ;
pid_t pid;
// step 1
// accept user command and check if the command is
// followed by '&'
________
// step 2
// fork a child process, if background == false,
// the parent will wait
// the childe process invoke exec(inputBuffer) to
// execute user command
________
} // end of while
} // end of main
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.243.213