[go: up one dir, main page]

CN102479111A - Data storage method under Linux operating system and Linux computer system thereof - Google Patents

Data storage method under Linux operating system and Linux computer system thereof Download PDF

Info

Publication number
CN102479111A
CN102479111A CN2010105755071A CN201010575507A CN102479111A CN 102479111 A CN102479111 A CN 102479111A CN 2010105755071 A CN2010105755071 A CN 2010105755071A CN 201010575507 A CN201010575507 A CN 201010575507A CN 102479111 A CN102479111 A CN 102479111A
Authority
CN
China
Prior art keywords
virtual machine
data
linux
storage device
shared memory
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.)
Pending
Application number
CN2010105755071A
Other languages
Chinese (zh)
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.)
Inventec Corp
Original Assignee
Inventec Corp
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 Inventec Corp filed Critical Inventec Corp
Priority to CN2010105755071A priority Critical patent/CN102479111A/en
Publication of CN102479111A publication Critical patent/CN102479111A/en
Pending legal-status Critical Current

Links

Images

Landscapes

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

Abstract

本发明提供一种Linux操作系统下的数据储存方法及Linux计算机系统。所述方法包含下列步骤:判断共享内存是否处于使用状态。若否,则由第一虚拟机器取得共享内存的使用权。使第一虚拟机器基于使用权判断是否有第二虚拟机器处于死机状态。若是,则使第一虚拟机器基于使用权并根据死机状态,将第一虚拟机器与第二虚拟机器分别储存于共享内存中的第一数据与第二数据储存至储存装置中。

The present invention provides a data storage method under a Linux operating system and a Linux computer system. The method comprises the following steps: determining whether a shared memory is in use. If not, a first virtual machine obtains the right to use the shared memory. The first virtual machine determines whether a second virtual machine is in a dead state based on the right to use. If so, the first virtual machine stores the first data and the second data stored in the shared memory of the first virtual machine and the second virtual machine respectively in a storage device based on the right to use and according to the dead state.

Description

Linux操作系统下的数据储存方法及其Linux计算机系统Data storage method under Linux operating system and Linux computer system thereof

技术领域 technical field

本发明是有关于一种Linux操作系统下的数据储存方法及其Linux计算机系统。The invention relates to a data storage method under a Linux operating system and a Linux computer system thereof.

背景技术 Background technique

操作系统(Operation System,OS)相当于计算机设备中的中央处理器(Central Process Unit,CPU),是软件程序的心脏部位。各执行命令(command)与应用程序(application program)等软件,都是透过操作系统来驱动使用计算机设备中的硬件组件,如主机板、内存、硬盘、光驱、显示卡、声卡、网络卡、各类适配卡等等。The operating system (Operation System, OS) is equivalent to the central processing unit (Central Process Unit, CPU) in computer equipment, and is the heart of the software program. Each execution command (command) and application program (application program) and other software are driven by the operating system to use hardware components in computer equipment, such as motherboards, memory, hard disks, optical drives, display cards, sound cards, network cards, Various adapter cards and so on.

当前个人或家庭的使用上,以微软的窗口操作系统(Microsoft Windows)以及麦金塔的MacOS操作系统分庭抗礼。而在企业中所使用的计算机设备,必须肩负起庞大的数据流量与高速运算性能,因此操作系统稳定性与作业性能为其重要考虑,除了发展已有数十年历史的Unix操作系统以外,如今功能类似Unix操作系统的Linux操作系统,也逐渐被企业青睐。For current personal or family use, Microsoft's window operating system (Microsoft Windows) and Macintosh's MacOS operating system are competing against each other. The computer equipment used in enterprises must shoulder huge data traffic and high-speed computing performance. Therefore, the stability and operation performance of the operating system are important considerations. In addition to the development of the Unix operating system that has been developed for decades, today The Linux operating system, which is similar in function to the Unix operating system, is gradually favored by enterprises.

Linux操作系统可以说是Unix操作系统的衍生物,在1991年10月左右由赫尔辛基的某位程序员所设计,它继承了Unix操作系统良好稳定性的优点,再加上原始码的开放,所以企业可针对不同的需求,量身打造合适的功能。而相关应用软件的发展也相当迅速。如今,Linux操作系统已成为业界举足轻重的操作系统之一。The Linux operating system can be said to be a derivative of the Unix operating system. It was designed by a programmer in Helsinki around October 1991. It inherits the advantages of the good stability of the Unix operating system, coupled with the open source code, so Enterprises can tailor appropriate functions for different needs. The development of related application software is also quite rapid. Today, the Linux operating system has become one of the most important operating systems in the industry.

