zoukankan      html  css  js  c++  java
  • 东南大学《操作系统》课程作业 第五章

    1 - Discuss how the following pairs of scheduling criteria conflict in certain settings.
    a. CPU utilization and response time
    b. Average turnaround time and maximum waiting time
    c. I/O device utilization and CPU utilization

    a. 要想最大化利用CPU,应减少CPU的上下文切换开销。假设每次上下文切换耗时固定,则只能减少上下文切换次数。这会导致进程的响应时间变长。
    b. 要想最小化平均周转时间,尽快周转进程,则需要优先执行耗时最短的进程。这可能使得长耗时进程饥饿,导致最大等待时间变长。
    c. 要想最大化利用CPU,应减少CPU的上下文切换开销。要想最大化IO设备利用,应在它们一准备好时就进行调用,这将导致CPU发生上下文切换。

    2 - Consider the exponential average formula used to predict the length of the next CPU burst. What are the implications of assigning the following values to the parameters used by the algorithm?
    a. α = 0 and τ0 = 100 milliseconds
    b. α = 0.99 and τ0 = 10 milliseconds

    根据指数平均公式\(τ_{(n+1)}=αt_n+(1-α) τ_n\)可知:
    a. \(τ_{(n+1)}=τ_n\),估计值将始终为100毫秒;
    b. \(τ_{(n+1)}=0.99t_n+0.01τ_n≈t_n\),即预测值将会很大程度上接近当前CPU执行的用时,而对过往历史几乎没有记忆。

    3 - Consider the following set of processes, with the length of the CPU burst given in milliseconds:
    image
    The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0.
    a. Draw four Gantt charts that illustrate the execution of these processes using the following scheduling algorithms: FCFS, SJF, non-preemptive priority (a larger priority number implies a higher priority), and RR (quantum = 2).
    b. What is the turnaround time of each process for each of the scheduling algorithms in part a?
    c. What is the waiting time of each process for each of these scheduling algorithms?
    d. Which of the algorithms results in the minimum average waiting time (over all processes)?

    image
    image

    4 - The following processes are being scheduled using a preemptive, priority-based, round-robin scheduling algorithm.
    image
    Each process is assigned a numerical priority, with a higher number indicating a higher relative priority. The scheduler will execute the highest priority process. For processes with the same priority, a round-robin scheduler will be used with a time quantum of 10 units. If a process is preempted by a higher-priority process, the preempted process is placed at the end of the queue.
    a. Show the scheduling order of the processes using a Gantt chart.
    b. What is the turnaround time for each process?
    c. What is the waiting time for each process?

    规则如下:
    优先级数字越大,优先级越高;抢占式的优先级调度;相同优先级则采用RR调度,时间片为10;进程被抢占时退到队列尾部。
    image
    image

    5 - Which of the following scheduling algorithms could result in starvation?
    a. First-come, first-served
    b. Shortest job first
    c. Round robin
    d. Priority

    SJF算法会造成饥饿。如果一直有短时项目进入,则长时项目无法被执行。
    优先级算法会造成饥饿。如果一直有高优先级项目进入,则低优先级项目无法被执行。

    6 - Consider a variant of the RR scheduling algorithm where the entries in the ready queue are pointers to the PCBs.
    a. What would be the effect of putting two pointers to the same process in the ready queue?
    b. What would be the major advantages and disadvantages of this scheme?
    c. How would you modify the basic RR algorithm to achieve the same effect without the duplicate pointers?

    a. 该RR算法按指针访问需要轮转的进程。两个指针指向同一个PCB会使得该进程分配到的时间片为两个单位时间片,该进程会两次出现在就绪队列中。这相当于对这个进程有“偏好”的效果。
    b. 该方案的优点是在不改变调度算法的前提下,以简单的方式为某些进程分配更高的优先级。缺点是需要维护较多的指针,并且在查找特定进程时必须遍历指针来访问PCB。
    c. 使得传统RR在一个轮转周期中支持分配两个时间片给同一个进程,或者允许进程申请更大的时间片。

    7 - Consider a system running ten I/O-bound tasks and one CPU-bound task. Assume that the I/O-bound tasks issue an I/O operation once for every millisecond of CPU computing and that each I/O operation takes 10 milliseconds to complete. Also assume that the context switching overhead is 0.1 millisecond and that all processes are long-running tasks. What is the CPU utilization for a round-robin scheduler when:
    a. The time quantum is 1 millisecond
    b. The time quantum is 10 milliseconds

    a. 考虑一个时间片。1ms发生1次因I/O受限任务的上下文切换,耗时0.1ms。则CPU利用率为1/1.1×100%=90.9%。
    b. 考虑一个时间片。10ms发生10次因I/O受限任务的上下文切换,耗时1ms。在时间片末尾,首个I/O受限任务完成,发生1次上下文切换,耗时0.1ms。综上,CPU利用率为10/11.1=90.1%。

  • 相关阅读:
    Plugin with id 'com.android.application' not found.
    android studio ,Gradle DSL method not found: 'compile()'
    eclipse 插件未安装成功定位
    [转]jquery $(document).ready() 与window.onload的区别
    emmet
    前端
    qunit.js初试
    jquery-mockjax初试
    来自工程师的8项Web性能提升建议
    css 中两个class之间没有空格与有空格有什么区别
  • 原文地址:https://www.cnblogs.com/zxuuu/p/15631178.html
Copyright © 2011-2022 走看看