Thread management method and system based on virtual machine

Through the thread management method based on virtual machines, the virtual thread logo and data virtual machines are created to solve the problem of interactive management between thread and process, realize data security and isolation, and save thread -tuning space and memory.

CN119376853APending Publication Date: 2025-01-28FUJIAN TQ ONLINE INTERACTIVE INC
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411331809.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-24
Publication Date
2025-01-28

AI Technical Summary

Technical Problem

It is difficult for the existing technology to effectively manage the interaction between threads and processes, ensure data security and isolation, and at the same time improve the overall stability of the system.

Method used

Adopt a thread -based management method based on virtual machines to receive threads delivered by user processes through thread virtual machines, create virtual thread logos and data virtual machines, process data processing, and return the result to the user process.

Benefits of technology

At the same time as the security of the protection thread data, saving the scheduling space of threads, reducing process expenses, and saving memory space.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119376853A_ABST
    Figure CN119376853A_ABST
Patent Text Reader

Abstract

The invention discloses a thread management method and system based on a virtual machine, after a user process delivers a thread to a thread virtual machine, the thread virtual machine can create a virtual thread identifier according to the thread identifier, obtain a data type in the thread, and send the virtual thread identifier and the data type to an intermediate data module; and the intermediate data module allocates a corresponding data virtual machine to the virtual thread identifier according to the data type, and the data virtual machine returns a data processing result to the user process after performing data processing according to the virtual thread identifier. In this way, the user process does not need to run, that is to say, the user process does not continue to participate after completing a delivery action and only needs to wait for completion of the virtual machine and return a processing result, thread management is conducted in a virtual replication mode, the safety of thread data can be protected, and meanwhile the user process does not continue to participate. The scheduling space of the threads is saved, and the memory space can be saved by reducing processes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of thread management, and in particular to a thread management method and system based on a virtual machine. Background Art

[0002] At present, multithreading and multi-process technology is an important means to achieve efficient parallel processing and improve system performance. However, with the increase in the complexity of applications, how to effectively manage the interaction between threads and processes, ensure the security and isolation of data, and improve the overall stability of the system has become an urgent problem to be solved. In this context, a variety of technologies have emerged to optimize the management mechanism of threads and processes, but each technology has certain limitations:

[0003] Although the existing VT-X technology provides powerful data isolation capabilities, it is mainly aimed at virtualization scenarios; although the process hook technology is flexible, it is highly complex and lacks a data isolation mechanism; although the cross-process transaction pool technology can coordinate the interaction between processes, it has a large overhead; and multi-threaded execution directly faces the challenges of data sharing and synchronization. Therefore, there is an urgent need for a thread management method that can effectively manage threads and processes while ensuring data isolation and security. Summary of the invention

[0004] The technical problem to be solved by the present invention is to provide a thread management method and system based on a virtual machine, which can save thread scheduling space while protecting the security of thread data.

[0005] In order to solve the above technical problems, the technical solution adopted by the present invention is:

[0006] A thread management method based on a virtual machine, comprising the steps of:

[0007] The thread virtual machine receives the thread delivered by the user process, creates a virtual thread identifier according to the thread identifier of the thread, obtains the data type in the thread, and sends the virtual thread identifier and the data type to the intermediate data module;

[0008] The intermediate data module allocates a corresponding data virtual machine to the virtual thread identifier according to the data type;

[0009] After the data virtual machine processes the data according to the virtual thread identifier, the data processing result is returned to the user process.

[0010] In order to solve the above technical problems, another technical solution adopted by the present invention is:

[0011] A thread management system based on a virtual machine, comprising a thread virtual machine, an intermediate data module and a data virtual machine;

[0012] A thread virtual machine, used for receiving a thread delivered by a user process, creating a virtual thread identifier according to the thread identifier of the thread, obtaining a data type in the thread, and sending the virtual thread identifier and the data type to an intermediate data module;

[0013] An intermediate data module, used for allocating a corresponding data virtual machine to the virtual thread identifier according to the data type;