Linux操作系统定位在网络操作系统,其操作方式不同于窗口接口,是以命令列的方式由使用者键入命令数据来运作。对于熟悉图形环境的人来说,Linux乍看之下可能显得原始。但是Linux操作系统的运作,关注的是它的内在功能而不是表面的东西。即使是在纯文字的环境中,同样拥有非常先进的网络、脚本(script)与安全能力。Linux操作系统是期望在网络上与其它系统协同执行这些任务。Linux操作系统的自动执行能力也很强,只需要设计批处理文件档案,就可以让系统完成非常详细的任务。The Linux operating system is positioned as a network operating system. Its operation mode is different from that of the window interface. It is operated by the user typing in command data in the form of a command line. For those familiar with graphical environments, Linux may appear primitive at first glance. But the operation of the Linux operating system focuses on its intrinsic functions rather than superficial things. Even in a text-only environment, it also has very advanced network, script (script) and security capabilities. The Linux operating system is expected to perform these tasks in cooperation with other systems on the network. The automatic execution ability of the Linux operating system is also very strong. Only need to design batch file files, the system can complete very detailed tasks.

在现今网络盛行的时代,在Linux操作系统底下,使用者可针对需求在命令后加上许多参数来完成许多不同的任务,Linux操作系统强大的网络管理性能无庸置疑。话虽如此,但在异步写入数据部分,Linux操作系统尚有些待改进之处。异步写入是为了提升储存装置效能的一个重要技术,其主要的功能是透过内存来加速储存装置的写入速度。现今Linux操作系统下异步写入的作法是透过aio_write指令,配合内存分配特定内存区块来使用快取加速写入数据,但是此作法在虚拟机器死机时,aio_writhe指令所用来作快取的内存就会消失,造成储存装置写入数据的错误。In today's Internet era, under the Linux operating system, users can add many parameters after the command to complete many different tasks. The powerful network management performance of the Linux operating system is beyond doubt. Having said that, the Linux operating system still has some room for improvement when it comes to writing data asynchronously. Asynchronous writing is an important technology for improving the performance of the storage device, and its main function is to accelerate the writing speed of the storage device through the memory. The method of asynchronous writing under the current Linux operating system is to use the aio_write command to allocate a specific memory block to use the cache to speed up writing data. However, when the virtual machine crashes in this way, the memory used for the cache by the aio_write command will disappear, causing an error in writing data to the storage device.

发明内容 Contents of the invention

为解决已知技术的问题,本发明的一目的是提供一种Linux操作系统下的数据储存方法,通过在新式虚拟机器中常见的多虚拟机共享同一内存区块的技术,提供一个平行上使用的内存分配机制,让使用Linux操作系统作为虚拟操作系统(Guest OS)的虚拟机器,具有如一般附上具有电池的高级磁盘阵列卡上的防止异步写入错误的功能,进而消除在无预警死机时,异步写入的错误。In order to solve the problems of the known technology, an object of the present invention is to provide a data storage method under the Linux operating system, by sharing the same memory block technology of multiple virtual machines common in new virtual machines, providing a parallel use The memory allocation mechanism allows the virtual machine using the Linux operating system as the virtual operating system (Guest OS) to have the function of preventing asynchronous write errors on the advanced disk array card with a battery as usual, thereby eliminating the need to crash without warning , an error written asynchronously.

根据本发明一实施方式,一种Linux操作系统下的数据储存方法包含下列步骤。判断共享内存是否处于使用状态。若否,则由第一虚拟机器取得共享内存的使用权。使第一虚拟机器基于经取得的使用权判断是否有第二虚拟机器处于死机状态。若是,则使第一虚拟机器基于经取得的使用权并根据死机状态,将第一虚拟机器与第二虚拟机器分别储存于共享内存中的第一数据与第二数据储存至储存装置中。According to an embodiment of the present invention, a data storage method under a Linux operating system includes the following steps. Determine whether shared memory is in use. If not, the first virtual machine obtains the right to use the shared memory. Make the first virtual machine judge whether there is a second virtual machine in a dead state based on the obtained usage right. If so, make the first virtual machine store the first data and the second data respectively stored in the shared memory of the first virtual machine and the second virtual machine in the storage device based on the obtained usage right and according to the crash state.

本发明的另一目的是提供一种Linux计算机系统。Another object of the present invention is to provide a Linux computer system.

