logo资料库

操作系统期末卷.doc

第1页 / 共6页
第2页 / 共6页
第3页 / 共6页
第4页 / 共6页
第5页 / 共6页
第6页 / 共6页
资料共6页,全文预览结束
东 南 大 学 考 试 卷 ( B 卷) 课 程 名 称 操作系统 考 试 学 期 0 7 - 0 8 - 2 得分 适 用 专 业 计算机应用 考 试 形 式 闭卷 考 试 时 间 长 度 120 分钟 一、Definitions [5X6=30 pts] Give the technical term that best fits these definitions 1. Portion of a program that accesses shared variables and that no two processes can be executing this code that manipulates shared variables at the same time. 2. It is a method of overlapping the I/O of a job with that job’s own computation. The idea is simple. After a read operation completes and the job is about to start operating on the data, the input device is instructed to begin the next read immediately. The CPU and input device are then both busy. 3. Some devices, such as tape drives and printers, cannot usefully multiplex the I/0 requests of multiple concurrent applications. The subsystems can coordinate concurrent output to a separate disk file. For instance, When an application finishes printing, the subsystem copies the queued files to the printer one, at a time. 4. Unused routine is never loaded. 5. A process is busy swapping pages in and out. 6. A small operating system core that provides basic scheduling, memory management and communication services while relying on processes to perform the other required functionality traditionally associated with the operating system. 自 觉 遵 守 考 场 纪 律 如 考 试 作 弊 此 答 卷 无 效 线 封 密 名 姓 号 学 共 页 第 页
二、Comparisons[6+9=15pts] Complete the following comparisons using True, False or Possible 1.[6pts]Blocking I/o versus Noblocking I/O Blocking I/O Noblocking I/O Point of Comparison I/O call returns as much as available Implemented via multi-threading 2. [9 pts] Threads versus processes Point of Comparison Threads Processes Share all global variables Execute in separate address spaces Require less time to create, terminate and switch from one to another 三、Computing[10+12=22 pts] 1.Suppose that a disk drive has 5000 cylinders, numbered 0 to 4999. The drive is currently serving a request at cylinder 143, and the previous request was at cylinder 125. The queue of pending requests, in FIFO order, is 86, 1470, 913, 1774, 948, 1509, 1022, 1750, 130 Starting from the current head position, what is the total distance (in cylinders) that the disk arm moves to satisfy all the pending requests, for each of the following disk-scheduling algorithms? [10 pts] a. SSTF b. LOOK 2. Consider the following set of processes, with the length of the CPU-burst time given in milliseconds: Process Burst Time Priority 共 页 第 页
P1 P2 P3 P4 P5 10 1 2 1 5 3 1 3 4 2 The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0. [12 pts] a. Draw the Gantt chart illustrating the execution of these processes using SJF, a nonpreemptive priority (a smaller priority number implies a higher priority) scheduling. b. What is the turnaround time of each process for the scheduling algorithm in part a? c. What is the waiting time of each process for the scheduling algorithm in part a? 四、Answer the following questions [8+10=18 pts] 1.What is a race condition? When does it happen? [8pts] 2. Under what circumstances do page faults occur ? Describe the actions taken by the operating system when a page fault occurs. [10pts] 五、Programming[15 pts] The Sleeping-Barber Problem. A barbershop consists of a waiting room with n chairs, and a barber room with one barber chair. If there are no customers to be If a customer enters the barbershop and all chairs served, the barber goes to sleep. If the barber is busy, but chairs are occupied, then the customer leaves the shop. are available, then the customer sits in one of the free chairs. If the barber is asleep, the customer wakes up the barber. Write a program to coordinate the barber and the customers using Java synchronization ( or vc++ with P and V operations). 共 页 第 页
B 卷答案 一、Definitions [5X6=30 points] Give the technical term that best fits these definitions 1. Critical Section 2. Prefetching 3.sppoling 4. Dynamic loading 5. Thrashing 6. Microkernel 二、Comparisons[15pts] Complete the following comparisons using True, False or Possible 1)[6pts]Blocking I/o versus Noblocking I/O False True Possible True 2) [9 pts] Threads versus processes True False False True True False 三、Computing[22 points] 1. a.The SSTF schedule is 143, 130, 86, 913, 948, 1022, 1470, 1509, 1750, 1774. The total seek distance is 1745. b. The LOOK schedule is 143, 913, 948, 1022, 1470, 1509, 1750, 1774, 130, 86. The total seek distance is 3319. 2. Answer: a. The two Gantt charts are 2 3 4 5 1 5 1 5 1 5 1 1 3 1 5 1 3 4 5 2 b. Turnaround time(SJF and priority) 1 ,1 P3 4 ,18 P4 P1 19 ,16 P2 c. Waiting time (turnaround time minus burst time) P1 9 ,6 P2 2 ,19 P5 0 , 0 P3 2 ,16 P4 9 ,6 1 ,18 P5 4 ,1 共 页 第 页
四、Answer the following questions 1.The situation where several processes access – and manipulate shared data concurrently. The final value of the shared data depends upon which process finishes last. 2.During address translation, if valid–invalid bit in page table entry is 0  page fault. If there is ever a reference to a page, first reference will trap to OS  page fault • • OS looks at another table(in PCB) to decide: – – Invalid reference  abort. Just not in memory page it in. • Get empty frame. • • • Swap page into frame. Reset tables, validation bit = 1. Restart instruction: Least Recently Used . 共 页 第 页
共 页 第 页
分享到:
收藏