CN104750579A - Method and device for manufacturing memory mirroring - Google Patents

Method and device for manufacturing memory mirroring Download PDF

Info

Publication number
CN104750579A
CN104750579A CN201510174738.4A CN201510174738A CN104750579A CN 104750579 A CN104750579 A CN 104750579A CN 201510174738 A CN201510174738 A CN 201510174738A CN 104750579 A CN104750579 A CN 104750579A
Authority
CN
China
Prior art keywords
memory
mirror image
database
mode
database service
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201510174738.4A
Other languages
Chinese (zh)
Other versions
CN104750579B (en
Inventor
沙金川
汤晓迪
任学亮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201510174738.4A priority Critical patent/CN104750579B/en
Publication of CN104750579A publication Critical patent/CN104750579A/en
Application granted granted Critical
Publication of CN104750579B publication Critical patent/CN104750579B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本发明实施例提供一种制作内存镜像的方法和装置,该方法包括:终端设备判断终端设备所处的状态,若终端设备处于内存镜像制作状态,则终端设备在第一个应用文件启动之前,在数据库服务的触发打开模式下进行内存镜像制作处理,终端设备在内存镜像制作完成之后,启动第一个应用文件。本发明实施例提供的制作内存镜像的方法和装置可以提高系统的可靠性。

Embodiments of the present invention provide a method and device for making a memory mirror image, the method comprising: the terminal device judges the state of the terminal device, and if the terminal device is in the state of making a memory mirror image, the terminal device, before the first application file starts, In the triggered opening mode of the database service, the memory mirroring process is performed, and the terminal device starts the first application file after the memory mirroring is completed. The method and device for making a memory image provided by the embodiments of the present invention can improve the reliability of the system.

Description

制作内存镜像的方法和装置Method and device for making memory image

技术领域technical field

本发明实施例涉及通信技术,尤其涉及一种制作内存镜像的方法和装置。Embodiments of the present invention relate to communication technology, and in particular to a method and device for making a memory image.

背景技术Background technique

内存镜像是对内存数据做两份拷贝,分别放在主内存和镜像内存中,以防止因为内存发生故障而导致数据的永久性丢失,因此,终端设备利用此特性,可以通过将某一时刻的内存状态做一内存镜像,并根据该内存镜像进行现场恢复,从而达到快速开机的目的。Memory mirroring is to make two copies of memory data, which are placed in the main memory and the mirror memory respectively, so as to prevent permanent data loss due to memory failure. Make a memory image of the memory state, and perform on-site recovery according to the memory image, so as to achieve the purpose of fast booting.

现有技术中,采用内存镜像技术实现快速开机时,如果内存镜像在用户使用终端设备之前已经制作完成,而用户使用终端设备之后,由于某些操作可能会引起系统、应用状态或设置值发生改变,这些改变将通过文件系统存储在存储介质中,若用户使用终端设备一段时间后,再采用内存镜像技术实现快速开机,此时,内存镜像中的数据可能与存储介质中的数据不一致,就会造成文件系统直接崩溃,导致文件系统不再可用。为了解决这一问题,在现有技术中,一般采用在每次关闭终端设备之前,对最新的内存状态作一次内存镜像,以保证内存镜像和存储介质中的数据相一致。In the prior art, when the memory mirroring technology is used to achieve fast booting, if the memory mirroring has been completed before the user uses the terminal device, and after the user uses the terminal device, some operations may cause changes in the system, application status or setting values , these changes will be stored in the storage medium through the file system. If the user uses the terminal device for a period of time, and then uses the memory mirroring technology to achieve fast booting, at this time, the data in the memory mirroring may be inconsistent with the data in the storage medium, and the Causes the file system to crash directly, causing the file system to no longer be usable. In order to solve this problem, in the prior art, before closing the terminal device each time, a memory image is performed on the latest memory state to ensure that the memory image is consistent with the data in the storage medium.

然而,由于在每次制作内存镜像的过程中,必须要保证终端设备的供电稳定,如果突然断电,则会使内存镜像制作失败,导致内存镜像制作失败,造成下一次开机时无法使用内存镜像技术实现快速开机,使得系统的可靠性不高。However, in the process of making memory mirroring every time, it is necessary to ensure that the power supply of the terminal equipment is stable. If there is a sudden power failure, the making of memory mirroring will fail, resulting in the failure of making memory mirroring, and the memory mirroring cannot be used when the next boot Technology to achieve fast boot, so that the reliability of the system is not high.

发明内容Contents of the invention

本发明实施例提供一种制作内存镜像的方法和装置,以提高系统的可靠性。Embodiments of the present invention provide a method and device for making a memory image, so as to improve system reliability.

第一方面,本发明实施例提供一种制作内存镜像的方法,包括:In a first aspect, an embodiment of the present invention provides a method for making a memory image, including:

终端设备判断所述终端设备所处的状态;The terminal device judges the state of the terminal device;

若所述终端设备处于内存镜像制作状态,则所述终端设备在启动第一个应用文件之前,在数据库服务的触发打开模式下进行内存镜像制作处理;If the terminal device is in the state of memory mirroring, before starting the first application file, the terminal device performs memory mirroring processing in the triggering open mode of the database service;

所述终端设备在所述内存镜像制作完成之后,启动所述第一个应用文件。The terminal device starts the first application file after the memory image is created.

结合第一方面,在第一方面的第一种可能的实现方式中,所述触发打开模式为在所述终端设备检测到数据库操作请求时打开数据库文件,且在所述终端设备未检测到所述数据库操作请求或者检测到所述数据库操作请求的访问结束时关闭所述数据库文件的处理模式。With reference to the first aspect, in a first possible implementation of the first aspect, the trigger opening mode is to open the database file when the terminal device detects a database operation request, and when the terminal device does not detect the The processing mode of closing the database file when the database operation request or the end of the access of the database operation request is detected.

结合第一方面或第一方面的第一种可能的实现方式,在第一方面的第二种可能的实现方式中,在所述在数据库服务的触发打开模式下进行内存镜像制作处理之前,所述方法还包括:In combination with the first aspect or the first possible implementation of the first aspect, in the second possible implementation of the first aspect, before performing the memory mirroring process in the triggered open mode of the database service, the The method also includes:

所述终端设备对系统文件进行编译项的配置,以解除内存中的数据与存储介质中的数据之间的耦合;The terminal device configures compiled items for the system file, so as to release the coupling between the data in the memory and the data in the storage medium;

则所述在数据库服务的触发打开模式下进行内存镜像制作处理,包括:Then, the memory mirroring process is performed under the triggered open mode of the database service, including:

所述终端设备在解除内存中的数据与存储介质中的数据之间的耦合之后,在所述数据库服务的触发打开模式下进行内存镜像制作处理。After the terminal device releases the coupling between the data in the memory and the data in the storage medium, it performs memory image creation processing in the triggered open mode of the database service.

结合第一方面、第一方面的第一种至第一方面的第二种任一种可能的实现方式,在第一方面的第三种可能的实现方式中,所述在数据库服务的触发打开模式下进行内存镜像制作处理之前,所述方法还包括:In combination with the first aspect, the first aspect of the first aspect to any of the second possible implementation manners of the first aspect, in the third possible implementation manner of the first aspect, the trigger opening of the database service Before carrying out the memory image making process under the mode, the method also includes:

所述终端设备判断所述数据库服务的工作模式是否为长期打开模式;The terminal device judges whether the working mode of the database service is a long-term open mode;

若所述数据库服务的工作模式为长期打开模式,则将所述数据库服务的工作模式由所述长期打开模式切换为所述触发打开模式。If the working mode of the database service is the long-term open mode, switch the working mode of the database service from the long-term open mode to the triggered open mode.

结合第一方面,在第一方面的第四种可能的实现方式中,所述方法还包括:With reference to the first aspect, in a fourth possible implementation manner of the first aspect, the method further includes:

若所述终端设备处于镜像恢复状态,则将所述数据库服务的工作模式由所述触发打开模式切换为长期打开模式;If the terminal device is in the mirror recovery state, then switch the working mode of the database service from the trigger open mode to the long-term open mode;

所述终端设备在所述数据库服务的长期打开模式下,读取所述内存镜像,以启动本地应用文件。In the long-term open mode of the database service, the terminal device reads the memory image to start the local application file.

结合第一方面的第四种可能的实现方式,在第一方面的第五种可能的实现方式中,所述读取所述内存镜像,以启动本地应用文件,具体包括:With reference to the fourth possible implementation of the first aspect, in the fifth possible implementation of the first aspect, the reading the memory image to start the local application file specifically includes:

所述终端设备触发用于内存镜像恢复的后台服务向除用于内存镜像恢复的后台服务之外的其他后台服务发送通知消息,以使所述其他后台服务在识别出所述通知消息为内存镜像恢复消息时,读取所述内存镜像;The terminal device triggers the background service for memory mirroring recovery to send a notification message to other background services except the background service for memory mirroring recovery, so that the other background services recognize that the notification message is a memory mirroring When restoring a message, read the memory image;

所述终端设备根据读取的所述内存镜像,启动本地应用文件。The terminal device starts a local application file according to the read memory image.

第二方面,本发明实施例提供一种制作内存镜像的方法,包括:In a second aspect, an embodiment of the present invention provides a method for making a memory image, including:

终端设备判断所述终端设备所处的状态;The terminal device judges the state of the terminal device;

若所述终端设备处于内存镜像制作状态,则所述终端设备在启动第一个应用文件之前,且在启动数据库服务之前,进行内存镜像制作处理;If the terminal device is in the memory mirroring state, the terminal device performs memory mirroring processing before starting the first application file and before starting the database service;

所述终端设备在所述内存镜像制作完成之后,启动所述第一个应用文件。The terminal device starts the first application file after the memory image is created.

第三方面,本发明实施例提供一种制作内存镜像的装置,包括:In a third aspect, an embodiment of the present invention provides a device for making a memory image, including:

判断模块,用于判断所述终端设备所述的状态;a judging module, configured to judge the state of the terminal device;

处理模块,用于在所述判断模块判断出所述终端设备处于内存镜像制作状态时,在启动第一个应用文件之前,在数据库服务的触发打开模式下进行镜像制作处理;A processing module, configured to perform mirroring processing in the triggered open mode of the database service before starting the first application file when the judging module judges that the terminal device is in the memory mirroring state;

启动模块,用于在所述内存镜像制作完成之后,启动所述第一个应用文件。A startup module, configured to start the first application file after the memory image is created.

结合第三方面,在第三方面的第一种可能的实现方式中,所述装置还包括:检测模块,用于检测是否存在数据库操作请求,或者检测所述数据库操作请求的访问是否结束;With reference to the third aspect, in a first possible implementation manner of the third aspect, the device further includes: a detection module, configured to detect whether there is a database operation request, or detect whether the access of the database operation request ends;

其中,所述触发打开模式为在所述检测模块检测到数据库操作请求时打开数据库文件,且在所述检测模块未检测到所述数据库操作请求或者检测到所述数据库操作请求的访问结束时关闭所述数据库文件的处理模式。Wherein, the trigger opening mode is to open the database file when the detection module detects a database operation request, and close when the detection module does not detect the database operation request or detects that the access of the database operation request ends The processing mode for the database file.

结合第三方面或第三方面的第一种可能的实现方式,在第三方面的第二种可能的实现方式中,所述处理模块还用于对系统文件进行编译项的配置,以解除内存中的数据与存储介质中的数据之间的耦合;In combination with the third aspect or the first possible implementation of the third aspect, in the second possible implementation of the third aspect, the processing module is further configured to configure compiled items for system files, so as to release memory The coupling between the data in the storage medium and the data in the storage medium;

所述处理模块还用于在解除内存中的数据与存储介质中的数据之间的耦合之后,在所述数据库服务的触发打开模式下进行内存镜像制作处理。The processing module is further configured to perform memory image creation processing in the triggered open mode of the database service after releasing the coupling between the data in the memory and the data in the storage medium.

结合第三方面、第三方面的第一种至第三方面的第二种任一种可能的实现方式,在第三方面的第三种可能的实现方式中,所述装置还包括切换模块;其中,With reference to the third aspect, any one of the first possible implementation manner of the third aspect to the second possible implementation manner of the third aspect, in the third possible implementation manner of the third aspect, the device further includes a switching module; in,

所述判断模块,还用于判断所述数据库服务的工作模式是否为长期打开模式;The judging module is also used to judge whether the working mode of the database service is a long-term open mode;

所述切换模块,用于在所述数据库服务的工作模式为长期打开模式时,将所述数据库服务的工作模式由所述长期打开模式切换为所述触发打开模式。The switching module is configured to switch the working mode of the database service from the long-term open mode to the triggered open mode when the working mode of the database service is the long-term open mode.

结合第三方面,在第三方面的第四种可能的实现方式中,所述装置还包括切换模块;其中,With reference to the third aspect, in a fourth possible implementation manner of the third aspect, the device further includes a switching module; wherein,

所述切换模块,用于在所述判断模块判断出若所述终端设备处于镜像恢复状态,则将所述数据库服务的工作模式由所述触发打开模式切换为长期打开模式;The switching module is used to switch the working mode of the database service from the trigger open mode to the long-term open mode if the judgment module determines that the terminal device is in the mirror recovery state;

所述启动模块,还用于在所述数据库服务的长期打开模式下,读取所述内存镜像,以启动本地应用文件。The startup module is further configured to read the memory image in the long-term open mode of the database service to start the local application file.

结合第三方面的第四种可能的实现方式,在第三方面的第五种可能的实现方式中,所述启动模块包括:With reference to the fourth possible implementation of the third aspect, in a fifth possible implementation of the third aspect, the startup module includes:

触发单元,用于触发用于内存镜像恢复的后台服务向除用于内存镜像恢复的后台服务之外的其他后台服务发送通知消息,以使所述其他后台服务在识别出所述通知消息为内存镜像恢复消息时,读取所述内存镜像;A trigger unit, configured to trigger the background service used for memory mirror recovery to send a notification message to other background services except the background service used for memory mirror recovery, so that the other background services recognize that the notification message is a memory When the image recovery message is read, the memory image is read;

启动单元,用于根据读取的所述内存镜像,启动本地应用文件。The starting unit is configured to start the local application file according to the read memory image.

第四方面,本发明实施例提供一种制作内存镜像的装置,包括:In a fourth aspect, an embodiment of the present invention provides a device for making a memory image, including:

判断模块,用于判断所述终端设备所处的状态;a judging module, configured to judge the state of the terminal device;

处理模块,用于在所述判断模块判断出所述终端设备处于内存镜像制作状态时,在启动第一个应用文件之前,且在启动数据库服务之前,进行内存镜像制作处理;A processing module, configured to perform memory mirroring processing before starting the first application file and before starting the database service when the judging module judges that the terminal device is in the memory mirroring state;

启动模块,用于在所述内存镜像制作完成之后,启动所述第一个应用文件。A startup module, configured to start the first application file after the memory image is created.

本发明实施例提供的制作内存镜像的方法和装置,终端设备通过判断其所处的状态,若判断出该终端设备处于内存镜像制作状态,则终端设备在启动第一个应用文件之前,在数据库服务的触发打开模式下进行镜像制作处理,所述终端设备在内存镜像制作完成之后,启动第一个应用文件。由于是在数据库服务的触发打开模式下,以及在第一个应用文件启动之前制作内存镜像,因而可以有效地解除数据耦合,解除了内存中文件系统的数据与存储介质中的数据之间的依赖,从而提高了系统的可靠性。In the method and device for making memory mirroring provided by the embodiments of the present invention, the terminal device judges its state, and if it is judged that the terminal device is in the state of making memory mirroring, the terminal device will be in the database before starting the first application file. The image creation process is performed in the triggered open mode of the service, and the terminal device starts the first application file after the memory image creation is completed. Since the memory mirroring is made in the triggered open mode of the database service and before the first application file is started, data coupling can be effectively decoupled, and the dependence between the data of the file system in the memory and the data in the storage medium can be removed. , thereby improving the reliability of the system.

附图说明Description of drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description These are some embodiments of the present invention. For those skilled in the art, other drawings can also be obtained according to these drawings without any creative effort.

图1为本发明制作内存镜像的方法实施例一的流程示意图;Fig. 1 is a schematic flow chart of Embodiment 1 of the method for making a memory image in the present invention;

图2为本发明制作内存镜像的方法实施例二的流程示意图;Fig. 2 is a schematic flow chart of Embodiment 2 of the method for making a memory image in the present invention;

图3为本发明制作内存镜像的方法实施例三的流程示意图;Fig. 3 is a schematic flow chart of Embodiment 3 of the method for making a memory image in the present invention;

图4为本发明制作内存镜像的装置实施例一的结构示意图;FIG. 4 is a schematic structural diagram of Embodiment 1 of a device for making a memory image in the present invention;

图5为本发明制作内存镜像的装置实施例二的结构示意图;FIG. 5 is a schematic structural diagram of Embodiment 2 of the device for making memory mirroring according to the present invention;

图6为本发明制作内存镜像的装置实施例三的结构示意图;FIG. 6 is a schematic structural diagram of Embodiment 3 of the device for making memory mirror images according to the present invention;

图7为本发明制作内存镜像的装置实施例四的结构示意图;FIG. 7 is a schematic structural diagram of Embodiment 4 of the device for making memory mirroring according to the present invention;

图8为本发明终端设备实施例一的结构示意图;FIG. 8 is a schematic structural diagram of Embodiment 1 of a terminal device according to the present invention;

图9为本发明终端设备实施例二的结构示意图。FIG. 9 is a schematic structural diagram of Embodiment 2 of a terminal device according to the present invention.

具体实施方式Detailed ways

为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments It is a part of embodiments of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of the present invention.

图1为本发明制作内存镜像的方法实施例一的流程示意图。本发明实施例提供了一种制作内存镜像的方法,该方法可以由任意执行制作内存镜像的方法的装置来执行,该装置可以通过软件和/或硬件实现。本实施例中,该装置可以集成在终端设备中。如图1所示,本实施例的方法可以包括:FIG. 1 is a schematic flowchart of Embodiment 1 of the method for making a memory image in the present invention. An embodiment of the present invention provides a method for making a memory image. The method can be executed by any device that executes the method for making a memory image. The device can be implemented by software and/or hardware. In this embodiment, the apparatus may be integrated into a terminal device. As shown in Figure 1, the method of this embodiment may include:

步骤101、终端设备判断终端设备所处的状态。Step 101, the terminal device judges the state of the terminal device.

在本实施例中,终端设备在开机后,会判断其是处于内存镜像制作状态还是处于镜像恢复状态。在实际应用中,可以通过在系统中设置一个配置值,来判断终端设备所处的状态,例如:若通过判断,获知该配置值为0,则可以得出终端设备处于镜像制作状态,若配置值为1,则可以得出终端设备处于镜像恢复状态。值得注意的是,配置值和终端设备所处的状态之间的对应关系,可以根据实际需要进行设置,本发明对此不作限制。In this embodiment, after the terminal device is turned on, it will judge whether it is in the state of creating a memory image or in the state of restoring the image. In practical applications, the state of the terminal device can be judged by setting a configuration value in the system. For example, if the configuration value is known to be 0 through judgment, it can be concluded that the terminal device is in the mirroring state. If the configuration If the value is 1, it can be concluded that the terminal device is in the mirror recovery state. It should be noted that the corresponding relationship between the configuration value and the state of the terminal device can be set according to actual needs, which is not limited in the present invention.

步骤102、若终端设备处于内存镜像制作状态,则终端设备在启动第一个应用文件之前,在数据库服务的触发打开模式下进行内存镜像制作处理。Step 102. If the terminal device is in the memory mirroring state, before starting the first application file, the terminal device performs memory mirroring processing in the triggered opening mode of the database service.

在本实施例中,在终端设备开机后,一般先启动引导小系统,引导小系统启动成功后,会对硬件设备进行初始化,然后再启动主系统,由主系统依次加载应用文件,包括加载数据库服务,应用管理器等。例如:在嵌入式操作系统中,一般先启动引导小系统BootLoader,以初始化硬件设备、建立内存空间映射图等,从而将系统的软硬件环境带到一个合适状态,为加载主系统和其他应用文件做准备。其中,可选地,终端设备可以为智能终端设备,例如智能手机、PAD等。In this embodiment, after the terminal device is powered on, generally start the small boot system first. After the small boot system is successfully started, the hardware device will be initialized, and then the main system will be started, and the main system will load the application files in sequence, including loading the database. Services, Application Manager, etc. For example: In an embedded operating system, the BootLoader is generally started first to initialize the hardware device, establish a memory space map, etc., so as to bring the system's hardware and software environment to a suitable state for loading the main system and other application files. prepare for. Wherein, optionally, the terminal device may be an intelligent terminal device, such as a smart phone, a PAD, and the like.

需要说明的是,在现有技术中,由于数据库服务启动之后,便会持续打开数据库文件并且长期持有文件的句柄,以进行数据的查询、插入或删除等操作。此时,当有后台的应用文件启动时,可能会引起系统、应用状态或设置值发生改变,且由于数据库文件处于打开状态,因此,这些改变的数据便会存储在数据库文件中,使得内存中文件系统的数据与存储介质中的数据之间产生依赖。为了解决这一问题,在本实施例中,需要使数据库服务的工作模式为触发打开模式。在实际应用中,该数据库服务可以直接以默认的触发打开模式启动,也可以在数据库服务启动时,由终端设备通过对整个系统进行检测,若获知此时系统处于制作内存镜像的状态,则将数据库服务的工作模式由长期打开模式切换为触发打开模式。值得注意的是,本实施例中对于数据库服务的工作模式可以是采用默认方式,也可以采用后续设置方式,但也可以采用其他方式,只要保证其工作模式为触发打开模式即可,本发明对此不加以限制。另外,存储介质包括数据库、磁盘等可以存储数据的系统或者设备,对于存储介质的具体形式,本实施例在此不作特别限制。It should be noted that, in the prior art, after the database service is started, the database file will be continuously opened and the handle of the file will be held for a long time, so as to perform operations such as querying, inserting or deleting data. At this time, when a background application file is started, the system, application status or setting value may change, and since the database file is open, these changed data will be stored in the database file, making the memory There is a dependency between the data in the file system and the data in the storage medium. In order to solve this problem, in this embodiment, it is necessary to make the working mode of the database service a triggered open mode. In practical applications, the database service can be started directly in the default triggered open mode, or the terminal device can detect the entire system when the database service is started. If it is known that the system is in the state of making memory mirroring, it will The working mode of the database service is switched from the long-term open mode to the triggered open mode. It is worth noting that in this embodiment, the working mode of the database service can be the default mode, or the subsequent setting mode can be adopted, but other modes can also be used, as long as the working mode is guaranteed to be the triggered open mode, the present invention is for This is not limited. In addition, the storage medium includes systems or devices capable of storing data, such as databases and disks, and this embodiment does not specifically limit the specific form of the storage medium.

举例来说,以Android系统为例进行详细说明,当Android系统第一次启动后,初始化(Init)进程会启动服务管理器(Service Manager),并且服务管理器将会依次启动其他后台服务,包括数据库服务(Sqlite)等,其中,可以直接以默认的触发打开模式启动数据库服务,也可以在数据库服务启动时,由终端设备通过对整个系统进行检测,若获知此时系统处于制作内存镜像的状态,则将该数据库服务的工作模式由长期打开模式切换为触发打开模式。For example, taking the Android system as an example to describe in detail, when the Android system starts for the first time, the initialization (Init) process will start the Service Manager (Service Manager), and the Service Manager will start other background services in turn, including Database service (Sqlite), etc., among them, the database service can be started directly with the default trigger open mode, or the terminal device can detect the entire system when the database service is started, and if it is known that the system is in the state of making memory mirroring at this time , then switch the working mode of the database service from the long-term open mode to the triggered open mode.

在本实施例中,当终端设备将所有的应用文件扫描完成之后,终端设备中的应用管理服务在准备启动第一个应用文件时,则会触发内存镜像制作过程,从而制作内存镜像。此时,由于所有的应用文件均没有启动,而且数据库服务的工作模式依旧为触发打开模式,即数据库操作处于松耦合状态,因此,内存中文件系统的数据与存储介质中的数据之间不会产生依赖。同时,由于此时开机所需要的所有文件都已准备就绪,并且系统处于即将启动第一个应用文件的时刻,因此,这一时刻是制作内存镜像的最佳时间,而且制作的内存镜像符合快速开机的时间要求。例如:在Android系统中,服务管理器将应用管理器(Application Manager)启动之后,应用管理器将准备启动应用文件,在应用服务器启动第一个应用文件之前,首先会触发内存镜像制作过程,以完成内存镜像的制作。In this embodiment, after the terminal device scans all the application files, when the application management service in the terminal device is about to start the first application file, it will trigger the process of creating a memory image, so as to create a memory image. At this time, since all application files are not started, and the working mode of the database service is still trigger open mode, that is, the database operation is in a loosely coupled state, therefore, there is no connection between the data in the file system in the memory and the data in the storage medium. Generate dependence. At the same time, since all the files required for booting are ready at this time, and the system is about to start the first application file, this moment is the best time to make a memory image, and the made memory image conforms to the fast Boot time requirements. For example: in the Android system, after the service manager starts the application manager (Application Manager), the application manager will prepare to start the application file. Before the application server starts the first application file, it will first trigger the process of making a memory image to Complete the production of the memory image.

步骤103、终端设备在内存镜像制作完成之后,启动第一个应用文件。Step 103, the terminal device starts the first application file after the memory image is created.

在本实施例中,当内存镜像制作完成后,终端设备将启动第一个应用文件,并从第一个应用文件开始依次启动本地应用文件,包括桌面启动器以及其他预加载的应用,以完成开机流程。In this embodiment, after the memory image is created, the terminal device will start the first application file, and start the local application files sequentially from the first application file, including the desktop launcher and other preloaded applications, to complete Boot process.

需要进行说明的是,在数据库服务的触发打开模式下,以及第一个应用文件启动之前制作内存镜像后,此后当终端设备重新上电或者重新开机时,均可以利用此内存镜像进行现场恢复,达到快速开机的目的,另外,在后续的工作过程中,若使用此内存镜像进行现场恢复时,只需要将平台服务做一些最新状态的数据值同步刷新即可,在具体的实现过程中,负责镜像恢复的后台服务会向其他后台服务发送通知消息,其他后台服务在接收到该通知消息之后,若根据该通知消息识别出是从内存镜像进行现场恢复,则只需重新读取数据库中的数据,应用最新状态的数据值即可。其中,平台服务包括存在于内存镜像中已经启动的系统后台服务,例如网络服务、电源服务等。而对应用文件而言,由于在制作内存镜像时,所有的应用文件都未启动,所以应用文件不需要做任何修改,便可使用最新的数据值进行加载,由此可见,采用此方式制作内存镜像不仅避免了现有技术中在每次关闭终端设备之前,都需要对最新的内存状态作一次内存镜像的现象,而且提高了系统的实用性。What needs to be explained is that in the triggered open mode of the database service, and after the memory image is created before the first application file is started, when the terminal device is powered on or restarted, the memory image can be used for on-site recovery. To achieve the purpose of fast booting. In addition, in the subsequent work process, if you use this memory image for on-site recovery, you only need to refresh the latest data values of the platform services synchronously. In the specific implementation process, responsible The background service of mirror recovery will send a notification message to other background services. After receiving the notification message, other background services only need to re-read the data in the database if they recognize the on-site recovery from memory mirroring according to the notification message. , just apply the data value of the latest state. Wherein, the platform service includes system background services that have been started in the memory image, such as network services, power services, and the like. As for the application files, since all the application files are not started when the memory image is made, the application files can be loaded with the latest data values without any modification. It can be seen that using this method to make memory The mirror image not only avoids the phenomenon in the prior art that the latest memory state needs to be mirrored before closing the terminal device each time, but also improves the practicability of the system.

本发明实施例提供的制作内存镜像的方法,终端设备通过判断其所处的状态,若判断出该终端设备处于内存镜像制作状态,则终端设备在启动第一个应用文件之前,在数据库服务的触发打开模式下进行内存镜像制作处理,内存镜像制作完成之后,启动第一个应用文件。由于是在数据库服务的触发打开模式下,以及在第一个应用文件启动之前制作内存镜像,因而可以有效地解除数据耦合,解除了内存中文件系统的数据与存储介质中的数据之间的依赖,从而提高了系统的可靠性。In the method for making memory mirroring provided by the embodiment of the present invention, the terminal device judges its state, and if it is judged that the terminal device is in the memory mirroring state, the terminal device starts the first application file before starting the first application file. In the trigger open mode, the memory mirroring process is performed. After the memory mirroring is completed, the first application file is started. Since the memory mirroring is made in the triggered open mode of the database service and before the first application file is started, data coupling can be effectively decoupled, and the dependence between the data of the file system in the memory and the data in the storage medium can be removed. , thereby improving the reliability of the system.

可选地,触发打开模式为在终端设备检测到数据库操作请求时打开数据库文件,且在终端检测未检测到数据库操作请求或检测到数据库操作请求访问结束时关闭数据库文件的处理模式。Optionally, the trigger opening mode is a processing mode in which the database file is opened when the terminal device detects a database operation request, and the database file is closed when the terminal detects that no database operation request is detected or that the database operation request access ends.

具体地,当检测到有具体地数据库操作请求时,终端设备便打开数据库文件,且当没有检测到数据库操作请求或者数据库操作请求已经访问结束时,则将数据库文件立刻关闭,采用触发打开模式可以解除数据长期对存储介质的依赖,其中,数据库操作请求例如可以为查询、添加、删除等操作。Specifically, when a specific database operation request is detected, the terminal device opens the database file, and when no database operation request is detected or the database operation request has been accessed, the database file is immediately closed, and the trigger opening mode can be used. Remove the long-term dependence of data on the storage medium, wherein the database operation request can be query, add, delete and other operations, for example.

可选地,终端设备对系统文件进行编译项的配置,以解除内存中的数据与存储介质中的数据之间的耦合;Optionally, the terminal device configures compiled items for the system file, so as to release the coupling between the data in the memory and the data in the storage medium;

则在数据库服务的触发打开模式下进行内存镜像制作处理,包括:Then, in the triggered opening mode of the database service, the memory mirroring process is performed, including:

终端设备在解除内存中的数据与存储介质中的数据之间的耦合之后,在数据库服务的触发打开模式下进行内存镜像制作处理。After releasing the coupling between the data in the memory and the data in the storage medium, the terminal device performs the memory mirroring process in the triggered opening mode of the database service.

具体地,若某些功能选项之间存在不通过数据库而产生耦合的现象,此时,可以在编译阶段来解除产生的耦合。在实际应用中,终端设备可以通过对系统文件进行编译项的配置,关闭产生数据耦合的某些功能选项,以去除产生依赖的编译选项,从而解除内存中的数据与存储介质中的数据之间的耦合,达到解除内存中文件系统的数据与存储介质中的数据之间的依赖的目的。例如:对于Android系统来说,可以采用user编译模式进行静态编译,则在运行不产生eng模式下dalvik虚拟机为调试而产生的odex文件。在编译阶段解除产生的数据耦合之后,在数据库服务的触发打开模式下进行内存镜像制作处理。Specifically, if there is a phenomenon of coupling between some functional options without going through the database, at this time, the resulting coupling can be released at the compilation stage. In practical applications, the terminal device can disable some functional options that generate data coupling by configuring the compilation items of the system file, so as to remove the compilation options that generate dependencies, thereby releasing the connection between the data in the memory and the data in the storage medium. Coupling to achieve the purpose of releasing the dependence between the data in the file system in the memory and the data in the storage medium. For example: for the Android system, the user compilation mode can be used for static compilation, and the odex file generated by the dalvik virtual machine for debugging in the eng mode will not be generated during operation. After the generated data coupling is released in the compilation phase, the memory mirroring process is performed in the triggered open mode of the database service.

可选地,在数据库服务的触发打开模式下进行内存镜像制作处理之前,所述方法还包括:终端设备判断数据库服务的工作模式是否为长期打开模式;若数据库服务的工作模式为长期打开模式,则将数据库服务的工作模式由长期打开模式切换为触发打开模式。Optionally, before the memory mirroring process is performed in the triggered open mode of the database service, the method further includes: the terminal device judges whether the working mode of the database service is a long-term open mode; if the working mode of the database service is a long-term open mode, Then switch the working mode of the database service from the long-term open mode to the triggered open mode.

本发明实施例提供的制作内存镜像的方法,终端设备通过判断其所处的状态,若判断出该终端设备处于内存镜像制作状态,则终端设备在启动第一个应用文件之前,在数据库服务的触发打开模式下制作内存镜像,内存镜像制作完成之后,启动第一个应用文件。由于是在数据库服务的触发打开模式下,以及在第一个应用文件启动之前制作内存镜像,因而可以有效地解除数据耦合,解除了内存中文件系统的数据与存储介质中的数据之间的依赖,从而提高了系统的可靠性。另外,终端设备通过在对系统文件进行编译项的配置时,也可以去除产生依赖的编译选项,以解除数据的耦合,保证了内存镜像中的数据与存储介质中数据的一致性。In the method for making memory mirroring provided by the embodiment of the present invention, the terminal device judges its state, and if it is judged that the terminal device is in the memory mirroring state, the terminal device starts the first application file before starting the first application file. Create a memory image in the trigger open mode. After the memory image is created, start the first application file. Since the memory mirroring is made in the triggered open mode of the database service and before the first application file is started, data coupling can be effectively decoupled, and the dependence between the data of the file system in the memory and the data in the storage medium can be removed. , thereby improving the reliability of the system. In addition, when the terminal device configures the compilation items of the system files, it can also remove the compilation options that generate dependencies, so as to decouple the data and ensure the consistency of the data in the memory image and the data in the storage medium.

图2为本发明制作内存镜像的方法实施例二的流程示意图,本实施例在制作内存镜像的方法实施例一的基础上,对终端设备利用内存镜像实现快速开机的实施例,做详细说明。如图2所示,本实施例的方法可以包括:FIG. 2 is a schematic flow diagram of Embodiment 2 of the method for making memory mirroring according to the present invention. On the basis of Embodiment 1 of the method for making memory mirroring, this embodiment describes in detail an embodiment in which a terminal device utilizes memory mirroring to realize fast booting. As shown in Figure 2, the method of this embodiment may include:

步骤201、终端设备判断终端设备所处的状态。Step 201, the terminal device judges the state of the terminal device.

步骤201与步骤101类似,此处不再赘述。Step 201 is similar to step 101 and will not be repeated here.

步骤202、若终端设备处于镜像恢复状态,则将数据库服务的工作模式由触发打开模式切换为长期打开模式。Step 202, if the terminal device is in the mirror recovery state, switch the working mode of the database service from the triggered open mode to the long-term open mode.

在本实施例中,当用户将终端设备重新上电,从内存镜像进行现场恢复时,终端设备通过判断,若获知此时系统处于镜像恢复的状态,则将数据库服务的工作模式由触发打开模式重新切换为长期打开模式,此时,数据库服务将持续打开且长期持有文件的句柄,即数据库服务的性能恢复到正常使用的状态,以完成数据的查询、插入或删除等操作。例如:在Android系统中,当用户将终端设备重新上电之后,BootLoader会进行镜像恢复,此时,数据库服务(Sqlite)的工作模式将会由触发打开模式重新切换为长期打开模式,并且数据库服务将长期持有db文件句柄。In this embodiment, when the user powers on the terminal device again and restores the scene from memory mirroring, the terminal device judges that if it knows that the system is in the state of mirroring recovery at this time, it will change the working mode of the database service from the triggered open mode to Switch to the long-term open mode again. At this time, the database service will continue to open and hold the handle of the file for a long time, that is, the performance of the database service will return to the normal use state to complete data query, insert or delete operations. For example: in the Android system, after the user powers on the terminal device again, BootLoader will restore the mirror image. At this time, the working mode of the database service (Sqlite) will be switched from the trigger open mode to the long-term open mode, and the database service Will hold the db file handle for a long time.

步骤203、终端设备在数据库服务的长期打开模式下,读取内存镜像,以启动本地应用文件。Step 203, the terminal device reads the memory image in the long-term open mode of the database service to start the local application file.

在本实施例中,将数据库服务的工作模式切换为长期打开模式之后,终端设备可以根据制作的内存镜像,读取内存镜像,以完成终端设备的开机过程,在具体地实现过程中,终端设备只需要将平台服务做一些最新状态的数据值同步刷新即可,在具体的实现过程中,负责镜像恢复的后台服务会向除负责内存镜像恢复的后台服务之外的其他后台服务发送通知消息,其他后台服务在接收到该通知消息之后,若根据该通知消息识别出是从内存镜像进行现场恢复,则只需重新读取数据库中的数据,应用最新状态的数据值即可。其中,平台服务包括存在于内存镜像中已经启动的系统后台服务,例如网络服务、电源服务等。而对应用文件而言,由于在制作内存镜像时,所有的应用文件都未启动,所以应用文件不需要做任何修改,便可使用最新的数据值进行加载。另外,由于内存镜像中的数据和存储介质中的数据处于松耦合状态,因而在快速开机过程中系统不会发生崩溃现象。因此,终端设备可以顺利地启动桌面应用以及其他定义为预加载的业务,例如,桌面启动器Launcher以及其他预加载的应用。In this embodiment, after switching the working mode of the database service to the long-term open mode, the terminal device can read the memory image according to the created memory image to complete the boot process of the terminal device. In the specific implementation process, the terminal device It is only necessary to refresh the data values of the latest state of the platform service synchronously. In the specific implementation process, the background service responsible for mirror recovery will send notification messages to other background services except the background service responsible for memory mirror recovery. After receiving the notification message, other background services only need to re-read the data in the database and apply the data value of the latest state if they recognize that the on-site recovery is performed from the memory mirror according to the notification message. Wherein, the platform service includes system background services that have been started in the memory image, such as network services, power services, and the like. As for the application files, since all the application files are not started when the memory image is made, the application files can be loaded with the latest data values without any modification. In addition, because the data in the memory mirror and the data in the storage medium are in a loosely coupled state, the system will not crash during the fast boot process. Therefore, the terminal device can smoothly start the desktop application and other services defined as preloading, for example, the desktop launcher Launcher and other preloading applications.

本发明实施例提供的制作内存镜像的方法,终端设备通过判断其所处的状态,若判断出该终端设备处于内存镜像制作状态,则终端设备在启动第一个应用文件之前,在数据库服务的触发打开模式下制作内存镜像,该内存镜像制作完成之后,启动第一个应用文件。由于是在数据库服务的触发打开模式下,以及在第一个应用文件启动之前制作内存镜像,因而可以有效地解除数据耦合,解除了内存中文件系统的数据与存储介质中的数据之间的依赖,从而提高了系统的可靠性。另外,当终端设备处于镜像恢复状态时,将数据库服务的工作模式切换为长期打开模式,并在此工作模式下,读取内存镜像,以达到利用内存镜像进行快速开机的目的。In the method for making memory mirroring provided by the embodiment of the present invention, the terminal device judges its state, and if it is judged that the terminal device is in the memory mirroring state, the terminal device starts the first application file before starting the first application file. Create a memory image in the trigger open mode. After the memory image is created, start the first application file. Since the memory mirroring is made in the triggered open mode of the database service and before the first application file is started, data coupling can be effectively decoupled, and the dependence between the data of the file system in the memory and the data in the storage medium can be removed. , thereby improving the reliability of the system. In addition, when the terminal device is in the mirror recovery state, the working mode of the database service is switched to the long-term open mode, and in this working mode, the memory mirror is read to achieve the purpose of using the memory mirror for fast booting.

图3为本发明制作内存镜像的方法实施例三的流程示意图。本发明实施例提供了一种制作内存镜像的方法,该方法可以由任意执行制作内存镜像的方法的装置来执行,该装置可以通过软件和/或硬件实现。本实施例中,该装置可以集成在终端设备中。如图3所示,本实施例的方法可以包括:FIG. 3 is a schematic flow chart of Embodiment 3 of the method for making a memory image in the present invention. An embodiment of the present invention provides a method for making a memory image. The method can be executed by any device that executes the method for making a memory image. The device can be implemented by software and/or hardware. In this embodiment, the apparatus may be integrated into a terminal device. As shown in Figure 3, the method of this embodiment may include:

步骤301、终端设备判断终端设备所处的状态。Step 301, the terminal device judges the state of the terminal device.

在本实施例中,终端设备在开机后,会判断其是处于内存镜像制作状态还是处于镜像恢复状态。在实际应用中,可以通过在系统中设置一个配置值,来判断终端设备所处的状态,例如:若通过判断,获知该配置值为0,则可以得出终端设备处于镜像制作状态,若配置值为1,则可以得出终端设备处于镜像恢复状态。值得注意的是,配置值和终端设备所处的状态之间的对应关系,可以根据实际需要进行设置,本发明对此不作限制。In this embodiment, after the terminal device is turned on, it will judge whether it is in the state of creating a memory image or in the state of restoring the image. In practical applications, the state of the terminal device can be judged by setting a configuration value in the system. For example, if the configuration value is known to be 0 through judgment, it can be concluded that the terminal device is in the mirroring state. If the configuration If the value is 1, it can be concluded that the terminal device is in the mirror recovery state. It should be noted that the corresponding relationship between the configuration value and the state of the terminal device can be set according to actual needs, which is not limited in the present invention.

步骤302、若终端设备处于内存镜像制作状态,则终端设备在启动第一个应用文件之前,且在启动数据库服务之前,进行内存镜像制作处理。Step 302. If the terminal device is in the memory mirroring state, the terminal device performs memory mirroring processing before starting the first application file and before starting the database service.

在现有技术中,由于数据库服务启动之后,便会持续打开数据库文件并且长期持有文件的句柄,以进行数据的查询、插入或删除等操作,此时,当有后台的应用文件启动时,可能会引起系统、应用状态或设置值发生改变,且由于数据库文件处于打开状态,因此,这些改变的数据便会存储在数据库文件中,使得内存中文件系统的数据与存储介质中的数据之间产生依赖。为了解决这一问题,在本实施例中,若终端设备处于内存镜像制作状态时,当终端设备将所有的应用文件扫描完成之后,在启动第一个应用文件之前,而且在数据库服务启动之前,触发内存镜像制作过程,从而制作内存镜像。此时,由于所有的应用文件均没有启动,而且数据库服务也没有启动,因此,内存中文件系统的数据与存储介质中的数据之间不会产生依赖。In the prior art, after the database service is started, it will continue to open the database file and hold the handle of the file for a long time to perform operations such as data query, insertion or deletion. At this time, when a background application file is started, It may cause the system, application state or setting value to change, and because the database file is open, the changed data will be stored in the database file, so that the data in the file system in the memory and the data in the storage medium Generate dependence. In order to solve this problem, in this embodiment, if the terminal device is in the memory mirroring state, after the terminal device has scanned all the application files, before starting the first application file, and before the database service is started, Trigger the memory mirroring process to make a memory mirror. At this time, since all the application files are not started, and the database service is not started, there is no dependence between the data in the file system in the memory and the data in the storage medium.

步骤303、终端设备在内存镜像制作完成之后,启动第一个应用文件。Step 303, the terminal device starts the first application file after the memory image is created.

在本实施例中,当内存镜像制作完成后,终端设备将启动第一个应用文件,并从第一个应用文件开始依次启动本地应用文件,包括桌面启动器以及其他预加载的应用,以完成开机流程。In this embodiment, after the memory image is created, the terminal device will start the first application file, and start the local application files sequentially from the first application file, including the desktop launcher and other preloaded applications, to complete Boot process.

本发明实施例提供的制作内存镜像的方法,终端设备通过判断其所处的状态,若判断出该终端设备处于内存镜像制作状态,则终端设备在启动第一个应用文件之前,并且在数据库服务启动之前进行内存镜像制作处理,内存镜像制作完成之后,启动第一个应用文件。由于是在第一个应用文件启动之前,并且是在数据库服务启动之前制作内存镜像,因而可以有效地解除数据耦合,解除了内存中文件系统的数据与存储介质中的数据之间的依赖,从而提高了系统的可靠性。In the method for making a memory image provided by the embodiment of the present invention, the terminal device judges its state, and if it is judged that the terminal device is in the memory mirroring state, the terminal device starts the first application file, and before starting the first application file, and in the database service The memory mirroring process is performed before starting, and after the memory mirroring is completed, the first application file is started. Since the memory mirroring is made before the first application file is started and before the database service is started, the data coupling can be effectively decoupled, and the dependence between the data in the file system in the memory and the data in the storage medium is removed, thus Improve the reliability of the system.

图4为本发明制作内存镜像的装置实施例一的结构示意图。如图4所示,本发明实施例提供的制作内存镜像的装置400包括判断模块401、处理模块402和启动模块403。FIG. 4 is a schematic structural diagram of Embodiment 1 of the device for making a memory image according to the present invention. As shown in FIG. 4 , an apparatus 400 for making a memory image provided by an embodiment of the present invention includes a judging module 401 , a processing module 402 and a starting module 403 .

其中,判断模块401用于判断所述终端设备所述的状态;处理模块402用于在所述判断模块401判断出所述终端设备处于内存镜像制作状态时,在启动第一个应用文件之前,在数据库服务的触发打开模式下进行内存镜像制作处理;启动模块403用于在所述内存镜像制作完成之后,启动所述第一应用文件。Wherein, the judging module 401 is used for judging the state of the terminal device; the processing module 402 is used for judging that the terminal device is in the memory mirroring state by the judging module 401, before starting the first application file, The memory image creation process is performed in the triggered opening mode of the database service; the starting module 403 is configured to start the first application file after the memory image creation is completed.

本发明实施例提供的制作内存镜像的装置,通过判断终端设备所处的状态,若判断出该终端设备处于内存镜像制作状态,则在启动第一个应用文件之前,在数据库服务的触发打开模式下进行内存镜像制作处理,内存镜像制作完成之后,启动第一个应用文件。由于是在数据库服务的触发打开模式下,以及在第一个应用文件启动之前制作内存镜像,因而可以有效地解除数据耦合,解除了内存中文件系统的数据与存储介质中的数据之间的依赖,从而提高了系统的可靠性。The device for making memory mirroring provided by the embodiments of the present invention judges the state of the terminal device, if it is judged that the terminal device is in the state of making memory mirroring, before starting the first application file, trigger the opening mode of the database service Next, the memory mirroring process is performed, and after the memory mirroring is completed, the first application file is started. Since the memory mirroring is made in the triggered open mode of the database service and before the first application file is started, data coupling can be effectively decoupled, and the dependence between the data of the file system in the memory and the data in the storage medium can be removed. , thereby improving the reliability of the system.

图5为本发明制作内存镜像的装置实施例二的结构示意图,如图5所示,本实施例在图4所示实施例的基础上,所述装置400还包括检测模块404。FIG. 5 is a schematic structural diagram of Embodiment 2 of the device for making a memory image according to the present invention. As shown in FIG. 5 , this embodiment is based on the embodiment shown in FIG. 4 , and the device 400 further includes a detection module 404 .

其中,检测模块404用于检测是否存在数据库操作请求,或者检测所述数据库操作请求的访问是否结束;所述触发打开模式为在所述检测模块404检测到数据库操作请求时打开数据库文件,且在所述检测模块404未检测到所述数据库操作请求或者检测到所述数据库操作请求的访问结束时关闭所述数据库文件的处理模式。Wherein, the detection module 404 is used to detect whether there is a database operation request, or detect whether the access of the database operation request ends; the trigger opening mode is to open the database file when the detection module 404 detects the database operation request, and The processing mode of closing the database file when the detection module 404 does not detect the database operation request or detects that the access of the database operation request ends.

可选地,所述处理模块402还用于对系统文件进行编译项的配置,以解除内存中的数据与存储介质中的数据之间的耦合;Optionally, the processing module 402 is also configured to configure compiled items for the system file, so as to release the coupling between the data in the memory and the data in the storage medium;

所述处理模块402还用于在解除所述内存中的数据与存储介质中的数据之间数据的耦合之后,在所述数据库服务的触发打开模式下进行内存镜像制作处理。The processing module 402 is further configured to perform memory image creation processing in the triggered open mode of the database service after releasing the data coupling between the data in the internal memory and the data in the storage medium.

可选地,所述装置400还包括切换模块405,其中,Optionally, the device 400 further includes a switching module 405, wherein,

所述判断模块401还用于判断所述数据库服务的工作模式是否为长期打开模式;The judging module 401 is also used to judge whether the working mode of the database service is a long-term open mode;

所述切换模块405用于在所述判断模块401判断出所述数据库服务的工作模式为长期打开模式时,将所述数据库服务的工作模式由所述长期打开模式切换为所述触发打开模式。The switching module 405 is configured to switch the working mode of the database service from the long-term open mode to the triggered open mode when the judging module 401 determines that the working mode of the database service is the long-term open mode.

本实施例的制作内存镜像的装置,可以用于执行本发明任意实施例所提供的制作内存镜像的方法的技术方案,其实现原理和技术效果类似,此处不再赘述。The device for making memory mirroring in this embodiment can be used to implement the technical solution of the method for making memory mirroring provided by any embodiment of the present invention, and its implementation principle and technical effect are similar, and will not be repeated here.

图6为本发明制作内存镜像的装置实施例三的结构示意图,如图6所示,本实施例在图4所示实施例的基础上,所述装置400还包括切换模块406。FIG. 6 is a schematic structural diagram of Embodiment 3 of the device for making memory mirroring according to the present invention. As shown in FIG. 6 , this embodiment is based on the embodiment shown in FIG. 4 , and the device 400 further includes a switching module 406 .

其中,所述切换模块406用于在所述判断模块401判断出所述终端设备处于镜像恢复状态,则将所述数据库服务的工作模式由所述触发打开模式切换为长期打开模式;Wherein, the switching module 406 is used to switch the working mode of the database service from the triggered open mode to the long-term open mode when the judging module 401 determines that the terminal device is in the mirror recovery state;

所述启动模块403还用于在所述数据库服务的长期打开模式下,读取所述内存镜像,以启动本地应用文件。The startup module 403 is further configured to read the memory image in the long-term open mode of the database service to start the local application file.

可选地,所述启动模块403包括:Optionally, the startup module 403 includes:

触发单元4031用于触发用于内存镜像恢复的后台服务向除用于内存镜像恢复的后台服务之外的其他后台服务发送通知消息,以使所述其他后台服务在识别出所述通知消息为内存镜像恢复消息时,读取所述内存镜像;The triggering unit 4031 is used to trigger the background service used for memory mirror recovery to send a notification message to other background services except the background service used for memory mirror recovery, so that the other background services recognize that the notification message is a memory When the image recovery message is read, the memory image is read;

启动单元4032用于根据读取的所述内存镜像,启动本地应用文件。The starting unit 4032 is configured to start the local application file according to the read memory image.

本实施例的制作内存镜像的装置,可以用于执行本发明任意实施例所提供的制作内存镜像的方法的技术方案,其实现原理和技术效果类似,此处不再赘述。The device for making memory mirroring in this embodiment can be used to implement the technical solution of the method for making memory mirroring provided by any embodiment of the present invention, and its implementation principle and technical effect are similar, and will not be repeated here.

图7为本发明制作内存镜像的装置实施例四的结构示意图。如图7所示,本发明实施例提供的制作内存镜像的装置700包括判断模块701、处理模块702和启动模块703。FIG. 7 is a schematic structural diagram of Embodiment 4 of the device for making memory mirroring according to the present invention. As shown in FIG. 7 , an apparatus 700 for making a memory image provided by an embodiment of the present invention includes a judging module 701 , a processing module 702 and a starting module 703 .

其中,判断模块701用于判断所述终端设备所处的状态;处理模块702用于在所述判断模块701判断出所述终端设备处于内存镜像制作状态时,在启动第一个应用文件之前,且在启动数据库服务之前,进行内存镜像制作处理;启动模块703用于在所述内存镜像制作完成之后,启动所述第一个应用文件。Wherein, the judging module 701 is used for judging the state of the terminal device; the processing module 702 is used for judging that the terminal device is in the memory mirroring state by the judging module 701, before starting the first application file, And before starting the database service, the process of creating a memory image is performed; the starting module 703 is configured to start the first application file after the memory image is created.

本发明实施例提供的制作内存镜像的装置,通过判断终端设备所处的状态,若判断出该终端设备处于内存镜像制作状态,则在启动第一个应用文件之前,且在启动数据库服务之前,进行内存镜像制作处理,内存镜像制作完成之后,启动第一个应用文件。由于是在第一个应用文件启动之前,且在数据库服务启动之前制作内存镜像,因而可以有效地解除数据耦合,解除了内存中文件系统的数据与存储介质中的数据之间的依赖,从而提高了系统的可靠性。The device for making memory mirroring provided by the embodiment of the present invention judges the state of the terminal device, if it is judged that the terminal device is in the state of making memory mirroring, before starting the first application file and before starting the database service, Perform memory image creation processing, and start the first application file after the memory image creation is completed. Since the memory mirroring is made before the first application file is started and before the database service is started, the data coupling can be effectively decoupled, and the dependence between the data in the file system in the memory and the data in the storage medium is removed, thereby improving system reliability.

图8为本发明终端设备实施例一的结构示意图。如图8所示,本实施例提供的终端设备800包括处理器801和存储器802,其中,存储器802存储执行指令,当终端设备运行时,处理器801与存储器802之间通信,处理器801调用存储器802中的执行指令,用于执行以下操作:FIG. 8 is a schematic structural diagram of Embodiment 1 of a terminal device according to the present invention. As shown in Figure 8, the terminal device 800 provided by this embodiment includes a processor 801 and a memory 802, wherein the memory 802 stores execution instructions, and when the terminal device is running, the processor 801 communicates with the memory 802, and the processor 801 calls The execution instructions in the memory 802 are used to perform the following operations:

判断所述终端设备所处的状态;judging the state of the terminal device;

若所述终端设备处于内存镜像制作状态,则在启动第一个应用文件之前,在数据库服务的触发打开模式下进行内存镜像制作处理;If the terminal device is in the memory mirroring state, before starting the first application file, the memory mirroring process is performed under the triggering open mode of the database service;

在所述内存镜像制作完成之后,启动所述第一个应用文件。After the memory image is created, start the first application file.

可选地,所述触发打开模式为在检测到数据库操作请求时打开数据库文件,且在未检测到所述数据库操作请求或者检测到所述数据库操作请求的访问结束时关闭所述数据库文件的处理模式。Optionally, the trigger opening mode is to open the database file when a database operation request is detected, and close the database file when the database operation request is not detected or the database operation request is detected. model.

可选地,在所述在数据库服务的触发打开模式下进行内存镜像制作处理之前,所述方法还包括:Optionally, before performing the process of creating a memory image in the triggered open mode of the database service, the method further includes:

对系统文件进行编译项的配置,以解除内存中的数据与存储介质中的数据之间的耦合;Configure the compilation items for the system files to decouple the data in the memory and the data in the storage medium;

则所述在数据库服务的触发打开模式下进行内存镜像制作处理,具体包括:Then, the memory mirroring process is performed under the triggered open mode of the database service, specifically including:

在解除内存中的数据与存储介质中的数据之间的耦合之后,在所述数据库服务的触发打开模式下进行内存镜像制作处理。After the coupling between the data in the memory and the data in the storage medium is released, the memory mirroring process is performed in the triggered open mode of the database service.

可选地,所述在数据库服务的触发打开模式下进行内存镜像制作处理之前,所述方法还包括:Optionally, before performing the memory mirroring process in the triggered open mode of the database service, the method further includes:

判断所述数据库服务的工作模式是否为长期打开模式;Judging whether the working mode of the database service is a long-term open mode;

若所述数据库服务的工作模式为长期打开模式,则将所述数据库服务的工作模式由所述长期打开模式切换为所述触发打开模式。If the working mode of the database service is the long-term open mode, switch the working mode of the database service from the long-term open mode to the triggered open mode.

可选地,所述方法还包括:Optionally, the method also includes:

若所述终端设备处于镜像恢复状态,则将所述数据库服务的工作模式由所述触发打开模式切换为长期打开模式;If the terminal device is in the mirror recovery state, then switch the working mode of the database service from the trigger open mode to the long-term open mode;

所述终端设备在所述数据库服务的长期打开模式下,读取所述内存镜像,以启动本地应用文件。In the long-term open mode of the database service, the terminal device reads the memory image to start the local application file.

可选地,所述读取所述内存镜像,以启动本地应用文件,具体包括:Optionally, the reading the memory image to start the local application file specifically includes:

触发用于内存镜像恢复的后台服务向除用于内存镜像恢复的后台服务之外的其他后台服务发送通知消息,以使所述其他后台服务在识别出所述通知消息为内存镜像恢复消息时,读取所述内存镜像;Triggering the background service for memory mirroring recovery to send a notification message to other background services except the background service for memory mirroring recovery, so that when the other background services recognize that the notification message is a memory mirroring recovery message, read the memory image;

根据读取的所述内存镜像,启动本地应用文件。Start the local application file according to the read memory image.

本实施例提供的终端设备,可以用于执行本发明任意实施例所提供的制作内存镜像的装置的技术方案,其实现原理和技术效果类似,此处不再赘述。The terminal device provided in this embodiment can be used to implement the technical solution of the device for creating a memory image provided in any embodiment of the present invention, and its implementation principle and technical effect are similar, and will not be repeated here.

图9为本发明终端设备实施例二的结构示意图。如图9所示,本实施例提供的终端设备900包括处理器901和存储器902,其中,存储器902存储执行指令,当终端设备运行时,处理器901与存储器902之间通信,处理器901调用存储器902中的执行指令,用于执行以下操作:FIG. 9 is a schematic structural diagram of Embodiment 2 of a terminal device according to the present invention. As shown in Figure 9, the terminal device 900 provided by this embodiment includes a processor 901 and a memory 902, wherein the memory 902 stores execution instructions, and when the terminal device is running, the processor 901 communicates with the memory 902, and the processor 901 calls The execution instructions in the memory 902 are used to perform the following operations:

判断所述终端设备所处的状态;judging the state of the terminal device;

若所述终端设备处于内存镜像制作状态,则在启动第一个应用文件之前,且在启动数据库服务之前,进行内存镜像制作处理;If the terminal device is in the memory mirroring state, before starting the first application file and before starting the database service, perform memory mirroring processing;

在所述内存镜像制作完成之后,启动所述第一个应用文件。After the memory image is created, start the first application file.

本实施例提供的终端设备,可以用于执行本发明任意实施例所提供的制作内存镜像的装置的技术方案,其实现原理和技术效果类似,此处不再赘述。The terminal device provided in this embodiment can be used to implement the technical solution of the device for creating a memory image provided in any embodiment of the present invention, and its implementation principle and technical effect are similar, and will not be repeated here.

本领域普通技术人员可以理解:实现上述各方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成。前述的程序可以存储于一计算机可读取存储介质中。该程序在执行时,执行包括上述各方法实施例的步骤;而前述的存储介质包括:ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。Those of ordinary skill in the art can understand that all or part of the steps for implementing the above method embodiments can be completed by program instructions and related hardware. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps including the above-mentioned method embodiments; and the aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk and other various media that can store program codes.

最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present invention, rather than limiting them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: It is still possible to modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the technical solutions of the various embodiments of the present invention. scope.

Claims (14)

1. A method of making a memory mirror, comprising:
the terminal equipment judges the state of the terminal equipment;
if the terminal equipment is in the memory mirror image manufacturing state, before the terminal equipment starts the first application file, memory mirror image manufacturing processing is carried out in a triggering opening mode of database service;
and the terminal equipment starts the first application file after the memory mirror image is manufactured.
2. The method according to claim 1, wherein the triggered opening mode is a processing mode for opening a database file when the terminal device detects a database operation request, and closing the database file when the terminal device does not detect the database operation request or detects that access to the database operation request is finished.
3. The method according to claim 1 or 2, wherein before the memory mirroring process in the triggered open mode of the database service, the method further comprises:
the terminal equipment configures a compiling item for the system file so as to release the coupling between the data in the memory and the data in the storage medium;
then, the performing memory mirroring in the triggered open mode of the database service includes:
and after the terminal equipment releases the coupling between the data in the memory and the data in the storage medium, performing memory mirror image manufacturing processing in a triggering opening mode of the database service.
4. The method according to any of claims 1-3, wherein before performing the memory mirroring process in the triggered open mode of the database service, the method further comprises:
the terminal equipment judges whether the working mode of the database service is a long-term open mode or not;
and if the working mode of the database service is a long-term opening mode, switching the working mode of the database service from the long-term opening mode to the trigger opening mode.
5. The method of claim 1, further comprising:
if the terminal equipment is in the mirror image recovery state, switching the working mode of the database service from the trigger opening mode to a long-term opening mode;
and the terminal equipment reads the memory mirror image in a long-term open mode of the database service so as to start a local application file.
6. The method according to claim 5, wherein the reading the memory image to start a local application file specifically comprises:
the terminal device triggers a background service for restoring the memory mirror image to send a notification message to other background services except the background service for restoring the memory mirror image, so that the other background services read the memory mirror image when recognizing that the notification message is a memory mirror image restoring message;
and the terminal equipment starts a local application file according to the read memory mirror image.
7. A method of making a memory mirror, comprising:
the terminal equipment judges the state of the terminal equipment;
if the terminal equipment is in the memory mirror image manufacturing state, before the terminal equipment starts the first application file and before the terminal equipment starts the database service, memory mirror image manufacturing processing is carried out;
and the terminal equipment starts the first application file after the memory mirror image is manufactured.
8. An apparatus for making a memory mirror, comprising:
the judging module is used for judging the state of the terminal equipment;
the processing module is used for carrying out memory mirror image manufacturing processing in a triggering opening mode of database service before starting the first application file when the judging module judges that the terminal equipment is in the memory mirror image manufacturing state;
and the starting module is used for starting the first application file after the memory mirror image is manufactured.
9. The apparatus of claim 8, further comprising: the detection module is used for detecting whether a database operation request exists or whether the access of the database operation request is finished;
the triggered opening mode is a processing mode for opening a database file when the detection module detects a database operation request, and closing the database file when the detection module does not detect the database operation request or detects that the access of the database operation request is finished.
10. The apparatus of claim 8 or 9, wherein the processing module is further configured to configure a compilation item for decoupling data in the memory from data in the storage medium;
the processing module is further configured to perform memory mirroring in the triggered open mode of the database service after decoupling the data in the memory from the data in the storage medium.
11. The apparatus according to any one of claims 8-10, further comprising a switching module; wherein,
the judging module is also used for judging whether the working mode of the database service is a long-term open mode;
the switching module is configured to switch the working mode of the database service from the long-term open mode to the trigger open mode when the judging module judges that the working mode of the database service is the long-term open mode.
12. The apparatus of claim 8, further comprising a switching module; wherein,
the switching module is used for switching the working mode of the database service from the triggering opening mode to a long-term opening mode when the judging module judges that the terminal equipment is in the mirror image recovery state;
the starting module is further configured to read the memory mirror image in a long-term open mode of the database service to start a local application file.
13. The apparatus of claim 12, wherein the activation module comprises:
the trigger unit is used for triggering the background service for restoring the memory mirror image to send a notification message to other background services except the background service for restoring the memory mirror image, so that the other background services read the memory mirror image when recognizing that the notification message is the memory mirror image restoring message;
and the starting unit is used for starting the local application file according to the read memory mirror image.
14. An apparatus for making a memory mirror, comprising:
the judging module is used for judging the state of the terminal equipment;
the processing module is used for carrying out memory mirror image manufacturing processing before starting the first application file and before starting the database service when the judging module judges that the terminal equipment is in the memory mirror image manufacturing state;
and the starting module is used for starting the first application file after the memory mirror image is manufactured.
CN201510174738.4A 2015-04-14 2015-04-14 The method and apparatus for making memory mirror Active CN104750579B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510174738.4A CN104750579B (en) 2015-04-14 2015-04-14 The method and apparatus for making memory mirror

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510174738.4A CN104750579B (en) 2015-04-14 2015-04-14 The method and apparatus for making memory mirror

Publications (2)

Publication Number Publication Date
CN104750579A true CN104750579A (en) 2015-07-01
CN104750579B CN104750579B (en) 2017-12-29

Family

ID=53590316

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510174738.4A Active CN104750579B (en) 2015-04-14 2015-04-14 The method and apparatus for making memory mirror

Country Status (1)

Country Link
CN (1) CN104750579B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105718263A (en) * 2016-01-19 2016-06-29 合肥联宝信息技术有限公司 Method and system for realizing cloud based distributed computer
CN109716280A (en) * 2016-09-30 2019-05-03 甲骨文国际公司 Flexible rank storage arrangement

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070180307A1 (en) * 2003-07-15 2007-08-02 Xiv Limited Method & system for resynchronizing data between a primary and mirror data storage system
CN101794232A (en) * 2009-06-23 2010-08-04 深圳市朗科科技股份有限公司 Method for quickly starting system
CN102207881A (en) * 2011-07-07 2011-10-05 电子科技大学 Quick operation system start-up method based on Android
US8959321B1 (en) * 2009-11-25 2015-02-17 Sprint Communications Company L.P. Fast restart on a virtual machine

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070180307A1 (en) * 2003-07-15 2007-08-02 Xiv Limited Method & system for resynchronizing data between a primary and mirror data storage system
CN101794232A (en) * 2009-06-23 2010-08-04 深圳市朗科科技股份有限公司 Method for quickly starting system
US8959321B1 (en) * 2009-11-25 2015-02-17 Sprint Communications Company L.P. Fast restart on a virtual machine
CN102207881A (en) * 2011-07-07 2011-10-05 电子科技大学 Quick operation system start-up method based on Android

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105718263A (en) * 2016-01-19 2016-06-29 合肥联宝信息技术有限公司 Method and system for realizing cloud based distributed computer
CN105718263B (en) * 2016-01-19 2018-11-13 合肥联宝信息技术有限公司 A kind of method and system for realizing distributed computer based on cloud
CN109716280A (en) * 2016-09-30 2019-05-03 甲骨文国际公司 Flexible rank storage arrangement
CN109716280B (en) * 2016-09-30 2021-05-11 甲骨文国际公司 Flexible memory rank storage arrangement

Also Published As

Publication number Publication date
CN104750579B (en) 2017-12-29

Similar Documents

Publication Publication Date Title
CN107870968B (en) Performing real-time updates to a file system volume
CN106970873B (en) On-line mock testing method, device and system
US8281093B1 (en) Systems and methods for creating consolidated backups of snapshot hierarchies
TW201102924A (en) Embedded electronic device and method for updating firmware thereof
CN103198122B (en) Restart the method and apparatus of memory database
CN104503788A (en) Setting method capable of shortening starting time of Android operating system
US8893272B2 (en) Method and device for recombining runtime instruction
CN108228077B (en) Storage area management method, operating method, apparatus, device, and readable medium
CN108509215B (en) System software replacing method and device, terminal equipment and storage medium
CN104636165A (en) Mobile equipment starting method and device
CN105159703B (en) The method and system of factory reset
CN104572354A (en) Backup and restoration method for operating system based on restoration service and equipment thereof
CN104750579B (en) The method and apparatus for making memory mirror
CN114090434B (en) Code debugging method and device, computer equipment and storage medium
CN111324418A (en) OpenStack-based virtual machine template generation method and device
WO2020113382A1 (en) Hardware upgrading method, apparatus and device, and storage medium
CN112988460B (en) Data backup method and device for virtual machine
CN107357717B (en) Method, Apparatus and Apparatus for Detecting Configuration Errors
CN112291317A (en) Data downloading method and device, computer equipment and storage medium
CN113835741A (en) Patch loading method, network element and computer readable storage medium
WO2017096889A1 (en) Method and device for upgrading and downgrading system
CN117909221A (en) File testing method, device, electronic device and computer readable medium
CN114840362A (en) A cloud host recovery method, device and medium
CN108509252A (en) Virtual machine starter, method and host
CN114780122A (en) Embedded device firmware update method and embedded device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant