Chapter 7 Operating Systems
By 黄永平,权勇,孙永雄,王智,丰小月,孙铭会
Knowledge point:
7.1. the definition of an operating system 7.2. the components of an operating system 7.3. Memory Manager 7.4. Process manager 7.5. deadlock
Multiple-Choice Questions:
21. is a program that facilitates the execution of other programs.(7.1) a. An operating system b. Hardware c. A queue
d. An application program
22. supervises the activity of each component in a computer system. (7.1) a. An operating system b. Hardware c. A queue
d. An application program
23. The earliest operating system, called operating systems, only had to ensure that resources were transferred from one job to the next. (7.1) a. batch
b. time-sharing c. personal d. parallel
24. A operating system is needed for jobs shared between distant connected computers. (7.1) a. batch
b. time-sharing c. parallel d. distributed
25. Multiprogramming requires a operating system. (7.1) a. batch b. time-sharing c. parallel d. distributed
26. DOS is considered a operating system. (7.1) a. batch
b. time-sharing
c. parallel d. personal
27. A system with more than one CPU requires aoperating system. (7.1) a. batch
b. time-sharing c. parallel
d. distributed
28. is multiprogramming with swapping. (7.3) a. Partitioning b. Paging
c. Demand paging d. Queuing
29. is multiprogramming without swapping. (7.3) a. Partitioning b. Paging
c. Demand paging d. Queuing
30. In , only one program can reside in memory for execution. (7.3) a. monoprogramming b. multiprogramming c. partitioning d. paging
31. is a multiprogramming method in which multiple programs are entirely in memory with each program occupying a contiguous space. (7.3) a. Partitioning b. Paging
c. Demand paging
d. Demand segmentation
32. In paging, a program is divided into equally sized sections called . (7.3) a. pages b. frames c. segments d. partitions
33. In , the program can be divided into differently sized sections. (7.3) a. partitioning b. paging
c. demand paging d. demand segmentation
34. In , the program can be divided into equally sized sections called pages, but the pages need not be in memory at the same time for execution. (7.3) a. partitioning b. paging c. demand paging
d. demand segmentation
35. A process in the state can go to either the ready, terminated, or waiting state. (7.4) a. hold b. virtual c. running d. a and c
36. A process in the ready state goes to the running state when . (7.4) a. it enters memory b. it requires I/O
c. it gets access to the CPU d. it finishes running
37. A program becomes a when it is selected by the operating system and brought to the hold state. (7.4) a. job
b. process c. deadlock d. partition
38. Every process is a . (7.4) a. job
b. program c. partition d. a and b
39. The scheduler creates a process from a job and changes a process back to a job. (7.4) a. job
b. process c. virtual d. queue
40. The scheduler moves a process from one process state to another. (7.4) a. job b. process c. virtual d. queue
41. To prevent , an operating system can put resource restrictions on processes. (7.5) a. starvation
b. synchronization c. paging d. deadlock
42. can occur if a process has too many resource restrictions. (7.4) a. Starvation
b. Synchronization c. Paging d. Deadlock
43. The manager is responsible for archiving and backup. (7.2)
a. memory b. process c. device d. file
44. The manager is responsible for access to I/O devices. (7.2) a. memory b. process c. device d. file
45. The job scheduler and the process scheduler are under the control of the manager. (7.4) a. memory b. process c. device d. file
Review questions:
4. What are the components of an operating system? (7.2)
Answer: An operating system includes: Memory Manager, Process Manager, Device Manager and File Manager
13. What kinds of states can a process be in? (7.4) Answer: ready state, running state, waiting state.
15. If a process is in the running state, what states can it go to next? (7.4) Answer: ready state, waiting state.
What’s the definition of an operating system? (7.1)
Answer: An operating system is an interface between the hardware of a computer and user(programs or humans) that facilitates the execution of other programs and the access to hardware and software resources.
What are the four necessary conditions for deadlock? (7.5)
Answer: mutual exclusion, resource holding, no preemption and circular waiting.
Exercises:
46. A computer has a monoprogramming operating system. If the size of memory is 64 MB and the residing operating system needs 4 MB, what is the maximum size of a program that can be run by this computer? (7.3) Answer:
The memory size is 64 MB and the residing operating system needs 4 MB. Then there are 60 (64-4) MB left. So the maximum size of a program that can be run by this computer is 60 MB.
47. Redo Exercise 46 if the operating system automatically allocates 10 MB of memory to data. (7.3)
Answer:
The data take 10 MB. Then there are 50(64-4-10) MB left. So the maximum size of a program that can be run by this computer is 50 MB.
48. A monoprogramming operating system runs programs that on average need 10 microseconds access to the CPU and 70 microseconds access to the I/O devices. What percentage of time is the CPU idle? (7.3) Answer:
In monoprogramming, when one program is being run, no other program can be executed. That is, when a program accesses I/O devices, CPU is idle. So the percentage of time of the CPU idle is 70/(70+10) = 87.5%.
49. A multiprogramming operating system uses an apportioning scheme and divides the 60MB of available memory into four partitions of 10MB, 12MB, 18MB, and 20MB. The first program to be run needs 17MB and occupies the third partition. The second program needs 8MB and occupies the second partition. Finally, the fourth program needs 20MB and occupies the fourth partition. What is the total memory used? What is the total memory wasted? What percentage of memory is wasted? (7.3)
Answer: The total memory used is 55.5 MB. The total memory wasted is 4.5 MB. The percentage of memory wasted is 7.5%.
51. A multiprogramming operating system uses paging. The available memory is 60 MB divided into 15 pages, each of 4MB. The first program needs 13 MB. The second program needs 12MB. The third program needs 27 MB. How many pages are used by the first program? How many pages are used by the second program? How many pages are used by the third program? How many pages are unused? What is the total memory wasted? What percentage of memory is wasted? (7.3) Answer:
Each page is 4MB. The first program needs 13 MB. It is obviously that 4*3<13<4*4. So the first program uses 4 pages and wastes 3(16-3) MB. The second program needs 12 MB. It is obviously that 12=4*3. So the second program uses 3 pages and wastes 0 MB. The third program needs 27 MB. It is obviously that 4*6<27<4*7. So the first program uses 7 pages and wastes 1(28-27) MB. There are 1(15-4-3-7) page unused. There are totally 4(3+0+1) MB memory wasted. The percent of memory wasted is 4/(60-4*1)=7%.
53. What is the status of a process in each of the following situations(according to Figure 7.9)?
a. The process is using the CPU
b. The process has finished printing and needs the attention of the CPU again c.The process has been stopped because its time slot is over. d. The process is reading data from the keyboard e The process is printing data. (7.4)
Answer: a)Running state b)Ready state c) Ready state d)Waiting state e)Waiting state