大连交大os第二章作业(共3页)_第1页
大连交大os第二章作业(共3页)_第2页
大连交大os第二章作业(共3页)_第3页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、精选优质文档-倾情为你奉上第二章作业14. Whats the biggest advantage of implementing thread in user space? Whats the biggest disadvantage?Solution: The first advantage is that a user-level package can be implemented on an operating system that does not support threads. The second advantage is that they allow each proc

2、ess to have its own customized scheduling algorithm.The disadvantage is the problem of how blocking system calls are implemented. Another problem is that if a thread starts running, no other thread in that process will ever run unless the first thread voluntarily gives up the CPU.35. Measurements of

3、 certain system have shown that the average process runs for a time T before blocking on I/O. A process switch requires a time S, which is effectively wasted (overhead). For round-robin scheduling with quantum Q, give a formula for the CPU efficiency for each of the following:(a) Q= CPU efficiency=T

4、/ (T+S)(b) Q>T CPU efficiency= T/ (T+S)(c) S<Q<T CPU efficiency=T/ (T+ST/Q)(d) Q=S CPU efficiency=50%(e) Q nearly 0 CPU efficiency is nearly 036. Five jobs are waiting to be run. Their expected run times are 9, 6, 3, 5, and X. In what order should they be run to minimize average response ti

5、me?(Your answer will depend on X.)Solution:IF (X<=3): X, 3, 5, 6, 9IF (X>=3 AND X<=5): 3, X, 5, 6, 9IF (X>=5 AND X<=6): 3, 5, X, 6, 9IF (X>=6 AND X<=9): 3, 5, 6, X, 9IF (X>=9): 3, 5, 6, 9, X37. Five batch jobs A through E, arrive at a computer center at almost the same time.

6、They have estimated running times of 10, 6, 2, 4, and 8 minutes. Their (externally determined) priorities are 3, 5, 2, 1, and 4, respectively, with 5 being the highest priority. For each of the following scheduling algorithms, determine the mean process turnaround time. Ignore process switching over

7、head.(a) Round robin(b)Priority scheduling(c)First-come, first-served (run in order 10, 6, 2, 4, 8)(d)Shortest job firstFor (a), assume that the system is multiprogrammed, and that each job gets its fair share of the CPU. For (b) through (d) assume that only one job at a time runs, until it finishes

8、. All jobs are completely CPU bound.Solution:processesArrival timeProcessing timepriorityA0 (1)103B0 (2)65 (HIGH)C0 (3)22D0 (4)41E0 (5)84(a) Round robin (quantum=2)A2AAEABCDEBDEBEATurnaround time:A: 10+6+2+4+8=30B: 30-4*2=22C: 2+2+2=6D: 2*8=16E: 30-2=28Mean turnaround time= (30+22+6+16+28)/5=80/5=20

9、.4(b) priority scheduling6ACBED81024Turnaround time:A: 6+8+10=24B: 6C: 24+2=26D: 26+4=30E: 6+8=14Mean turnaround time= (24+6+26+30+14)/5=100/5=20(c) FCFS10CDABE6248Turnaround time:A: 10B: 10+6=16C: 16+2=18D: 18+4=22E: 22+8=30Mean turnaround time= (10+16+18+22+30)/5=96/5=19.2(d) Shorted job first10CDABE6248Turnaround time:A: 2+4+6+8+10=30B: 2+4+6=12C: 2D: 2+4=6E: 2+4+6+8=20Mean turnaround time= (30+12+2+6+20)/5=70/5=1441. A soft real-time system has four periodic events with periods of 50, 100, 200, and 250 msec each. Suppose that the four events require 35, 20, 10, and x mse

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论