根据本发明另一实施方式,一种Linux计算机系统包含有共享内存、第一虚拟机器、第二虚拟机器、储存装置以及管理模块。共享内存提供使用权。第一虚拟机器具有第一数据。第一数据储存于共享内存中。其中第一虚拟机器取得使用权。第二虚拟机器具有第二数据。第二数据储存于共享内存中。其中第二虚拟机器处于死机状态。管理模块用以允许第一虚拟机器基于经取得的使用权将第一数据储存至储存装置,并根据死机状态将第二数据储存至储存装置。According to another embodiment of the present invention, a Linux computer system includes a shared memory, a first virtual machine, a second virtual machine, a storage device, and a management module. Shared memory provides usage rights. The first virtual machine has first data. The first data is stored in the shared memory. Wherein the first virtual machine obtains the usage right. The second virtual machine has second data. The second data is stored in the shared memory. Wherein the second virtual machine is in a dead state. The management module is used for allowing the first virtual machine to store the first data in the storage device based on the acquired usage right, and store the second data in the storage device according to the crash state.

本发明的Linux操作系统下的数据储存方法及其Linux计算机系统,主要通过在新式虚拟机器中常见的多虚拟机共享同一内存区块的技术,提供一个平行上使用的内存分配机制,让使用Linux操作系统作为虚拟操作系统(Guest OS)的虚拟机器,具有如一般附上具有电池的高级磁盘阵列卡上的防止异步写入错误的功能,进而消除在无预警死机时,异步写入的错误。The data storage method under the Linux operating system of the present invention and the Linux computer system thereof mainly provide a memory allocation mechanism used in parallel through the common technology of multiple virtual machines sharing the same memory block in new virtual machines, so that Linux can be used As a virtual machine of the virtual operating system (Guest OS), the operating system has the function of preventing asynchronous writing errors on an advanced disk array card with a battery, thereby eliminating asynchronous writing errors when there is no warning crash.

附图说明 Description of drawings

图1为绘示依照本发明一实施方式的Linux操作系统下的数据储存方法的步骤流程图;FIG. 1 is a flow chart illustrating the steps of a data storage method under a Linux operating system according to an embodiment of the present invention;

图2为绘示依照本发明一实施方式的Linux计算机系统的示意图。FIG. 2 is a schematic diagram illustrating a Linux computer system according to an embodiment of the present invention.

【主要组件符号说明】[Description of main component symbols]

1:Linux计算机系统        10:管理模块1: Linux computer system 10: Management module

12:第一虚拟机器          120:第一私有内存区块12: The first virtual machine 120: The first private memory block

14:第二虚拟机器          140:第二私有内存区块14: The second virtual machine 140: The second private memory block

16:自旋锁模块            18:状态记录模块16: Spinlock module 18: Status record module

20:共享内存              22:储存装置20: Shared memory 22: Storage device

S100~S114:流程步骤S100~S114: process steps

具体实施方式 Detailed ways

以下将以附图揭露本发明的数个实施方式,为明确说明起见,许多实务上的细节将在以下叙述中一并说明。然而,应了解到,这些实务上的细节不应用以限制本发明。也就是说,在本发明部分实施方式中,这些实务上的细节是非必要的。此外,为简化附图起见,一些已知惯用的结构与组件在附图中将以简单示意的方式绘示之。Several implementations of the present invention will be disclosed below with the accompanying drawings. For the sake of clarity, many practical details will be described together in the following description. It should be understood, however, that these practical details should not be used to limit the invention. That is, in some embodiments of the present invention, these practical details are unnecessary. In addition, for the sake of simplifying the drawings, some known and commonly used structures and components will be shown in a simple and schematic way in the drawings.

本发明的一技术方案是一种Linux操作系统下的数据储存方法。更具体地说,其主要通过在新式虚拟机器中常见的多虚拟机共享同一内存区块的技术,提供一个平行上使用的内存分配机制,让使用Linux操作系统作为虚拟操作系统(Guest OS)的虚拟机器,具有如一般附上具有电池的高级磁盘阵列卡上的防止异步写入错误的功能,进而消除在无预警死机时,异步写入的错误。A technical solution of the present invention is a data storage method under the Linux operating system. More specifically, it mainly provides a memory allocation mechanism used in parallel through the common technology of multi-virtual machines sharing the same memory block in new virtual machines, so that the Linux operating system as the virtual operating system (Guest OS) The virtual machine has the function of preventing asynchronous writing errors on an advanced disk array card with a battery as usual, thereby eliminating the asynchronous writing errors when crashing without warning.

