嵌入式 linux,应用程序状态冻结,重新启动 [英] embedded linux, application state freeze, relaunch

查看:23
本文介绍了嵌入式 linux,应用程序状态冻结,重新启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个嵌入式应用程序,现在它需要保存和重新加载其状态.就像在 PC 游戏中一样,您必须在出去呼吸新鲜空气之前保存它.该产品本质上是安静的进化,没有适当的设计,因此无法识别要保存的数据.

We have an embedded application, now it requires its state to be saved and reloaded. Just like in PC games, where you save it before you have to go out and breath some fresh air.The product is quiet evolutionary in nature, no proper design so identifying data to be saved is not an option.

软件是用 C 语言编写的,所以所有数据都有固定地址(.data 段),它也是确定性的,没有动态内存分配.所以理论上我会在文件中备份这个数据段,并在重新启动应用程序时从文件中更新它.这种方法可能会保存比所需更多的数据,但我可以接受.

The software is in C so all data has fixed addresses (.data segment), its also deterministic,a and no dynamic memory allocations. So theoretically I take a back up of this data segment in a file and on relaunch of application update it back from the file. This approach will probably save a lot more data than what is required, but I am ok with it.

我怎样才能在短时间内做到这一点?
另外如何在运行时识别 .data 段的开始和结束?

How can I do this in short execution time ?
Also how can I identify the start and end of .data segment in run-time ?

推荐答案

您想要 应用程序检查点,所以也许 伯克利实验室检查点重启 库可能对您有所帮助.

You want application checkpointing, so perhaps the Berkley Lab Checkpoint Restart library might help you.

如果您确定,您也许可以使用 mmap(2) 系统调用所有数据都有固定地址等...

You could perhaps use the mmap(2) system call, if you are sure all the data has fixed addresses, etc...

要了解您当前的内存段和映射,请阅读(从您的应用程序)/proc/self/maps 文件.还有/proc/self/smaps等.了解更多关于proc(5),即/proc/

To know about your current memory segments and mappings, read (from your application) the /proc/self/maps file. There is also /proc/self/smaps etc. Learn more about proc(5), ie /proc/

这篇关于嵌入式 linux,应用程序状态冻结,重新启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