[0014] The data virtual machine is used to process the data according to the virtual thread identifier and return the data processing result to the user process.

[0015] The beneficial effect of the present invention is that after the user process delivers the thread to the thread virtual machine, the thread virtual machine can create a virtual thread identifier according to the thread identifier, obtain the data type in the thread, and send the virtual thread identifier and the data type to the intermediate data module, so that the process can be temporarily exited, and the subsequent thread processing steps can be handed over to the virtual machine; the intermediate data module allocates the corresponding data virtual machine to the virtual thread identifier according to the data type, and the data virtual machine processes the data according to the virtual thread identifier and returns the data processing result to the user process. In this way, the user process does not need to run, which is equivalent to the user process completing a delivery action and not continuing to participate, just waiting for the virtual machine to complete and return the processing result. Thread management is performed by virtual replication, which can save thread scheduling space while protecting the security of thread data, and can save memory space by opening fewer processes. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 A flowchart of a thread management method based on a virtual machine according to an embodiment of the present invention;

[0017] Figure 2 A schematic diagram of a thread management system based on a virtual machine according to an embodiment of the present invention; DETAILED DESCRIPTION

[0018] In order to explain the technical content, achieved objectives and effects of the present invention in detail, the following is an explanation in combination with the implementation modes and the accompanying drawings.

[0019] Please refer to Figure 1 The embodiment of the present invention provides a thread management method based on a virtual machine, comprising the steps of:

[0020] The thread virtual machine receives the thread delivered by the user process, creates a virtual thread identifier according to the thread identifier of the thread, obtains the data type in the thread, and sends the virtual thread identifier and the data type to the intermediate data module;

[0021] The intermediate data module allocates a corresponding data virtual machine to the virtual thread identifier according to the data type;

[0022] After the data virtual machine processes the data according to the virtual thread identifier, the data processing result is returned to the user process.

[0023] From the above description, it can be seen that the beneficial effect of the present invention is that after the user process delivers the thread to the thread virtual machine, the thread virtual machine can create a virtual thread identifier based on the thread identifier, obtain the data type in the thread, and send the virtual thread identifier and the data type to the intermediate data module, so that the process can be temporarily exited, and the subsequent thread processing steps can be handed over to the virtual machine; the intermediate data module allocates the corresponding data virtual machine to the virtual thread identifier according to the data type, and the data virtual machine processes the data according to the virtual thread identifier and returns the data processing result to the user process. In this way, the user process does not need to run, which is equivalent to the user process completing a delivery action and not continuing to participate, just waiting for the virtual machine to complete and return the processing result. Thread management is performed by virtual replication, which can save thread scheduling space while protecting the security of thread data, and can save memory space by opening fewer processes.

[0024] Further, the data type in the thread is obtained, and then includes:

[0025] The thread virtual machine creates a corresponding data virtual machine according to the data type.

[0026] It can be seen from the above description that by creating a corresponding data virtual machine according to the data type, the thread virtual machine is only responsible for creating the data virtual machine, but does not participate in the maintenance of the data virtual machine.

[0027] Furthermore, the intermediate data module allocates a corresponding data virtual machine to the virtual thread identifier according to the data type, and further includes:

[0028] The intermediate data module matches the corresponding data processing rules according to the data type, and sends the data processing rules to the allocated data virtual machine.

[0029] It can be seen from the above description that a large number of data processing types are stored in the intermediate data module so that the data virtual machine can take over the process thread for processing.

[0030] Furthermore, the intermediate data module allocates a corresponding data virtual machine to the virtual thread identifier according to the data type, and then further includes:

[0031] The data virtual machine creates an initialization space for the virtual thread identifier and copies the virtual thread identifier into the initialization space.

[0032] From the above description, it can be seen that when the transmitted virtual data identifier is received, an initialization space is created and the virtual thread identifier is copied to the initialization space, which is equivalent to transferring data control to the new virtual thread for subsequent processing, so as to complete thread processing through the data virtual machine.

[0033] Further, the data processing result is returned to the user process, which then includes:

[0034] Destroy the virtual thread identifier and the corresponding data virtual machine.

[0035] It can be seen from the above description that after the thread processing is completed, the virtual thread identifier and the corresponding data virtual machine are destroyed, which can further save memory space.

[0036] Please refer to Figure 2 ,Another embodiment of the present invention provides a virtual machine-based thread management system, including a thread virtual machine, an intermediate data module and a data virtual machine;

[0037] A thread virtual machine, used for receiving a thread delivered by a user process, creating a virtual thread identifier according to the thread identifier of the thread, obtaining a data type in the thread, and sending the virtual thread identifier and the data type to an intermediate data module;

[0038] An intermediate data module, used for allocating a corresponding data virtual machine to the virtual thread identifier according to the data type;

[0039] The data virtual machine is used to process the data according to the virtual thread identifier and return the data processing result to the user process.

[0040] From the above description, it can be seen that the beneficial effect of the present invention is that after the user process delivers the thread to the thread virtual machine, the thread virtual machine can create a virtual thread identifier based on the thread identifier, obtain the data type in the thread, and send the virtual thread identifier and the data type to the intermediate data module, so that the process can be temporarily exited, and the subsequent thread processing steps can be handed over to the virtual machine; the intermediate data module allocates the corresponding data virtual machine to the virtual thread identifier according to the data type, and the data virtual machine processes the data according to the virtual thread identifier and returns the data processing result to the user process. In this way, the user process does not need to run, which is equivalent to the user process completing a delivery action and not continuing to participate, just waiting for the virtual machine to complete and return the processing result. Thread management is performed by virtual replication, which can save thread scheduling space while protecting the security of thread data, and can save memory space by opening fewer processes.

[0041] Further, the data type in the thread is obtained, and then includes:

[0042] The thread virtual machine creates a corresponding data virtual machine according to the data type.

[0043] It can be seen from the above description that by creating a corresponding data virtual machine according to the data type, the thread virtual machine is only responsible for creating the data virtual machine, but does not participate in the maintenance of the data virtual machine.

[0044] Furthermore, the intermediate data module allocates a corresponding data virtual machine to the virtual thread identifier according to the data type, and further includes:

[0045] The intermediate data module matches the corresponding data processing rules according to the data type, and sends the data processing rules to the allocated data virtual machine.

[0046] It can be seen from the above description that a large number of data processing types are stored in the intermediate data module so that the data virtual machine can take over the process thread for processing.

[0047] Furthermore, the intermediate data module allocates a corresponding data virtual machine to the virtual thread identifier according to the data type, and then further includes:

[0048] The data virtual machine creates an initialization space for the virtual thread identifier and copies the virtual thread identifier into the initialization space.

[0049] From the above description, it can be seen that when the transmitted virtual data identifier is received, an initialization space is created and the virtual thread identifier is copied to the initialization space, which is equivalent to transferring data control to the new virtual thread for subsequent processing, so as to complete thread processing through the data virtual machine.

[0050] Further, the data processing result is returned to the user process, which then includes:

[0051] Destroy the virtual thread identifier and the corresponding data virtual machine.

[0052] It can be seen from the above description that after the thread processing is completed, the virtual thread identifier and the corresponding data virtual machine are destroyed, which can further save memory space.

[0053] The above-mentioned virtual machine-based thread management method and system of the present invention is suitable for saving thread scheduling space while protecting the security of thread data. The following is an explanation through specific implementation methods:

[0054] Embodiment 1

[0055] Please refer to Figure 1 , a thread management method based on a virtual machine, comprising the steps of:

[0056] S1. The thread virtual machine receives a thread delivered by a user process, creates a virtual thread identifier according to the thread identifier of the thread, obtains a data type in the thread, and sends the virtual thread identifier and the data type to an intermediate data module.

[0057] Specifically, a virtual thread identifier vtf that is the same as the thread identifier ptf of the process delivery thread is created in the thread virtual machine. When the thread virtual machine runs successfully, a successful running result will be returned.

