当前位置:网站首页>软重启(reboot)
软重启(reboot)
2022-06-29 06:41:00 【qazw9600】
说明
- 嵌入式开发中,重启操作是最常用的操作之一,由于其操作简单,不容易受到关注,但是不同的重启方式实现和现象其实是不一样的。
断电重启
- 操作:关机后再开机,例如:拔掉电源再接上电源或者电池没电后再充电开机。
- 该方式是完整的重启操作,硬件会重新上电,内存等都会被重置,软件会重新执行,重新初始化等。
软重启
- 操作:在Linux平台上手动执行reboot命令重启设备,其它平台类似。
- 不同于断电重启,软重启是软件机制,其通过信号或者其它方式通知各个模块设备需要重启,模块需要自己实现模块的重启,从而实现设备的重启。
异常现象
- 外挂设备需要自主实现软重启
- 事例:智能家居项目,在开发板上外挂一个rf模块(单片机),调试时发现在开发板上执行reboot,单片机不会有任何重启操作,重启后由于设备端与单片机端数据和状态不一致出现一些异常。
- 确认原因:系统重启时,重启命令并没有传递到外挂模块,外挂模块根本不知道开发板已重启,需要自主实现通知流程。
- 重启卡顿问题
- 嵌入式开发中,有时会出现执行reboot后,设备并没有立即重启,而是等了几分钟,甚至很久设备才重启。
2.1 应用层卡顿
- 事例:MT8516平台,出现重启卡顿,使用“reboot -f”才能立即重启。
- 确认原因:MT8516平台使用的是systemd机制,reboot命令执行会向initd进程发送信号,initd再向其子进程(所有进程)发送信号,等待它们运行结束,开发板主程序处理有问题,在收到信号后,做清理操作时做了串口设备的flush操作,该flush操作会一直等待执行完成,但是其它进程和线程一直在写该串口设备,导致死锁,进程无法退出,所以设备无法重启。
2.2 内核卡顿
- 事例:ssc323平台,出现重启卡顿,使用“reboot -f”也无法解决。
- 确认原因:执行内核重启时,平台提供的wifi驱动处理有问题,概率性出现忙等,所以设备无法重启。
大致原理
- 手动执行命令“reboot”,实际上是执行的reboot程序,在嵌入式平台中,其实现在busybox中。
- 查看busybox中的源码可知,有两种情况
- reboot -f
- 直接调用内核重启接口,并不通知上层应用,可能导致上层应用缓存丢失等。
- reboot 其它选项
- 给第一个进程init发送TERM信号,init收到该信号后,会向其子进程(即所有进程)发送该信号,待其它进程处理TERM信号完后,init进程才会调用内核重启接口,进行内核重启。
边栏推荐
- ES中配置ext.dic文件不生效的原因
- 面试官:为什么数据库连接很消耗资源,资源都消耗在哪里?
- 数组知识点小结
- 呕心沥血总结出来的MySQL常见错误以及解决方法(一)
- 498. diagonal traversal (simulation)
- Detailed explanation of top and free commands
- matlab simulink 电网扫频仿真和分析
- Gateway controller communication protocol
- Detailed explanation of communication principle between [industrial control old horse] single chip microcomputer and Siemens S7-200
- 小白大战指针 (上)
猜你喜欢
![[industrial control old horse] detailed design of PLC six way responder system](/img/9c/8bfe336bb95a028a4fb8130941ff81.png)
[industrial control old horse] detailed design of PLC six way responder system

Viewing application and installation of Hana database license

Postman pre request

tf.count_nonzero

【工控老马】洗衣机PLC程序控制系统设计详解
![[industrial control old horse] detailed explanation of the design scheme of the running lamp control system based on Siemens S7-200PLC](/img/c5/9383a02050c83b26bb56f4045b0774.png)
[industrial control old horse] detailed explanation of the design scheme of the running lamp control system based on Siemens S7-200PLC

【深度之眼吴恩达机器学习作业班第四期】逻辑回归编程实现

Vulnhub's dc9 target

C实战——高配版贪吃蛇游戏设计

AI与元宇宙擦出火花:人类失去的只有枷锁,获得的是全方面的解放
随机推荐
[FreeRTOS] interrupt mechanism
KingbaseES 中select distinct on 语句
Oracle 批量插入数据-插入民族数据
MIPS instruction set and brief analysis
Summary of array knowledge points
Detailed explanation of communication principle between [industrial control old horse] single chip microcomputer and Siemens S7-200
Schnuka: 3D visual inspection scheme 3D visual inspection application industry
Protobuf 二进制文件学习及解析
Vulnhub's dc6 target
100 lectures on Excel advanced drawing skills (VI) - practical application cases of Gantt chart in project progress
搭建jenkins环境并自动关联打包好的工程jar进行自动发布
Appium automation test foundation ADB common commands (III)
Cv:: mat and Base64 conversion (including picture compression and decompression)
TF. Repeat and stack operations of slim
SQL 注入绕过(六)
SVM,人脸识别遇到的问题及解决方法
C actual combat - high configuration version of Snake game design
Detailed explanation of shell condition judgment
【量化投资系统】问题记录及解决方法
Roblox sword nine sword two