大连交大os第二章作业

更新时间:2023-07-06 04:55:31 阅读: 评论:0

第二章作业
14. What’s the biggest advantage of implementing thread in ur space? What’s the biggest disadvantage?
Solution: The first advantage is that a ur-level package can be implemented on an operating system that does not support threads. The cond advantage is that they allow each process 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 certain system have shown that the average process runs for a time T before blocking on I/O. A process switch traffickingrequires 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/ (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 0
36. Five jobs are waiting to be run. Their expected run times are 9, 6, 3,kaley cuoco 5, and X. In what order should they be run to minimize average respon time?(Your answer will depend on X.)
Solution:
IF (X<=3): X, 3, 5, 6, 9
IF (X>=3 AND X<=5): 3, X, 5, 6, 9
IF (X>=5 AND X<=6): 3, 5, X, 6, 9
IF (X>=6 AND X<=9): 3, 5, 6, X, 9
IF (X>=9): 3, 5, 6, 9, X
37. Five batch jobs A through E, arrive at a computer center at almost the same time. 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 overhead.
(a) Round robin
(b)Priority scheduling
(c)First-come, first-rved (run in order 10, 6, 2, 4, 8)
(d)Shortest job first
For (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. All jobs are completely CPU bound.
Solution:
kmd
process
Arrival time
Processing time
priority
英语四六级准考证打印入口官网>driftaway
A
0 (1)
10
3
B
contestant0 (2)
6
5 (HIGH)
C
david cook
0 (3)
2
2
D
0 (4)
4
1
E
0 (5)
8
4
(a)Round robin (quantum=2)
Turnaround time:   
A: 10+6+2+4+8=30
B: 30-4*2=22
C: 2+2+2=6
mazeD: 2*8=16
E: 30-2=28
Mean turnaround time= (30+22+6+16+28)/5=80/5=20.4
(b)priority scheduling
Turnaround time:
A: 6+8+10=24
B: 6
C: 24+2=26
D: 26+4=30
E: 6+8=14
Mean turnaround time= (24+6+26+30+14)/5=100/5=20
(c)FCFS
Turnaround time:
A: 10
B: 10+6=16
C: 16+2=18
D: 18+4=22
E: 22+8=30
Mean turnaround time= (10+16+18+22+30)/5=96/5=19.2
(d)medium的同义词Shorted job first
Turnaround time:dispute
A: 2+4+6+8+10=30
B: 2+4+6=12
C: 2
D: 2+4=6
E: 2+4+6+8=20
Mean turnaround time= (30+12+2+6+20)/5=70/5=14
41. A soft real-time system has four periodic events with periods of 50, 100, 200, and 250 mc each. Suppo that the four events require 35, 20, 10, and x mc of CPU time, respectively. What is the largest value of x for which the system is schedulable?
Solution:
35/50+20/100+10/200+x/250<=1 max(x)=12.5

本文发布于:2023-07-06 04:55:31,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/90/168535.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:打印   官网   准考证   入口
相关文章
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图