hw1 Reference
hw1 Reference
U3680
National Taipei University
• Control the executions of user programs and operations of I/O devices to prevent errors and
improper use of the computer (Control, 5%)
• Manage and allocate resources to ensure efficiency and fairness (Coordinate, 5%)
2. Describe why modern computers need interrupts to communicate with devices. (10%)
Most devices are slow compared to the CPU (2%). Interrupts provide an event-driven way to
change the control flow in the CPU, so it doesn’t have to be busy waiting. (8%)
d → g → a → e → b → f → c (10%)
4. Describe the two problems of batch systems. How do later computer systems address these two
problems? (10%)
• Batch systems can only do one job at a time. Thus, the CPU is often idle (2%). Multi-
programming addresses this issue by putting multiple programs in memory. OS can organize
the jobs so that the CPU always has one job to execute (3%).
• No interaction between users and jobs (2%). Time-sharing addresses this problem by dividing
CPU resources into time slots. CPU can switch jobs frequently so that users can interact
with each job while running (3%).
5. Describe why application programming interface (API) can improve portability. (10%)
Different OSes share the same programming interface despite the underlying implementation or
hardware being different. For this reason, when a program needs to be run on a different OS, it
just needs re-compiling, not re-writing. (10%)
6. What are the advantages and disadvantages of the micro-kernel approach for the OS design?
(10%)
Operating Systems 2024 Homework Assignments 2
• Advantages: safer, less possible to crash (3%), modulation (2%), easy to extend, easier for
porting (2%)
• Disadvantage: slow (3%)
7. What are the two major concerns of a layered architecture for the OS design? (10%)
8. Why running a program in a virtual machine is usually slower than in the original OS? (10%)
A virtual machine is less efficient because running privileged instructions requires two interrupts:
one on the virtual OS (fail) and another on the main OS (success). (10%)
9. Draw the process state diagram (10%) and briefly describe the meaning of each state. (10%)