Introduction to Computer (NTU, Fall 2015)
Homework 3 Answer
The following questions are from “Chapter 3 review problem” in “Computer Science: An Overview”, 12th Edition by J. Glenn Brookshear.
1. List four activities of a typical operating system.
1. Memory Organization
2. File System (and disk) management
3. Program execution + Multitasking (in modern OSs) 4. Hardware detection and management
5. User interface
5. What is a real-time operating system?
Performing the task in accordance with deadlines in its (external real-world) environment.
8. a. What is the role of the user interface of an operating system?
Handling the communication between users and operation system.
b. What is the role of the kernel of an operating system?
Containing the software components (e.g. file manager, device drivers & memory manager) that perform the basic functions required by the computer installation.
11. What is the Linux or UNIX command for creating new processes?
fork
12. What is the difference between a process that is ready and a process that is waiting?
Ready: Process can continue.
Wait: Process should wait some events and then continue.
13. What is the difference between virtual memory and main memory?
Virtual memory: A large “fictional” memory space created by paging.
Main memory: Real memory unit.
18. What is a context switch?
The procedure of changing from one process to another one, which is managed by dispatcher.
Introduction to Computer (NTU, Fall 2015)
25. A process is said to be I/O-bound if it requires a lot of I/O operations, whereas a process that consists of mostly computations within the CPU/memory system is said to be compute-bound. If both a compute-bound process and an I/O-bound process are waiting for a time slice, which should be given priority? Why?
以不同角度來看,我想兩個答案都是正確的,如有達到某些 point 的話就能拿到全部分數。
[1] The compute-bound process. A time slice is a slice of processor time. A compute-bound process is constrained by processor time and needs it to perform properly. An I/O bound process is not constrained by its access to processor time.
[2] The I/O-bound process. This allows the controllers to start with the I/O activities. Then the compute-bound process can run while the other is waiting for these slower activities (I/O-bound process) to take place. As a general rule of thumb, priority should be given to the slower activity.
33. Explain an important use for the test-and-set instruction found in many machine languages.
Why is it important for the entire test-and-set process to be implemented as a single instruction?
CPU always completes an instruction before recognizing an interrupt, the task of testing and setting the flag cannot be split when it is implemented as a single instruction
51. What are the conditions that lead to a deadlock?
[Textbook]
1. There is competition for nonsharable resources.
2. The resources are requested on a partial basis; that is, having received some resources, a process will return later to request more.
3. Once a resource has been allocated, it cannot be forcibly retrieved.
[Google]
1. Mutual Exclusion 2. Hold and Wait 3. No Preemption 4. Circular Wait