当前位置:网站首页>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
边栏推荐
- 【头歌】重生之我在py入门实训中(10): Numpy
- 【12】理解电路:从电报机到门电路,我们如何做到“千里传信”?
- Emoji Emoji for text emotion analysis -improving sentimental analysis accuracy with Emoji embedding
- 4. Tensor data type and creation tensor
- 13. Logistic regression
- Andorid detects GPU rendering speed and over rendering
- pytorch的多GPU训练的两种方式
- 15. GPU acceleration, Minist test practice and visdom visualization
- 6.维度变换和Broadcasting
- 维度问题以及等高线
猜你喜欢

12. Optimization problem practice

What has been updated in the Chinese version of XMIND mind map 2022 v12.0.3?

DSGAN退化网络

西瓜书学习笔记---第四章 决策树

【11】二进制编码:“手持两把锟斤拷,口中疾呼烫烫烫”?

Auto Encoder(AE),Denoising Auto Encoder(DAE), Variational Auto Encoder(VAE) 区别

14. Example - Multi classification problem

【Unity URP】代码获取当前URP配置UniversalRendererData,并动态添加RendererFeature

剪枝-量化-转onnx中文系列教程

AE 3D粒子系统插件:Trapcode Particular
随机推荐
Day 17.The role of news sentiment in oil futures returns and volatility forecasting
数字图像处理第五章——图像复原与重建
pytorch模型
【头歌】重生之我在py入门实训中(12):Matplotlib接口和常用图形
模型的推理速度
【头歌】重生之我在py入门实训中(5):列表
Gbase 8C - SQL reference 6 SQL syntax (6)
【头歌】重生之机器学习-线性回归
5.索引和切片
如何管理大量的定时任务
剪枝-量化-转onnx中文系列教程
4.张量数据类型和创建Tensor
数字图像处理——第三章 灰度变换与空间滤波
Redis在windows下的idea连接不上问题
韦东山 数码相框 项目学习(四)简易的TXT文档显示器(电纸书)
[MVC Architecture] MVC model
数字图像处理——第六章 彩色图像处理
Gbase 8C - SQL reference 6 SQL syntax (14)
DSGAN退化网络
Matlab 画图(超详细)