[0058] In this embodiment, the thread virtual machine runs in the system. Unlike other programs, the program will die, that is, the thread will die after the program is closed, while the thread virtual machine runs in the system, and only the death of the system will affect the thread virtual machine. In this way, it is equivalent to establishing a temporary virtual machine for the system, so that the user process can temporarily exit.

[0059] After obtaining the data type in the thread, the thread virtual machine creates a corresponding data virtual machine according to the data type.

[0060] Specifically, the thread virtual machine can create a data virtual machine of the corresponding type according to the data type of the thread data. After the thread virtual machine is created, the event is completed and the data type of the thread data is sent to the intermediate data module. At this time, the thread virtual machine is only responsible for creating the data virtual machine and does not participate in the maintenance of the data virtual machine.

[0061] S2. The intermediate data module allocates a corresponding data virtual machine to the virtual thread identifier according to the data type.

[0062] The intermediate data module also needs to match the corresponding data processing rules according to the data type, and send the data processing rules to the allocated data virtual machine.

[0063] In this embodiment, the intermediate data module stores a large number of processing rules for different data types, which are configured according to the data processing rules. The data processing types can be divided into: storage file data processing type, storage image data processing type, storage data stream processing type and storage data analysis processing type.

[0064] After receiving the thread data type, the intermediate data module configures the corresponding virtual machine space for the thread identifier and copies the transferred data content to the virtual machine space.

[0065] S3. After the data virtual machine processes the data according to the virtual thread identifier, the data processing result is returned to the user process.

[0066] Among them, the data virtual machine creates an initialization space for the virtual thread identifier and copies the virtual thread identifier to the initialization space, that is, copies the data from the virtual machine space of the intermediate data to the initialization space of the data virtual machine; and after data processing, returns the data processing result to the user process via the thread virtual machine, and then the thread virtual machine destroys the virtual thread identifier and the corresponding data virtual machine.

[0067] Specifically, in this embodiment, the data virtual machine has an independent space, the number of data virtual machines is the same as the number of independent spaces, and one virtual thread corresponds to an independent virtual data space, wherein the number of created data virtual machines can be expressed as n vtb, where n represents the number, v represents virtual, t represents the category, and b represents the independent space. The initialization space of this type is stored, and when the transmitted virtual data identifier is received, the initial space is copied to form a new space, which is equivalent to transferring the data control right to the new virtual thread. When the processing is completed, the delivery is waited for according to the virtual thread identifier, and the virtual thread identifier and the data virtual machine are destroyed.

[0068] Therefore, in this embodiment, data is delivered to the thread virtual machine through the process thread. The thread virtual machine creates a virtual thread identifier that is exactly the same as the delivery thread as its own identifier, and passes the copied data content to the intermediate data. The intermediate data receives the corresponding data type and assigns the corresponding data virtual machine to it, and receives the corresponding data type to run. At this time, the data virtual machine becomes an independent running individual with the virtual thread identifier of the process, waiting for its own operation to end and return to the process. At this time, the process does not need to run, which is equivalent to the process not continuing to participate after completing a delivery action. It only needs to wait for the virtual machine to complete and return the processing result, which is equivalent to entrusting the thread to the system local virtual machine for processing. In this way, fewer processes can be opened and memory space can be saved.

[0069] Embodiment 2

[0070] Please refer to Figure 2 , a thread management system based on a virtual machine, including a thread virtual machine, an intermediate data module and a data virtual machine:

[0071] The thread virtual machine is used to receive the thread delivered by the user process, create a virtual thread identifier according to the thread identifier of the thread, obtain the data type in the thread, and send the virtual thread identifier and the data type to the intermediate data module. After obtaining the data type in the thread, the thread virtual machine creates a corresponding data virtual machine according to the data type.

[0072] The intermediate data module is used to allocate a corresponding data virtual machine to the virtual thread identifier according to the data type, wherein the intermediate data module also needs to match the corresponding data processing rule according to the data type and send the data processing rule to the allocated data virtual machine.

[0073] A data virtual machine is used to process data according to the virtual thread identifier and return the data processing result to the user process. The data virtual machine needs to first create an initialization space for the virtual thread identifier and copy the virtual thread identifier to the initialization space; after returning the data processing result to the user process, the virtual thread identifier and the corresponding data virtual machine are destroyed.

