FreeRTOS Task 调度算法

简介

本文总结FreeRTOS 任务调度算法。
时间调度算法决定那个就绪状态的任务切换为运行状态。

调度算法

Round Robin Scheduling

该算法保证相同优先级的任务依次进入运行状态(采用’take it in turn ’ 策略)。

缺点
不能保证相同优先级的任务执行时间是相等的,只能保证位于就绪状态的任务依次进入运行状态。

Fixed Priority Pre-emptive Scheduling with Time Slicing

固定优先级抢占时间片调度算法。
‘固定优先级’ 指 不改变任务的优先级。
‘抢占’ 指的是当有更高优先级任务进入就绪状态(优先级高于当前执行任务的优先级), 当前执行状态的任务被抢占, 将有执行状态切换到就绪状态,处于就绪状态的更高优先级任务进入执行状态。
‘时间片’ 用于具有同一个优先级的任务分享处理时间。

Fixed Priority Pre-emptive Scheduling without Time Slicing

不带时间片的调度算法选择任务进入执行状态的策略:

  1. 更高优先级的任务进入就绪状态。
  2. 处于执行状态的任务进入阻塞或挂起状态。

Co-operative Scheduling

不允许进行任务抢占。处于就绪状态的优先级任务还是先执行。

任务切换时机

参考FreeRTOS 说明。
It is important to note that the end of a time slice is not the only place that the scheduler can select a
new task to run; as will be demonstrated throughout this book, the scheduler will also select a new task
to run immediately after the currently executing task enters the Blocked state, or when an interrupt
moves a higher priority task into the Ready state

抢占:立即抢占当前执行的任务。
时间片调度:调度器在每个时间片选择task执行。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值