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

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

问题描述

我们有一个嵌入式应用,现在它要求其状态可以保存和读取。就像在PC游戏,在这里你保存它,你必须走出去,呼吸之前一些新鲜air.The产品在本质上是安静的进化,没有适当的设计,使标识要保存的数据是不是一种选择。

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,因此所有数据都固定地址(段。数据),它也是确定的,一个也没有动态内存分配。所以理论上我需要备份这些数据段在文件和应用程序的重新发布更新它从文件回来。这种方法可能会节省大量的数据比需要什么,但我确定它。

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.

我怎样才能做到这一点执行时间短?结果
此外,我怎么能确定启动和运行时间。数据段的结束?

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 /自/图文件。还有的/ proc /自/ 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天全站免登陆