STM32 Experiment & Note —— 🕹️(001) while(1){} cpu reentered (Not translated)
»
(001) HAL Library LED Lighting
(002) HAL Library LCD Frame Animation
(003) HAL Library FFT Dynamic Spectrum
(004) HAL Library FFT Speed Up
(005) HAL Library Understanding DMA
(006) Watchdog Summary
(007) GPIO Usage Steps
(008) CubeIDE Implementation of USB Peripherals*
(009) Why C99
(010) Linux UDP
(011) Linux TCP
(012) Temperature Control of Arm
(013) OpenWrt cross-compilation
(014) Basic data type in C99
(015) C99 struct
(016) C99 enum
(017) C99 funciont and L-Value, R-Value
(018) C99 pointer*
(019) C99 With only value assignment*
(020) C99 array with space, pointer with no space
(021) C99 No template function
(022) POSIX pthread multi-threads mutex*
(023) POSIX pthread multi-threads programming*
(024) C99 if
(025) C99 switch
(026) C99 loop
(027) C99 time and wait*
(028) High-precision calculation with GMP*
(029) Web Service Lib*
(030) International Components for Unicode (ICU)*
(031) Performance of C is higher than C++, because...*
(032) C99 weak function
(033) MTU TCP SOCKET
(034) STM32 UART Continually Sending Data
(035) STM32 UART Continually Receiving Data
(037) STM32 Normal and Circle
(038) STM32 UART clear transfer error flag
(039) STM32 UART Idle Callback
(040) STM32 UART, RS232 single TX line
(041) STM32 RS485 Differential signal communication
(042) STM32 HAL DMA Poll For Transfer
(043) STM32 enter low power comsuption mode
(044) STM32 Clear Flag of TCx in DMA IRQ
(045) STM32软件函数命名规范
(046) Deal with Idle in xxxCpltCallback
(047) C99 Built in macros
(048) isr enabled after calling ***_IT
(049) Procedure of starting STM32
(050) Load new firmware online
(051) SCB->VTOR
(052) STM32 Address space in programme
(053) STM32 Move program to other space
(054) STM32 Bootloader
(055) Keil中的下载算法
(056)编译器优化出错点
🍓(001) Close Swapfile
🍓(002) Format USB disk to ext4 with 1k blocks
🍓(003) Query Linux Version info and CPU info
🍓(004) Speed up latest version of Ubuntu
🍓(005) Clone 360 Browser Core Source Code Script
🍓(006) Before run Firefox in Ubuntu24.04
🍓(007) MAC Address
🍓(008) RMII & PHY
🍓(009) Ubuntu Server firewall configuration
🍓(010) Linux yield cpu by code
🍓(011) Linux Hardware Concept
🍓(012) Linux Inter-Process Communication
🍓(013) Ban Git force push
🍓(014) Ban Git reset --hard
🍓(015) Save unsaved cache to disk immedutely
🍓(016) 拷贝pre-receive到每个git仓库的脚本
🍓(017) sshd密码输入错误禁用IP3分钟
🖥️(001) 异机备份低功耗自用Git服务器搭建
🖥️(002) OpenWRT配置注意事项
🕹️(001) while(1){} cpu reentered
🕹️(002) functions for multi-thread in FreeRTOS
🕹️(003) FreeRTOS critical code zone
🕹️(004) FreeRTOS fix NULL not defined error
🕹️(005) lowest priority interrupt of ARM: PENDSV
🕹️(006) Configuration of tasks priority levels
🕹️(006) Cautions of different priority tasks locked
🕹️(008) Close scheduling of same priority tasks
🕹️(009) OTA Technology
🕹️(010) FreeRTOS create static task
🕹️(011) FreeRTOS list task list
🕹️(012) FreeRTOS HeapSize statistics
🕹️(013) FreeRTOS xTaskGetHandle
🕹️(014) FreeRTOS common method of create tasks
🕹️(015) FreeRTOS fix problem of tasks locked
🕹️(016) FreeRTOS Superest interrupt: SVC
🕹️(017) FreeRTOS interrupt call in privilege mode
🕹️(018) FreeRTOS SVC enter user mode
🕹️(019) FreeRTOS delay util
🕹️(020) FreeRTOS low consumption by Tickless
🕹️(021) FreeRTOS IdleHook
🕹️(022) FreeRTOS Hooks
🕹️(023) FreeRTOS yield CPU by code
🕹️(024) FreeRTOS semaphore
🕹️(025) FreeRTOS resolve priority inversion
🕹️(026) FreeRTOS get task priority
🕹️(027) FreeRTOS set task priority
🕹️(028) FreeRTOS function prefix
🕹️(029) Don't call RTOS function in IRQ handle
🕹️(030) Bottom half operation decrease semaphore
🕹️(031) Support Suspending for ever
🕹️(032) Call FreeRTOS SysCall in ISR
🕹️(033) Principle of Top Half and bottom haf
🕹️(034) FATFS in STM32 support exFat
🕹️(035) Message Queue in FreeRTOS
🕹️(036) Timer Tasks in FreeRTOS
🕹️(037) Reason of can not ping board
🕹️(038) LwIP Tcp Server Sample Code
🕹️(039) mutex equals binarySempahore
🕹️(040) Relationship between MEMP and Pbuf
🕹️(041) FreeRTOS连接ESP WiFi(待完成)
📟(001)CMSIS标准学习
🕹️(001)函数调用被优化
当FreeRTOS中没有任务时,系统会执行空闲任务。FreeRTOS中默认的空闲任务叫做prvIdleTask。这个任务如果打开了宏configUSE_TICKLESS_IDLE,会让CPU进入睡眠模式(低功耗模式):portSUPPRESS_TICKS_AND_SLEEP(xExpectedIdleTime);。

