操作系统 系统开销比率_操作系统中的最高响应比率下一个(HRRN)调度

操作系统 系统开销比率

操作系统中的HRRN调度是什么? (What is HRRN Scheduling in Operating System?)

  • HRRN is the abbreviation of Highest Response Ratio Next Scheduling. It is an optimal scheduling algorithm.

    HRRN是最高响应率下一个调度的缩写 。 这是一种最佳的调度算法。

  • It is non-preemptive scheduling algorithm that means if there is any process currently executing with the CPU and if a new process arrives in the memory and its burst time is smaller than the currently running process then currently running process will not be put in the ready queue and it can complete its execution without any interruption.

    这是一种非抢占式调度算法,这意味着如果CPU当前正在执行任何进程,并且如果有新进程到达内存,并且其突发时间小于当前正在运行的进程,那么当前正在运行的进程将不会处于就绪状态队列,它可以完成其执行而不会受到任何干扰。

  • Non-preemptive scheduling algorithms are designed so that once a process starts its execution, it cannot be preempted until it completes its allotted time.

    非抢占式调度算法的设计宗旨是,一旦一个进程开始执行,就无法抢占该进程,直到它完成其分配的时间。

  • It is the modification of shortest job next (SJN) to mitigate the problem of process starvation.

    这是最短作业下一个(SJN)的修改,以减轻过程不足的问题。

  • In this scheduling algorithm assign the CPU to the next process which has the highest response ratio not according to the shortest burst time.

    在此调度算法中,不根据最短的突发时间将CPU分配给响应率最高的下一个进程。

算法 (Algorithm)

  • This scheduling is done based on the response ratio. Response ratio can be calculated with arrival time, waiting time and CPU burst time.

    该调度是基于响应率来完成的。 响应率可以通过到达时间,等待时间和CPU突发时间来计算。

        Response Ratio = (W+S)/S  
        Where, W= waiting time
        S= Burst time 
    
  • In this scheduling, once a process selected for execution then it will run until its completion.

    在此调度中,一旦选择要执行的进程,它将一直运行到完成为止。

  • First, we have to calculate the waiting time for all the processes. The sum of the periods spent waiting in the ready queue is referred to as waiting time.

    首先,我们必须计算所有流程的等待时间。 在就绪队列中等待所花费的时间之和称为等待时间。

  • Each time processes get scheduled for execution to find response ratio for each available process.

    每次安排执行进程的时间,以查找每个可用进程的响应率。

  • Process having shortest response ratio will be executed first by the processor.

    响应率最短的处理将首先由处理器执行。

  • If two processes have the same response ratio then break the tie using the FCFS scheduling algorithm.

    如果两个进程的响应率相同,则使用FCFS调度算法打破平局。

Example:

例:

Here is an example of HRRN Scheduling given arrival time and burst or service time of each process,

这是给定每个进程的到达时间和突发或服务时间的HRRN调度示例

HRRN Scheduling in OS

Solution:

解:

HRRN Scheduling in OS

Explanation:

说明:

  • At time t = 0, only the process P0 is available in the ready queue. So, process P0 executes till its completion.

    在时间t = 0时,就绪队列中只有进程P0可用。 因此,过程P0一直执行到完成为止。

  • At time t = 4, only the process P1 and P2 are available in the ready queue. So, we have to calculate the response ratio.

    在时间t = 4时,就绪队列中仅进程P1和P2可用。 因此,我们必须计算响应率。

  • The process which has the highest response ratio will be executed next.

    接下来将执行响应率最高的过程。

  • Response Ratio are,

    回应率是

        RR (P1) = [(4 - 3) + 3] / 3 = 1.40
        RR (P2) = [(4 - 3) + 3] / 3 = 0.75
    
  • Process P1 has highest response ratio so it will selected for execution.

    进程P1的响应率最高,因此将选择执行。

  • After the completion of execution of process P1, there are three processes P2, P3 and P4 are in the ready queue.

    在完成过程P1的执行之后,就绪队列中有三个过程P2,P3和P4。

  • So, the Response Ratio for processes P2, P3 and P4 are,

    因此,过程P2,P3和P4的响应率是

        RR (P2) = [(9 - 4) + 3] / 3 = 2.66
        RR (P3) = [(9 - 6) + 6] / 6 = 1.50
        RR (P4) = [(9 - 8) + 3] / 3 = 1.33
    
  • Process P2 has highest response ratio so it will selected for execution.

    进程P2的响应率最高,因此将选择执行。

  • After the completion of execution of process P2, there are three processes P3 and P4 are in the ready queue.

    在完成过程P2的执行之后,在准备队列中有三个过程P3和P4。

  • So, the Response Ratio for processes P3 and P4 are,

    因此,过程P3和P4的响应率是

        RR (P3) = [(12 - 6) + 6] / 6 = 2
        RR (P4) = [(12 - 8) + 3] / 3 = 2.33
    
  • Process P4 has highest response ratio so it will be executed next.

    进程P4的响应率最高,因此将在下一步执行。

  • After the completion of the execution of process P4, there are only process P3 in the ready queue. So, it will be executed next.

    在完成过程P4的执行之后,就绪队列中只有过程P3。 因此,将在下一个执行。

Advantages

优点

  • Its performance is better than SJF Scheduling.

    它的性能优于SJF计划

  • It limits the waiting time of longer jobs and also supports shorter jobs.

    它限制了较长工作的等待时间,也支持较短的工作。

Disadvantages

缺点

  • It can't be implemented practically.

    它实际上无法实现。

  • This is because the burst time of all the processes can not be known in advance.

    这是因为无法预先知道所有进程的突发时间。

翻译自: https://www.includehelp.com/operating-systems/highest-response-ratio-next-hrrn-scheduling.aspx

操作系统 系统开销比率

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值