[0074] In summary, the present invention provides a thread management method and system based on a virtual machine. After the user process delivers a thread to the thread virtual machine, the thread virtual machine creates a virtual thread identifier that is exactly the same as the delivered thread as its own virtual thread identifier, obtains the data type in the thread, and sends the virtual thread identifier and the data type to the intermediate data module, so that the process can temporarily exit, and the subsequent thread processing steps can be handed over to the virtual machine; the intermediate data module allocates the corresponding data virtual machine to the virtual thread identifier according to the data type, and at this time the data virtual machine becomes an independent running individual with the virtual thread identifier of the process, waiting for its own operation to end and return to the process. In this way, the user process does not need to run, which is equivalent to the user process completing a delivery action and not continuing to participate, just waiting for the virtual machine to complete and return the processing result. Thread management is performed by virtual replication, which can save thread scheduling space while protecting the security of thread data, and can save memory space by opening fewer processes.

[0075] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent transformations made using the contents of the present invention's specification and drawings, or directly or indirectly applied in related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A thread management method based on a virtual machine, characterized in that: Includes steps: The thread virtual machine receives the thread delivered by the user process, creates a virtual thread identifier according to the thread identifier of the thread, obtains the data type in the thread, and sends the virtual thread identifier and the data type to the intermediate data module; The intermediate data module allocates a corresponding data virtual machine to the virtual thread identifier according to the data type; After the data virtual machine processes the data according to the virtual thread identifier, the data processing result is returned to the user process.

2. A thread management method based on a virtual machine according to claim 1, characterized in that: Get the data type in the thread, then include: The thread virtual machine creates a corresponding data virtual machine according to the data type.

3. A thread management method based on a virtual machine according to claim 1, characterized in that: The intermediate data module allocates a corresponding data virtual machine to the virtual thread identifier according to the data type, and also includes: The intermediate data module matches the corresponding data processing rules according to the data type, and sends the data processing rules to the allocated data virtual machine.

4. A thread management method based on a virtual machine according to claim 1, characterized in that: The intermediate data module allocates a corresponding data virtual machine to the virtual thread identifier according to the data type, and then further includes: The data virtual machine creates an initialization space for the virtual thread identifier and copies the virtual thread identifier into the initialization space.

5. The thread management method based on a virtual machine according to claim 1, characterized in that: The data processing result is returned to the user process, which then includes: Destroy the virtual thread identifier and the corresponding data virtual machine.

6. A thread management system based on a virtual machine, characterized in that: Including thread virtual machine, intermediate data module and data virtual machine; A thread virtual machine, used for receiving a thread delivered by a user process, creating a virtual thread identifier according to the thread identifier of the thread, obtaining a data type in the thread, and sending the virtual thread identifier and the data type to an intermediate data module; An intermediate data module, used for allocating a corresponding data virtual machine to the virtual thread identifier according to the data type; The data virtual machine is used to process the data according to the virtual thread identifier and return the data processing result to the user process.

7. A thread management system based on a virtual machine according to claim 6, characterized in that: Get the data type in the thread, then include: The thread virtual machine creates a corresponding data virtual machine according to the data type.

8. A thread management system based on a virtual machine according to claim 6, characterized in that: The intermediate data module allocates a corresponding data virtual machine to the virtual thread identifier according to the data type, and also includes: The intermediate data module matches the corresponding data processing rules according to the data type, and sends the data processing rules to the allocated data virtual machine.

9. A thread management system based on a virtual machine according to claim 6, characterized in that: The intermediate data module allocates a corresponding data virtual machine to the virtual thread identifier according to the data type, and then further includes: The data virtual machine creates an initialization space for the virtual thread identifier and copies the virtual thread identifier into the initialization space.

10. A thread management system based on a virtual machine according to claim 6, characterized in that: The data processing result is returned to the user process, which then includes: Destroy the virtual thread identifier and the corresponding data virtual machine.