请参照图1,其为绘示依照本发明一实施方式的Linux操作系统下的数据储存方法的步骤流程图。Please refer to FIG. 1 , which is a flowchart illustrating the steps of a data storage method under the Linux operating system according to an embodiment of the present invention.

如图1所示,若第一虚拟机器想要使用共享内存,则根据本实施方式的Linux操作系统下的数据储存方法可以执行步骤S100。As shown in FIG. 1 , if the first virtual machine wants to use the shared memory, the method for storing data under the Linux operating system according to this embodiment can execute step S100 .

S100:判断共享内存是否处于使用状态。S100: Determine whether the shared memory is in use.

在Linux系统下进行异步写入的动作,若要避免竞速问题(亦即,共享内存同时被多台虚拟机器写入所造成的数据覆盖错误),则必须先确定供所有虚拟机器使用的共享内存是否有被任何一台虚拟机器占据使用,而且也必须确保共享内存在任何时刻最多只能供一台虚拟机器使用。因此,根据本实施方式的Linux操作系统下的数据储存方法,在第一虚拟机器要使用共享内存之前,必须先执行步骤S100。In the asynchronous write operation under the Linux system, if you want to avoid the race problem (that is, the data overwrite error caused by the shared memory being written by multiple virtual machines at the same time), you must first determine the shared memory used by all virtual machines. Whether the memory is occupied by any virtual machine, and it must also be ensured that the shared memory can only be used by at most one virtual machine at any time. Therefore, according to the data storage method under the Linux operating system in this embodiment, step S100 must be executed before the first virtual machine uses the shared memory.

其中,若步骤S100的判断结果为是的话,则进一步执行步骤S102。Wherein, if the judgment result of step S100 is yes, step S102 is further executed.

S102:等待预定时间之后重新执行步骤S100。S102: Re-execute step S100 after waiting for a predetermined time.

换言之,若步骤S100的判断结果为共享内存正在被某一台虚拟机器使用,则第一虚拟计算机就不能使用了。若第一虚拟计算机要使用共享内存,就必须等正在使用共享内存的那台虚拟机器使用完毕,因此可以等待预定时间之后再次确认共享内存是否已经未处于使用状态。至于上述的预定时间并不受限,可以根据实际应用上的需求或限制而弹性地改变。In other words, if the determination result of step S100 is that the shared memory is being used by a certain virtual machine, the first virtual computer cannot be used. If the first virtual computer wants to use the shared memory, it must wait for the virtual machine using the shared memory to be used up, so it is possible to wait for a predetermined time to confirm whether the shared memory is not in use. The aforementioned predetermined time is not limited, and can be flexibly changed according to requirements or limitations in practical applications.

相对地,若步骤S100的判断结果为否的话,就代表目前没有任何虚拟计算机正在使用共享内存,则第一虚拟机器想要使用共享内存,可进一步执行步骤S104。In contrast, if the judgment result of step S100 is negative, it means that no virtual computer is currently using the shared memory, and the first virtual machine wants to use the shared memory, and step S104 can be further executed.

S104:由第一虚拟机器取得共享内存的使用权。S104: Obtain the right to use the shared memory by the first virtual machine.

当第一虚拟机器取得了共享内存的使用权之后,代表第一虚拟机器取得了使用共享内存的主导权,其它虚拟机器并不能同时使用。若其它虚拟机器要使用共享内存,还是得等第一虚拟机器使用完毕并归还使用权。After the first virtual machine has obtained the right to use the shared memory, it means that the first virtual machine has obtained the dominant right to use the shared memory, and other virtual machines cannot use it at the same time. If other virtual machines want to use the shared memory, they still have to wait for the first virtual machine to finish using it and return the right to use it.

此外,在Linux系统下进行异步写入的架构下,可能会发生某虚拟机器死机的情况,若虚拟机器在取得使用权并使用共享内存时发生死机,则其原本在共享内存中正在使用的数据可能还来不及储存于储存装置中,并随着虚拟机器的死机而消失。因此,根据本实施方式的Linux操作系统下的数据储存方法,在第一虚拟机器取得共享内存的使用权之后,可以再执行步骤S106。In addition, under the architecture of asynchronous writing under the Linux system, a virtual machine crash may occur. If the virtual machine crashes when it obtains the right to use and uses the shared memory, the data it was originally using in the shared memory It may be too late to be stored in the storage device, and disappear with the crash of the virtual machine. Therefore, according to the data storage method under the Linux operating system in this embodiment, after the first virtual machine obtains the right to use the shared memory, step S106 can be executed again.

