当前位置:网站首页>Zephyr study notes 2, scheduling
Zephyr study notes 2, scheduling
2022-07-04 07:17:00 【mayiQX】
Chapter two : Scheduler (Scheduling).
The kernel priority based scheduler allows application threads to share CPU.
The thread changes from running state to pending or waiting state , For example, through k_sem_take() perhaps k_sleep().
The thread transitions to the ready state , For example, using k_sem_give() perhaps k_thread_start().
Return the thread context after processing the interrupt , When the running thread calls k_yield() when .
When a thread actively starts an operation that converts itself to a suspended or waiting state , It will sleep .
Collaborative
Preemptive
Scheduler Locking
The preemptive thread that does not want to be preempted when performing critical operations can be called k_sched_lock(). Once the critical operation is completed , Preemptable threads must call k_sched_unlock() To restore its normal preemptive state .
Thread Sleeping
k_sleep()
k_wakeup()
Threads can call k_busy_wait() To perform busy waiting , This wait delays its processing for a specified period of time , Instead of CPU Give up to another ready thread .
CPU Idling
static k_sem my_sem;
void my_isr(void *unused)
{
k_sem_give(&my_sem);
}
void main(void)
{
k_sem_init(&my_sem, 0, 1);
/* wait for semaphore from ISR, then do related work */
for (;;) {
/* wait for ISR to trigger work to perform */
if (k_sem_take(&my_sem, K_NO_WAIT) == 0) {
/* ... do processing */
}
/* put CPU to sleep to save power */
k_cpu_idle();
}
}
边栏推荐
- 2022-021rts: from the second half of the year
- com. alibaba. nacos. api. exception. NacosException
- When JDBC connects to es query, is there a God who meets the following situation?
- 【Kubernetes系列】Kubernetes 上安装 KubeSphere
- jdbc连接es查询的时候,有遇到下面这种情况的大神嘛?
- 【FPGA教程案例7】基于verilog的计数器设计与实现
- rapidjson读写json文件
- Selenium ide plug-in download, installation and use tutorial
- Summary of MySQL common judgment functions!! Have you used it
- Solution of running crash caused by node error
猜你喜欢
How notepad++ counts words
[thread pool]
The number of patent applications in China has again surpassed that of the United States and Japan, ranking first in the world for 11 consecutive years
Deep profile data leakage prevention scheme
【Kubernetes系列】Kubernetes 上安装 KubeSphere
Introduction to rce in attack and defense world
Knowledge payment applet dream vending machine V2
Implementation of ZABBIX agent active mode
NLP literature reading summary
Summary of MySQL common judgment functions!! Have you used it
随机推荐
Centos8 install mysql 7 unable to start up
Introduction to rce in attack and defense world
kubernetes集群之Label管理
2022-021rts: from the second half of the year
云Redis 有什么用? 云redis怎么用?
电子协会 C语言 1级 34 、分段函数
[FPGA tutorial case 7] design and implementation of counter based on Verilog
Blue Bridge Cup Quick sort (code completion)
在已經知道錶格列勾選一個顯示一列
When JDBC connects to es query, is there a God who meets the following situation?
Novel website program source code that can be automatically collected
MySQL error resolution - error 1261 (01000): row 1 doesn't contain data for all columns
Technical experts from large factories: common thinking models in architecture design
Selection (023) - what are the three stages of event propagation?
Computer connects raspberry pie remotely through putty
MySQL 45 learning notes (XI) how to index string fields
[freertos] freertos Learning notes (7) - written freertos bidirectionnel Link LIST / source analysis
2022-021ARTS:下半年開始
Electronic Association C language level 1 35, bank interest
2022年6月小结