当前位置:网站首页>Multi task foundation of IOT operating system
Multi task foundation of IOT operating system
2022-07-27 06:04:00 【an0420】
Multi task basis of IOT operating system
Come back from the weekend to continue studying !
One . Multitasking fundamentals
1. Multitasking features
Task scheduling mechanism
1. Time slice scheduling mechanism
The core is time slice polling , Scheduling with the same priority can only be polled by time slice .
2. Preemptive scheduling mechanism
When task priorities are inconsistent , Low priority pending , High priority execution first , interrupt (isr) The highest priority is generated .
3. Mission characteristics
1. Programming is simple
2. There is no limit to the number of tasks .
3. Support preemption .
4. Prioritization .
5. Independent stack . When switching tasks, you need to switch CPU Operating environment .( So the characteristics of the operating system )
4. The status of the task
There are four states in a task :
1. Pending state : When the task is suspended , Will not be scheduled by the scheduler .
2. The ready state : The task will wait for the status of task scheduling when it runs .
3. Blocking state :osDelay, Give the task a delay , Block him , Then wait for the scheduler to schedule .
4. Running state :
5. Task priority

2. Multitasking implementation
Every task is done by 3 Part of the implementation
(1) Dead cycle
(2) Task entity
(3) Mission exit : No return value .
void freertosTask(void const * argument){
for(;;){
osDelay();
}
}
Task control block
Task control block is a structure that describes task attributes .
3、 ... and 、 Task stack

Two 、 Task creation
1. Create tasks
(1) Task creation API
xTaskCreate();// Create tasks dynamically When using configSUPPORT_DYNAMIC_ALLOCATION Must set 1
xTaskCreateStatic(); When using ConfigSUPPORT_STATIC_ALLICATION Set up 1.
(2) Use cubemax In the task 1s Print the task running flag once
Copy the previous project , Enable the serial port to be configured for asynchronous communication , open FreeRTos Select memory configuration in the configuration options column , It is configured for dynamic and static mixing .
Create serial port task after configuration , Generate keil file .
The project is as follows
(3) Use the key to control Led Task suspend and resume
void vTaskSuspend( TaskHandle_t pxTaskToSuspend ); // Hang up
void vTaskResume( TaskHandle_t pxTaskToResume ); // recovery
Source code :https://download.csdn.net/download/ay1204/86261003
notes : Source code comments Part 2
边栏推荐
- Global evidence of expressed sentimental alterations during the covid-19 pandemics
- Numpy基础学习
- 超强远程连接管理工具:Royal TSX
- 【头歌】重生之我在py入门实训中(9):异常处理
- Digital image processing Chapter 4 - frequency domain filtering
- Day 17.The role of news sentiment in oil futures returns and volatility forecasting
- Gbase 8C - SQL reference 4 character set support
- Public opinion & spatio-temporal analysis of infectious diseases literature reading notes
- PS 2022 updated in June, what new functions have been added
- 2. Simple regression problem
猜你喜欢
随机推荐
子类调用父类构造函数的时机
pytorch的多GPU训练的两种方式
西瓜书第三章---线性模型学习笔记
DSGAN退化网络
16. Over fitting and under fitting
【头歌】重生之数据科学导论——回归进阶
【头歌】重生之我在py入门实训中(2):公式编程
socket编程一:使用fork()实现最基础的并发模式
pytorch转onnx相关问题
Only one looper may be created per thread
Gbase 8C - SQL reference 6 SQL syntax (4)
[MVC Architecture] MVC model
【头歌】重生之我在py入门实训中(6):函数的定义与应用
制作视频后期特效需要什么工具?
Gbase 8C - SQL reference 5 full text search
std::bind与std::function的一些应用
Chrome 如何快速将一组正在浏览的网页(tabs)转移到另一台设备(电脑)上
【Unity URP】代码获取当前URP配置UniversalRendererData,并动态添加RendererFeature
关于pytorch转onnx经常出现的问题
What has been updated in the Chinese version of XMIND mind map 2022 v12.0.3?








![[MVC Architecture] MVC model](/img/71/e10da490d5f0098c64b33e77d158e7.png)