S106:使第一虚拟机器基于经取得的使用权判断是否有第二虚拟机器处于死机状态。S106: Make the first virtual machine determine whether there is a second virtual machine in a dead state based on the obtained usage right.

其中,若步骤S106的判断结果为是的话,则进一步执行步骤S108。Wherein, if the judgment result of step S106 is yes, step S108 is further executed.

S108:使第一虚拟机器基于经取得的使用权并根据死机状态,将第一虚拟机器与第二虚拟机器分别储存于共享内存中的第一数据与第二数据储存至储存装置中。S108: Make the first virtual machine store the first data and the second data respectively stored in the shared memory of the first virtual machine and the second virtual machine in the storage device based on the obtained usage right and according to the shutdown state.

换句话说,在第一虚拟机器取得共享内存的使用权之后,根据步骤S106发现第二虚拟机器处于死机状态,则第一虚拟机器即可根据第二虚拟机器的死机状态进入共享内存中搜寻第二内存在死机前正在使用的第二数据。接着,第一虚拟机器即可根据步骤S108,基于其所取得的所有权将正在共享内存中使用的第一数据储存至储存装置中,并根据第二虚拟机器的死机状态,替第二虚拟机器将其在死机前暂时储存于共享内存中的第二数据也一起储存至储存装置中。In other words, after the first virtual machine obtains the right to use the shared memory, according to step S106, it is found that the second virtual machine is in a dead state, then the first virtual machine can enter the shared memory to search for the second virtual machine according to the dead state of the second virtual machine. Second data in use before the crash exists in the second memory. Then, according to step S108, the first virtual machine can store the first data being used in the shared memory in the storage device based on the obtained ownership, and replace the second virtual machine with the The second data temporarily stored in the shared memory before the crash is also stored in the storage device together.

在第一虚拟机器使用共享内存完毕(亦即,将第一虚拟机器的第一数据与第二虚拟机器的第二数据都储存至储存装置)之后,根据本实施方式的Linux操作系统下的数据储存方法,可以接着执行步骤S110。After the first virtual machine finishes using the shared memory (that is, both the first data of the first virtual machine and the second data of the second virtual machine are stored in the storage device), the data under the Linux operating system according to this embodiment In the storage method, step S110 may be performed next.

S110:在第一数据与第二数据储存至储存装置之后,使第一虚拟机器归还使用权。S110: Make the first virtual machine return the use right after the first data and the second data are stored in the storage device.

相对地,若步骤S106的判断结果为否的话,则代表在第一虚拟机器取得共享内存的使用权之前,并没有任何虚拟机器发生死机,则可根据本实施方式的Linux操作系统下的数据储存方法,继续执行步骤S112。Relatively, if the judgment result of step S106 is negative, it means that before the first virtual machine obtains the right to use the shared memory, no virtual machine has crashed. method, continue to execute step S112.

S112:使第一虚拟机器基于经取得的使用权,将第一虚拟机器储存于共享内存中的第一数据储存至储存装置中。S112: Make the first virtual machine store the first data stored in the shared memory by the first virtual machine in the storage device based on the obtained usage right.

换句话说,若第一虚拟机器基于使用权发现没有任何虚拟机器有发生死机的状况,则第一虚拟机器就只要专注于处理其本身在共享内存中使用的第一数据即可,并在使用完毕(亦即,将第一虚拟机器的第一数据储存至储存装置)之后,根据本实施方式的Linux操作系统下的数据储存方法执行步骤S114。In other words, if the first virtual machine finds that no virtual machine has crashed based on the usage right, then the first virtual machine only needs to focus on processing the first data used by itself in the shared memory, and use After completion (that is, storing the first data of the first virtual machine to the storage device), the data storage method under the Linux operating system according to this embodiment executes step S114.

S114:在第一数据储存于储存装置之后,使第一虚拟机器归还使用权。S114: Make the first virtual machine return the usage right after the first data is stored in the storage device.

本发明的另一技术方案是一种Linux计算机系统。Another technical solution of the present invention is a Linux computer system.

