操作系统期中作业 .docx

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

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

1、精品名师归纳总结操作系统期中作业: 学号:专业:一、 For each of the following statements, Choosing True or False1. Binary semaphores are those that are used by no more than two threads. F2. The Bankers algorithm is a way of preventing deadlock .F3. A multi-level indexed file permits faster random access than a contiguously

2、allocated file.F4. An atomic operation is a machine instruction or a sequence of instructions that must be executed to completion without interruption.T5. Deadlock is a situation in which two or more processes or threads are waiting for an event thatwill occur in the future.F6. Starvationis a situat

3、ionin whicha process is denied access to a resource because of the competitive activity of other, possibly unrelated, processes.T7. While a process is blocked on a semaphores queue, it is engaged in busy waiting. F8. Mutual exclusion can be enforced with a general semaphore whose initial value is gr

4、eater than 1. F9. A printer is an example of a logical resource.F10. Versions of OS/360 are still widely used today.F11. When an executing process is stopped by the scheduler, it is said to be blocked. F12. Interrupts are used to achieve a typical timesharing OS. T二、 Multiple Choice QuestionsFor eac

5、h of the following questions, There is only one correct answer.1. What is the purpose of system calls.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 and a kernel process.c) System calls allow us

6、er-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 thea) stackb data sectionc register setd thread ID3. In Many-to-One thread model, What would happen if a thread in a multithreaded process makes a

7、 blocking system call .a) the other threads of the process would continue to runb) the entire process would get blockedc) the blocking thread will get killedd) the blocking thread will never get to run again4. Which of the following Operating systems uses preemptive scheduling.a) Mac OS 8c Windows 2

8、0005. A measure of the number of processes completed per time unit is calleda) throughputb waiting timec response timed CPU utilization6. One of the problems with priority scheduling is可编辑资料 - - - 欢迎下载精品名师归纳总结a) agingb starvationc process deathd average waiting time7. In a time-sharing system, which

9、 of the following is the best criterion for CPU scheduling.a) Minimize CPU utilizationb Maximize CPU utilizationc Maximize system throughputd Minimize response time.8. The initialvalue of semaphore S is 2. if the value is -1 at present, how many processes are blocked on this semaphore .a 1b 2c 3d 49

10、. A system is in a deadlock, if its resource allocation grapha) contains a cycleb) doesn t contain a cyclec) contains a cycle and there is just one instance of every resourced) has at least one outgoing edge from any one of the process nodes10. Preemption of resources can be enforcedto prevent occur

11、rence of deadlocks, but this can t be applied to all the resource types, as preemption might leave the resource in an undeterminedstate. Which of the following resources can t hence be preempted.a) CPU registersb memory spacec tape drived all of the above11. A system is said to beif it can continue

12、to function even when a node or nodes in the system fail.a) networkedb distributedc real timed fault-tolerant12. Which of the following activity needs no special hardware support.a) Process schedulingb timer managementc memory mappingd interrupt system13. Which of the following statement about proce

13、sses 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:ProcessBurst-TimePriorityP1154P238P375P452P516P626The processes are assumed to have arrived in the ord

14、er 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:1Draw a Gantt chart2. What is the average waiting time for each of the scheduling algorithms?3. What is the average turnaround time for each of the sch

15、eduling algorithms?2可编辑资料 - - - 欢迎下载精品名师归纳总结Answer: FCFS:P115P218P325P430P531P633SJF:P5P6P2P4P3P1ATT=33+6+18+11+1+3/6=12Round-Robinquantum=2:P1P2P3P4P5P6P1P2P3P4P1P3P4P1P3P1AWT=18+11+19+8+9/6=13.83Priority:P4P1P3P5P6P2四、Two concurrent processes have input, computing and printing actions, respectivel

16、y. That issaid I1, C1, P1 for the 1 st process, and I2, C2, P2 for the 2 nd process. Their precedential relationship 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

17、 related wait/signaloperations.I1I2C1C2P1P2Semaphore :s1,s2,s3:=0; P1:P2:I1 。waits1。signals1。I2可编辑资料 - - - 欢迎下载精品名师归纳总结C1。waits2。signals2。C2 。P1。waits3。signals3。P2。五、 There are three cooperative processes P1, P2, and P3. They read data , denoted、as a b and c,from the same input device,as shown in fi

18、gure below. The input device is an exclusive access device.The first 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 - aP1, which is link

19、ed to the printer, should print the results of x,y, and z. Write the pseudo code for the three processes, using semaphores to synchronize their activities.P1InputaP2Non-preemptive input deviceInputbP3InputcSemaphore :s1,s2,s3,s4,s5:=0;P1:P2:P3:Input awaits1waits3signals1 waits2input b signals2input c waits4x=a+bsignals3z=y+c-awaits5y=a*bsignals5Print x,y,zsignals4可编辑资料 - - - 欢迎下载

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

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

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

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