非抢占式优先级调度算法

Priority scheduling is a type of scheduling algorithm used by the operating system to schedule the processes for execution. The priority scheduling has both the preemptive mode of scheduling and the non-preemptive mode of scheduling. Here, we will discuss the non-preemptive priority scheduling algorithm.

优先级调度是操作系统用来调度要执行的进程的调度算法。 优先级调度既有抢占式调度又有非抢占式调度。 在这里, 我们将讨论非抢占式优先级调度算法 。

As the name suggests, the scheduling depends upon the priority of the processes rather than its burst time. So, the processes, in this case, must also have the priority number in its details on the basis of which the OS will schedule it.

顾名思义,调度取决于进程的优先级,而不是突发时间。 因此,在这种情况下,进程还必须在其详细信息中具有优先级号,操作系统将根据该优先级号对其进行调度。

For example, suppose we have 4 processes: P1P2P3 and P4 and they enter the CPU as follows:

例如,假设我们有4个进程: P1 , P2 , P3P4 ,它们按如下方式进入CPU:

Note: Here, lower the priority number, higher is the priority.

注意:此处,优先级数字越低,优先级越高。

priority scheduling in OS

As per the non-preemptive priority scheduling, the processes will be executed as follows:

根据非抢先优先级调度 ,将按以下方式执行过程:

Gant Chart:

甘特图:

priority scheduling in OS

Explanation:

说明:

  • There is only P1 available at time 0, so it will be executed first irrespective of the priority, and it cannot be preempted in between before its completion.

    在时间0只有P1可用,因此无论优先级如何都将首先执行它,并且在完成之前不能抢占它。

  • When it is completed at 4th-time unit, we have all P2P3, and P4 available. So, they are executed according to their priorities.

    当以第 4 次单位完成时,我们将拥有所有P2 , P3P4 。 因此,将根据优先级执行它们。

  • 5
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值