请参阅图2,其为绘示依照本发明一实施方式的Linux计算机系统1的示意图。如图2所示,本实施方式的Linux计算机系统1可包含有共享内存20、第一虚拟机器12、第二虚拟机器14、储存装置22以及管理模块10。共享内存20可以提供使用权。当然,如上一实施方式所述,在Linux系统下进行异步写入的动作,若要避免竞速问题,则必须确保共享内存20的使用权在任何时刻最多只能供一台虚拟机器使用。Please refer to FIG. 2 , which is a schematic diagram illustrating a Linux computer system 1 according to an embodiment of the present invention. As shown in FIG. 2 , the Linux computer system 1 of this embodiment may include a shared memory 20 , a first virtual machine 12 , a second virtual machine 14 , a storage device 22 and a management module 10 . Shared memory 20 may provide usage rights. Of course, as mentioned in the previous embodiment, if the asynchronous writing operation under the Linux system is to avoid the racing problem, it must be ensured that the right to use the shared memory 20 can only be used by at most one virtual machine at any time.

如图2所示,本实施方式中,共享内存20的使用权由第一虚拟机器12取得。此外,第一虚拟机器12包含有第一私有内存区块120。第一私有内存区块120可以用来暂时储存第一虚拟机器12正在处理的第一数据,并且在取得共享内存20的所有权之后,第一虚拟机器12的第一数据可进一步暂时储存于共享内存20中。第二虚拟机器14包含有第二私有内存区块140。第二私有内存区块140可以用来暂时储存第二数据。然而,于本实施方式中,由于第二虚拟机器14处于死机状态,代表在第二虚拟机器14死机之前,第二虚拟机器14的第二数据还暂时储存于共享内存20中。As shown in FIG. 2 , in this embodiment, the right to use the shared memory 20 is obtained by the first virtual machine 12 . In addition, the first virtual machine 12 includes a first private memory block 120 . The first private memory block 120 can be used to temporarily store the first data being processed by the first virtual machine 12, and after obtaining the ownership of the shared memory 20, the first data of the first virtual machine 12 can be further temporarily stored in the shared memory 20 in. The second virtual machine 14 includes a second private memory block 140 . The second private memory block 140 can be used to temporarily store the second data. However, in this embodiment, since the second virtual machine 14 is in a shutdown state, it means that the second data of the second virtual machine 14 is still temporarily stored in the shared memory 20 before the second virtual machine 14 crashes.

如图2所示,上述的管理模块10可以于第一虚拟机器12取得使用权时,允许第一虚拟机器12基于使用权,将暂时储存于共享内存20中的第一数据储存至储存装置22,并于第二虚拟机器14处于死机状态时,允许第一虚拟机器12根据死机状态,将暂时储存于共享内存20中的将第二数据储存至储存装置22。借此,处于死机状态的第二虚拟机器14,在其死机之前暂存于共享内存20中的第二数据即可通过第一虚拟机器12的协助而储存至储存装置22中,第二数据就不会随着第二虚拟机器14的死机而消失。此外,上述的管理模可在第一数据与第二数据储存至储存装置22之后,使第一虚拟机器12归还共享内存20的使用权。As shown in FIG. 2 , the above-mentioned management module 10 can allow the first virtual machine 12 to store the first data temporarily stored in the shared memory 20 to the storage device 22 based on the use right when the first virtual machine 12 obtains the use right, And when the second virtual machine 14 is in a crash state, the first virtual machine 12 is allowed to store the second data temporarily stored in the shared memory 20 to the storage device 22 according to the crash state. In this way, the second virtual machine 14 in the crash state can store the second data temporarily stored in the shared memory 20 before the crash in the storage device 22 with the assistance of the first virtual machine 12, and the second data is It will not disappear with the shutdown of the second virtual machine 14. In addition, the above-mentioned management module can make the first virtual machine 12 return the right to use the shared memory 20 after the first data and the second data are stored in the storage device 22 .

如图2所示,本实施方式的Linux计算机系统1还可进一步包含有自旋锁模块16。自旋锁模块16可以于第一虚拟机器12取得使用权时,标记共享内存20处于使用状态,使得其它虚拟机器无法同时使用共享内存20。并且,自旋锁模块16还可在第一虚拟机器12归还使用权之后,将共享内存20的使用状态取消。后续,若有其它虚拟机器想使用共享内存20,可同样重复先取得共享内存20的使用权的步骤,再透过自旋锁模块16标记共享内存20处于使用状态。As shown in FIG. 2 , the Linux computer system 1 of this embodiment may further include a spinlock module 16 . The spinlock module 16 can mark the shared memory 20 as being in use when the first virtual machine 12 obtains the use right, so that other virtual machines cannot use the shared memory 20 at the same time. Moreover, the spinlock module 16 may also cancel the use state of the shared memory 20 after the first virtual machine 12 returns the use right. Subsequently, if other virtual machines want to use the shared memory 20 , they can repeat the steps of obtaining the right to use the shared memory 20 first, and then mark the shared memory 20 as being in use through the spinlock module 16 .

