当前位置:网站首页>Zephyr Learning note 2, Scheduling
Zephyr Learning note 2, Scheduling
2022-07-04 07:17:00 【Mayiqx】
Chapitre II:Scheduler(Scheduling).
L'ordonnanceur basé sur les priorités du noyau permet le partage de Threads pour les applicationsCPU.
Le thread passe de l'état d'exécution à l'état en attente ou en attente,Par exemplek_sem_take()Ouk_sleep().
Le thread passe à l'état prêt,Par exemple, en utilisantk_sem_give()Ouk_thread_start().
Renvoie le contexte du thread après le traitement de l'interruption,Quand le thread en cours d'exécution appellek_yield()Heure.
Lorsque le thread démarre activement une opération qui se convertit en état suspendu ou en attente,Il va dormir..
Collaborative

Préemption


Scheduler Locking
Les Threads préemptibles qui ne veulent pas être préemptés lors de l'exécution d'opérations critiques peuvent être appelés park_sched_lock().Une fois les opérations critiques terminées,Le thread préemptable doit appelerk_sched_unlock()Pour rétablir son état préemptif normal.
Thread Sleeping
k_sleep()
k_wakeup()
Le thread peut appelerk_busy_wait() Pour effectuer une attente chargée , L'attente retarde son traitement pour la période spécifiée ,Et nonCPU Jeter à un autre fil prêt .
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();
}
}边栏推荐
- Data double write consistency between redis and MySQL
- 关于IDEA如何设置快捷键集
- Uniapp applet subcontracting
- NLP literature reading summary
- Set JTAG fuc invalid to normal IO port
- Design of test cases
- tornado之目录
- [untitled] notice on holding "2022 traditional fermented food and modern brewing technology"
- Improve the accuracy of 3D reconstruction of complex scenes | segmentation of UAV Remote Sensing Images Based on paddleseg
- NLP-文献阅读总结
猜你喜欢

电脑通过Putty远程连接树莓派

【Kubernetes系列】Kubernetes 上安装 KubeSphere
![[Mori city] random talk on GIS data (I)](/img/e4/2a2ceb10a2c0285cdd0c922f827930.png)
[Mori city] random talk on GIS data (I)

移动适配:vw/vh

Implementation of ZABBIX agent active mode

com. alibaba. nacos. api. exception. NacosException

Pangu open source: multi support and promotion, the wave of chip industry

About how idea sets up shortcut key sets

There is no Chinese prompt below when inputting text in win10 Microsoft Pinyin input method

Selenium ide plug-in download, installation and use tutorial
随机推荐
手写简易版flexible.js以及源码分析
MySQL error resolution - error 1261 (01000): row 1 doesn't contain data for all columns
About how idea sets up shortcut key sets
【森城市】GIS数据漫谈(一)
notepad++如何统计单词数量
Rhcsa day 3
Label management of kubernetes cluster
tornado之目录
[FreeRTOS] FreeRTOS learning notes (7) - handwritten FreeRTOS two-way linked list / source code analysis
[Mori city] random talk on GIS data (I)
Master-slave replication principle of MySQL database
Lottery system test report
Blue Bridge Cup Quick sort (code completion)
When JDBC connects to es query, is there a God who meets the following situation?
Responsive - media query
2022-021rts: from the second half of the year
Knowledge payment applet dream vending machine V2
MySQL 45 lecture learning notes (XIV) count (*)
If there are two sources in the same job, it will be reported that one of the databases cannot be found. Is there a boss to answer
NLP literature reading summary