在FreeRTOS中有一个configEXPECTED_IDLE_TIME_BEFORE_SLEEP配置项,可以配置ARM空闲多久之后进入低功耗模式,也就是idle多久之后进入睡眠模式,时间单位是CPU时钟节拍1Tick。

而在多线程的C++代码中,while(true){sched_yeild();...}死循环必定会让CPU100%。那是因为线程让出时间片后,没有其他任务,导致CPU马上又重新进入了这个线程,所以,CPU的计算过程一直没有停下来,所以,CPU一直100%。所以,在FreeRTOS的系统设计中,while循环中必须加入osDelay,至少加入osDelay(1);在Linux软件设计中,while死循环必须加入usleep(1000);,以防止CPU100%。


顺便说一句,对于while(true)fork();的恶搞,考验的是系统管理员以及技术管理员的等级,等级高的会知道Linux操作系统有一个比Windows Server的系统配额配置更优秀的管理配置,可以配置每个用户最多使用的内存量和最多打开的文件描述符数量以及最多打开的进程数量。
比如,每个用户的内存使用上限的限制:
/etc/security/limits.conf
@admin hard  rss 11000000
* hard rss 21000000
第一行是用户组admin最多使用内存(rss)11GB,第二行是所有用户累计最多使用内存(rss)21GB

/etc/security/limits.conf
@admin hard nproc 1024
* hard nproc 10240
第一行是用户组admin最多开启1024个进程,第二行是所有用户累计最多开启10240个进程

/etc/security/limits.conf
@admin hard cpu 150
第一行是用户组admin最多占用150%的CPU

其中,如果用soft,那就可以超过,只是超过后会有告警;如果用hard,那就限制不能超过。@表示组

一个有用的Linux命令:
ulimit -a

附言一句:我没有什么机密,我也不是黑客。
«
--Alex.Zhang
--www.v-signon.com Learningers Co-Encouraged
Back
Personal Art: www.up-task.com Unit: Individual
中文 Русский 京ICP备19038994号-2
If the content on this website infringes upon your any rights, please contact me at 1307776259@qq.com for removal