同样示于图2中,本实施方式的Linux计算机系统1还可进一步包含有状态记录模块18。状态记录模块18可以用来定期根据第一虚拟机器12与第二虚拟机器14的存活状态制作对照表。借此,管理模块10即可允许第一虚拟机器12基于使用权并根据定期更新的对照表判断第二虚拟机器14处于死机状态。换句话说,第一虚拟机器12是通过状态记录模块18所制作的对照表,判断第二虚拟机器14是否处于死机状态。Also shown in FIG. 2 , the Linux computer system 1 of this embodiment may further include a stateful recording module 18 . The state recording module 18 can be used to regularly create a comparison table according to the survival states of the first virtual machine 12 and the second virtual machine 14 . In this way, the management module 10 can allow the first virtual machine 12 to determine that the second virtual machine 14 is in a dead state based on the usage rights and the regularly updated comparison table. In other words, the first virtual machine 12 judges whether the second virtual machine 14 is in a dead state through the comparison table created by the state recording module 18 .

于实际应用中,上述处于死机状态的第二虚拟机器14的数量并不以本实施方式为限,只要是处于死机状态的虚拟机器,皆可视为本实施方式的第二虚拟机器14,并且取得共享内存20的使用权的第一虚拟机器12,即可将所有处于死机状态的第二虚拟机器14储存于共享内存20中的第二数据,进一步储存至储存装置22中。In practical applications, the number of the above-mentioned second virtual machines 14 in a dead state is not limited to this embodiment, as long as they are virtual machines in a dead state, they can be regarded as the second virtual machines 14 of this embodiment, and The first virtual machine 12 that has obtained the right to use the shared memory 20 can further store the second data stored in the shared memory 20 by all the second virtual machines 14 that are in a shutdown state in the storage device 22 .

由以上对于本发明的具体实施例的详述,可以明显地看出,本发明的Linux操作系统下的数据储存方法及其Linux计算机系统,主要通过在新式虚拟机器中常见的多虚拟机共享同一内存区块的技术,提供一个平行上使用的内存分配机制,让使用Linux操作系统作为虚拟操作系统(Guest OS)的虚拟机器,具有如一般附上具有电池的高级磁盘阵列卡上的防止异步写入错误的功能,进而消除在无预警死机时,异步写入的错误。From the above detailed description of specific embodiments of the present invention, it can be clearly seen that the data storage method under the Linux operating system of the present invention and its Linux computer system mainly share the same virtual machine through common multi-virtual machines in new virtual machines. The memory block technology provides a memory allocation mechanism used in parallel, so that the virtual machine using the Linux operating system as the virtual operating system (Guest OS) has the ability to prevent asynchronous writing on the advanced disk array card with a battery as usual. The error function can be added to eliminate the error of asynchronous writing when there is no warning crash.

虽然本发明已以实施方式揭露如上,然其并非用以限定本发明,任何熟悉此技艺者,在不脱离本发明的精神和范围内,当可作各种的更动与润饰,因此本发明的保护范围当视所附的权利要求书所界定的范围为准。Although the present invention has been disclosed above in terms of implementation, it is not intended to limit the present invention. Any skilled person can make various changes and modifications without departing from the spirit and scope of the present invention. Therefore, the present invention The scope of protection should be based on the scope defined by the appended claims.

Claims (9)

