当前位置:网站首页>【AutoSAR 八 OS】
【AutoSAR 八 OS】
2022-07-02 23:49:00 【柯宇谦】
AutoSAR 八 OS
1 Tasks
- 基础任务(Basic Task)
- 扩展任务(Extended Task)
1.1 基础任务(Basic Task)
当启动操作系统后,所有的Task都进入到挂起状态;然后由用户去触发需要执行的Task(一般在DaVinci中都有配置,可以生成代码,比如配置成初始化执行或者100ms周期执行);被触发的Task都直接进入准备状态,等待被OS调用;这时OS会根据Task的优先级来调度Task(如果这时有高优先级的Task进入准备状态了,OS就会暂停正在执行的Task,优先让高优先级的Task执行,后继续执行被暂停的Task,类似于中断嵌套)。

1.2 扩展任务(Extended Task)
扩展任务比基础任务多了一个等待状态,这个状态就是当Task正在运行的时候,突然需要一个事件(比如刚刚的ADC数据更新),那么在等待这个事件的时候,Task进入等待状态并释放CPU资源,低优先级的Task就可以继续占用CPU;当ADC数据更新事件来了,那么再让我们在等待状态中的Task进入准备状态,由于优先级高,那么再进入运行状态。
2 Alarms
Alarms顾名思义是闹钟,作用就是设置一个周期定时,但不光能用来触发Task,还可以用来设置一个Event事件或者Call一个回调函数。
Alarms的时间基准是通过由硬件定时器产生的Tick Time决定的,每个Tick Time是多少时间可以在DaVinci中配置。每来一个Tick Time,System Counter便加1,加到预设的值,Alarm就被触发了。
3 Interrupts
- 中断的优先级始终高于Task
- 中断的优先级中一类中断大于二类中断;
- 周期性Task和周期性中断都能做周期处理,但是在周期要求严格的情况下,最好用中断
3.1 一类中断(Cat1)
- 不会访问OS服务,中断结束后直接返回中断处
- 这里OS依然按照正常的调度执行
3.2 二类中断(Cat2)
- 会访问部分OS服务(一些OS服务是不允许的,比如TerminateTask)
- 中断结束后会发生一次OS的重新调度。
3.3 一类与二类中断的区别
- 一类中断: 由于不允许使用OS服务,因此在一类中断中不能调用Task2触发函数,只能在退出中断后回到Task1,然后等待OS应该调用Task2的时候再调用
- 二类中断: 因为允许使用OS部分服务,这时我们在二类中断中写入了Task2的触发函数,那么在中断结束返回的时候会直接发生一次调度,由于Task2被触发了,优先级又高,那么就直接进入Task2运行,等Task2运行结束,再返回Task1继续运行(如下图的2情况);当然,在中断中也可以不触发其他Task,OS调度也就依然返回到Task1中去(如下图的1情况)

4 IOC (Inter OS Application Communicator)
是在内存中开辟了一个被保护的IOC区域,用于跨核通信。
该区域支持多输入多输出,由OS管理,在DaVinci中一般是自动生成无需修改,这里仅作了解
5 OS Resources
当至少两个Task并行访问同一个资源的时候,很可能出问题,OS Resources就是用来防止并行访问出错

边栏推荐
- Feature Engineering: summary of common feature transformation methods
- [shutter] image component (load network pictures | load static pictures | load local pictures | path | provider plug-in)
- Some introduction and precautions about XML
- Bloom filter
- 【雅思阅读】王希伟阅读P1(阅读判断题)
- Slf4j + logback logging framework
- Briefly talk about other uses of operation and maintenance monitoring
- Explain in detail the significance of the contour topology matrix obtained by using the contour detection function findcontours() of OpenCV, and how to draw the contour topology map with the contour t
- NC24325 [USACO 2012 Mar S]Flowerpot
- Free we media essential tools sharing
猜你喜欢

为什么网站打开速度慢?

Multiprocess programming (I): basic concepts

Attributeerror: 'tuple' object has no attribute 'layer' problem solving

Automated defect analysis in electronic microscopic images

Web2.0的巨头纷纷布局VC,Tiger DAO VC或成抵达Web3捷径
![Luogu_ P1149 [noip2008 improvement group] matchstick equation_ Enumeration and tabulation](/img/4a/ab732c41ea8a939fa0983fec475622.png)
Luogu_ P1149 [noip2008 improvement group] matchstick equation_ Enumeration and tabulation

Shell 实现文件基本操作(切割、排序、去重)

Sysdig analysis container system call

DotNet圈里一个优秀的ORM——FreeSql

2022上半年值得被看见的10条文案,每一句都能带给你力量!
随机推荐
mm中的GAN模型架构
JSON转换工具类
logback配置文件
免费自媒体必备工具分享
文件操作IO-Part2
在线预览Word文档
【小程序项目开发-- 京东商城】uni-app之自定义搜索组件(中)-- 搜索建议
Rust所有权(非常重要)
Shell implements basic file operations (cutting, sorting, and de duplication)
Explain in detail the significance of the contour topology matrix obtained by using the contour detection function findcontours() of OpenCV, and how to draw the contour topology map with the contour t
About qbytearray storage hexadecimal and hexadecimal conversion
Tensorflow 2.x(keras)源码详解之第十五章:迁移学习与微调
NC24840 [USACO 2009 Mar S]Look Up
NC20806 区区区间间间
Nacos+openfeign error reporting solution
Hundreds of continuous innovation to create free low code office tools
[pulsar document] concepts and architecture
[shutter] image component (load network pictures | load static pictures | load local pictures | path | provider plug-in)
Leetcode 294. Flip game II (game theory)
多进程编程(四):共享内存