当前位置:网站首页>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();
}
}
边栏推荐
- Vulhub vulnerability recurrence 76_ XXL-JOB
- Selenium driver ie common problem solving message: currently focused window has been closed
- MySQL 45 lecture learning notes (XIV) count (*)
- Summary of June 2022
- What is industrial computer encryption and how to do it
- notepad++如何统计单词数量
- what the fuck! If you can't grab it, write it yourself. Use code to realize a Bing Dwen Dwen. It's so beautiful ~!
- 【Kubernetes系列】Kubernetes 上安装 KubeSphere
- Boosting the Performance of Video Compression Artifact Reduction with Reference Frame Proposals and
- Technical experts from large factories: common thinking models in architecture design
猜你喜欢
Selenium driver ie common problem solving message: currently focused window has been closed
Vulhub vulnerability recurrence 76_ XXL-JOB
Transition technology from IPv4 to IPv6
用于压缩视频感知增强的多目标网络自适应时空融合
CMS source code of multi wechat management system developed based on thinkphp6, with one click curd and other functions
Selenium ide plug-in download, installation and use tutorial
Four sets of APIs for queues
The cloud native programming challenge ended, and Alibaba cloud launched the first white paper on application liveliness technology in the field of cloud native
【网络数据传输】基于FPGA的百兆网/兆网千UDP数据包收发系统开发,PC到FPGA
[Android reverse] function interception (use cache_flush system function to refresh CPU cache | refresh CPU cache disadvantages | recommended time for function interception)
随机推荐
Deep understanding of redis -- a new type of bitmap / hyperloglgo / Geo
Deep profile data leakage prevention scheme
[FreeRTOS] FreeRTOS learning notes (7) - handwritten FreeRTOS two-way linked list / source code analysis
How to input single quotation marks and double quotation marks in latex?
BasicVSR++: Improving Video Super-Resolutionwith Enhanced Propagation and Alignment
[untitled] notice on holding "2022 traditional fermented food and modern brewing technology"
Industrial computer anti-virus
MySQL 45 lecture learning notes (VII) line lock
Valentine's Day is coming! Without 50W bride price, my girlfriend was forcibly dragged away...
com. alibaba. nacos. api. exception. NacosException
jdbc连接es查询的时候,有遇到下面这种情况的大神嘛?
win10微软拼音输入法输入文字时候下方不出现中文提示
Introduction to rce in attack and defense world
Latex中的单引号,双引号如何输入?
kubernetes集群之Label管理
Redis - detailed explanation of cache avalanche, cache penetration and cache breakdown
在已經知道錶格列勾選一個顯示一列
MySQL error resolution - error 1261 (01000): row 1 doesn't contain data for all columns
MySQL relearn 2- Alibaba cloud server CentOS installation mysql8.0
js 常用时间处理函数