1. the data storage method under the (SuSE) Linux OS is characterized in that, comprises the following step:
(a) judge that one shares internal memory and whether is in a user mode, if not, execution in step (b) then;
(b) obtain the right to use of this shared drive by one first virtual machine;
(c) make this first virtual machine judge whether that through the right to use that obtains one second virtual machine is in a deadlock state based on this, if, execution in step (d) then; And
(d) make this first virtual machine based on this through the right to use that obtains and according to this deadlock state, this first virtual machine and this second virtual machine are stored in respectively in one first data and one second data storing to a storage device in this shared drive.
2. the data storage method under the (SuSE) Linux OS according to claim 1 is characterized in that, if the judged result of step (a) is for being then to carry out the following step:
(a1) wait for a schedule time after execution in step (a) again.
3. the data storage method under the (SuSE) Linux OS according to claim 1 is characterized in that, if the judged result of step (c) is that then step (c) does not further comprise the following step:
(d1) make this first virtual machine based on this right to use, this first virtual machine is stored in this first data storing in this shared drive to this storage device through obtaining.
4. the data storage method under the (SuSE) Linux OS according to claim 3 is characterized in that, step (d1) further comprises the following step:
(e1) in this first data storing after this storage device, make this first virtual machine give back this right to use.
5. the data storage method under the (SuSE) Linux OS according to claim 3 is characterized in that, further comprises the following step:
(e2) in these first data and this second data storing to this storage device, make this first virtual machine give back this right to use.
6. a Linux computer system is characterized in that, comprises:
One shares internal memory, and a right to use is provided;
One first virtual machine has one first data, can be stored in this shared drive;
One second virtual machine has one second data, can be stored in this shared drive;
One storage device; And
One administration module; When being used to this first virtual machine and obtaining this right to use; Allow this first virtual machine based on this right to use with this first data storing to this storage device; And when being used to this second virtual machine and being in a deadlock state, allow this first virtual machine according to this deadlock state with this second data storing to this storage device.
7. Linux computer system according to claim 6 is characterized in that, further comprises:
One spin lock module is used to this first virtual machine and obtains this this shared drive of right to use tense marker and be in a user mode, and after this first virtual machine is given back this right to use, cancels this user mode.
8. Linux computer system according to claim 7 is characterized in that, this management mould to this storage device, makes this first virtual machine give back this right to use in these first data and this second data storing.
9. Linux computer system according to claim 6 is characterized in that, further comprises:
One state recording module; In order to regularly to make comparison list according to the existing state of this first virtual machine and this second virtual machine, wherein this administration module allows this first virtual machine to judge that based on this right to use and according to this table of comparisons this second virtual machine is in this deadlock state.
CN2010105755071A 2010-11-30 2010-11-30 Data storage method under Linux operating system and Linux computer system thereof Pending CN102479111A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2010105755071A CN102479111A (en) 2010-11-30 2010-11-30 Data storage method under Linux operating system and Linux computer system thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2010105755071A CN102479111A (en) 2010-11-30 2010-11-30 Data storage method under Linux operating system and Linux computer system thereof

Publications (1)

Publication Number Publication Date
CN102479111A true CN102479111A (en) 2012-05-30

Family

ID=46091764

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2010105755071A Pending CN102479111A (en) 2010-11-30 2010-11-30 Data storage method under Linux operating system and Linux computer system thereof

Country Status (1)

Country Link
CN (1) CN102479111A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108196934A (en) * 2016-12-08 2018-06-22 阿里巴巴集团控股有限公司 The time set method, apparatus and virtual equipment of a kind of timer

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108196934A (en) * 2016-12-08 2018-06-22 阿里巴巴集团控股有限公司 The time set method, apparatus and virtual equipment of a kind of timer

Similar Documents

Publication Publication Date Title
US10289684B2 (en) Live migration of virtual machine persistent data using mirrored input-output operations
US9563513B2 (en) O(1) virtual machine (VM) snapshot management
US9336132B1 (en) Method and system for implementing a distributed operations log
US8181176B2 (en) Uniform storage device access using partial virtual machine executing within a secure enclave session
US10127068B2 (en) Performance variability reduction using an opportunistic hypervisor
US20190146853A1 (en) Enabling live migration of virtual machines with passthrough pci devices
US9886443B1 (en) Distributed NFS metadata server
US9600369B2 (en) Operating system recovery method and apparatus, and terminal device
US10049036B2 (en) Reliable distributed messaging using non-volatile system memory
US9760480B1 (en) Enhanced logging using non-volatile system memory
US9767015B1 (en) Enhanced operating system integrity using non-volatile system memory
US9519581B2 (en) Storage integration for host-based write-back caching
CN103064796B (en) virtual machine memory sharing method and computer system
US20120216007A1 (en) Page protection ordering for lockless write tracking
US9542112B2 (en) Secure cross-process memory sharing
US20140164722A1 (en) Method for saving virtual machine state to a checkpoint file
CN113782071A (en) System and method for processing input/output requests
US9612776B2 (en) Dynamically updated user data cache for persistent productivity
US10089220B1 (en) Saving state information resulting from non-idempotent operations in non-volatile system memory
US9575658B2 (en) Collaborative release of a virtual disk
US11169708B1 (en) Zero memory buffer copying in a reliable distributed computing system
US10467145B2 (en) Management of caching operations in a unified cache
CN102479111A (en) Data storage method under Linux operating system and Linux computer system thereof
CN100399302C (en) Method and apparatus for raising speed of access USB interface information safety equipment
JP2022542212A (en) Building a fault-tolerant operating system based on durable services with kernel support

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C02 Deemed withdrawal of patent application after publication (patent law 2001)
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20120530