2022年操作系统期中作业.docx

上传人:Q****o 文档编号:26181587 上传时间:2022-07-16 格式:DOCX 页数:8 大小:95.77KB
返回 下载 相关 举报
2022年操作系统期中作业.docx_第1页
第1页 / 共8页
2022年操作系统期中作业.docx_第2页
第2页 / 共8页
点击查看更多>>
资源描述

《2022年操作系统期中作业.docx》由会员分享,可在线阅读,更多相关《2022年操作系统期中作业.docx(8页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、精选学习资料 - - - - - - - - - 操作系统期中作业: _学号:专业:一、 For each of the following statements, Choosing True or False 1.2. 3. 4.5.6.7.8.9.10. 11. 12.Binary semaphores are those that are used by no more than two threads. F The Bankers algorithm is a way of preventing deadlock . FA multi-level indexed file permit

2、s faster random access than a contiguously allocated file. FAn atomic operation is a machine instruction or a sequence of instructions that must be executed to completion without interruption. TDeadlock is a situation in which two or more processes or threads are waiting for an event that will occur

3、 in the future. FStarvation is a situation in which a process is denied access to a resource because of the competitive activity of other, possibly unrelated, processes. TWhile a process is blocked on a semaphores queue, it is engaged in busy waiting. FMutual exclusion can be enforced with a general

4、 semaphore whose initial value is greater than 1. F A printer is an example of a logical resource. FVersions of OS/360 are still widely used today. F When an executing process is stopped by the scheduler, it is said to be blocked. F Interrupts are used to achieve a typical timesharing OS. T二、 Multip

5、le Choice Questions For each of the following questions, There is only one correct answer. 名师归纳总结 1.What is the purpose of system calls. 第 1 页,共 4 页a System calls allow user-level processes to gain resources from the operating system. b System calls are the standard interface between a user process

6、and a kernel process. c System calls allow user-level processes to request services of the operating system. d There is no real purpose to system calls. 2.Threads belonging to the same process share the a stack b data sectionc register set d thread ID 3.In Many-to-One thread model, What would happen

7、 if a thread in a multithreaded process makes a blocking system call . a the other threads of the process would continue to run b the entire process would get blocked c the blocking thread will get killed d the blocking thread will never get to run again 4.Which of the following Operating systems us

8、es preemptive scheduling. a Mac OS 8 c Windows 2000 5.A measure of the number of processes completed per time unit is called a throughput b waiting time c response time d CPU utilization 6.One of the problems with priority scheduling is - - - - - - -精选学习资料 - - - - - - - - - a aging c process death b

9、 starvation d average waiting time 7. In a time-sharing system, which of the following is the best criterion for CPU scheduling. a Minimize CPU utilization b Maximize CPU utilization c Maximize system throughput d Minimize response time.8. The initial value of semaphore S is 2. if the value is -1 at

10、 present, how many processes are blocked on this semaphore . a 1 b 2 c 3 d 4 9. A system is in a deadlock, if its resource allocation graph a contains a cycle b doesn t contain a cyclec contains a cycle and there is just one instance of every resource d has at least one outgoing edge from any one of

11、 the process nodes 10.Preemption of resources can be enforced to prevent occurrence of deadlocks, but this cant beapplied to all the resource types, as preemption might leave the resource in an undetermined state. Which of the following resources cant hence be preempted.a CPU registers b memory spac

12、e c tape drive d all of the above 11.A system is said to be _ if it can continue to function even when a node or nodes in the system fail. a networked b distributed c real time d fault-tolerant 12. Which of the following activity needs no special hardware support. a Process schedulingb timer managem

13、ent c memory mapping d interrupt system 13.Which of the following statement about processes is incorrect. a A process is dynamic. b A process has a lifetime. c A process is a set of instructions. d Multiple processes may execute concurrently. 三、 Consider the following set of processes:Process Burst-

14、Time Priority P1 15 4 P2 3 8 P3 7 5 P4 5 2 P5 1 6 P6 2 6 The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, P6, all at time 0.Use FCFS, SJF, Round Robin quantum is 2, Prioritylow numbers have high priority. For each of the algorithms: 1 Draw a Gantt chart 2. What is the avera

15、ge waiting time for each of the scheduling algorithms ?3. What is the average turnaround time for each of the scheduling algorithms ?2名师归纳总结 - - - - - - -第 2 页,共 4 页精选学习资料 - - - - - - - - - Answer: FCFS: P1 15 P2 18 P3 25 P4 30 P5 31 P6 33 SJF: P6 P2 P4 P3 P1 P5 ATT=33+6+18+11+1+3/6=12 Round-Robinqu

16、antum=2: P6 P1 P2 P3 P4 P1 P3 P4 P1 P3 P1 P1 P2 P3 P4 P5 AWT=18+11+19+8+9/6=13.83 Priority: P4 P1 P3 P5 P6 P2 四、Two concurrent processes have input, computing and printing actions, respectively. That is said I1, C1, P1 for the 1st process, and I2, C2, P2 for the 2nd process. Their precedential relat

17、ionship is shown in the figure, i.e. I2 must happen after I1, C2 must happen after C1 and I2, etc. Please describe the synchronization relationship of two processes by means of semaphores and related wait/signal operations. I1 C1 I2 C2 P1 P2 Semaphore :s1,s2,s3:=0; P1: P2: I1;waits1;signals1;I2 3名师归

18、纳总结 - - - - - - -第 3 页,共 4 页精选学习资料 - - - - - - - - - C1;signals2;waits2;C2 ;P1; waits3;signals3;P2; 五、 There are three cooperative processes P1, P2, and P3. They read data , denoted as ab and c,from the same input device,as shown in figure below. The input device is an exclusive access device.The fi

19、rst datuma must be read by process P1, the second datumb is read by process P2, and the third datumc by process P3. These three processes perform the following calculations: P1: x = a + b P2: y = a * b P3: z = y + c - a P1, which is linked to the printer, should print the results of x,y, and z. Writ

20、e the pseudo code for the three processes, using semaphores to synchronize their activities.P1 Inputa Non-preemptive P2 input deviceInputb Semaphore :s1,s2,s3,s4,s5:=0; P1: P2: Input a waits1 P3 Inputc P3: waits3 signals1 waits2 input b signals2 input c waits4 x=a+b waits5 Print x,y,z signals3 y=a*b signals4 z=y+c-a signals5 4名师归纳总结 - - - - - - -第 4 页,共 4 页

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 技术资料 > 技术总结

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