Dynamic configuration system and device for simulation environment and readable storage medium
By designing a dynamic configuration system for simulation environment in the server and dynamically adjusting the hyperthreading state of the CPU core, the problem of the inability to optimize CPU resource configuration in the existing technology is solved, and efficient utilization and dynamic allocation of CPU resources by the simulation environment is realized.
Patent Information
- Application Number
- CN202411284126.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-13
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2044-09-13
AI Technical Summary
Existing servers cannot dynamically switch hyperthreaded state in the simulation environment, resulting in the inability to optimize CPU resource configuration under different simulation performance requirements and load conditions, affecting processing efficiency.
A dynamic configuration system for simulation environment is designed, including the basic configuration unit, user simulation environment application processing unit, simulation environment release processing unit and resource management pool. By dynamically adjusting the hyperthreading status of the CPU core, it is based on the simulation environment mode selected by the user. Allocation and release resources to achieve optimized configuration of CPU resources.
It realizes dynamic adjustment of CPU resource configuration according to simulation performance requirements and server load conditions, improves the resource utilization rate of the processor, supports users to select different modes of simulation environment management according to performance requirements, and ensures dynamic allocation of CPU resources by the simulation process.
Smart Images

Figure CN119292767A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and more specifically to a dynamic configuration system, device and readable storage medium of a simulation environment. Background Art
[0002] Hyper-threading technology is a hardware technology that can make a single physical CPU core look like multiple independent processors, allowing a single physical core to process multiple threads simultaneously, thereby improving the overall efficiency of the processor. Hyper-threading technology is particularly applicable in scenarios that require parallel processing, such as multitasking, server virtualization, big data processing, and high-performance computing. It can significantly improve the CPU resource utilization of the processor when processing multiple tasks simultaneously by reducing resource idle time.
[0003] Currently, for a server environment with multiple users in parallel, users have different performance requirements for running programs, and the server load varies at different times. If there are many simulation users, a single physical core can support more simulation environments through multi-threaded parallelism after hyperthreading is enabled. For a situation with fewer simulation users or higher simulation performance requirements, multi-threaded parallelism of physical cores after hyperthreading is enabled may cause resource contention, so hyperthreading needs to be turned off to avoid affecting the task processing efficiency of the CPU single thread.
[0004] However, currently the server manages the opening or closing of hyperthreading based on the entire CPU. It does not support dynamic switching of the hyperthreading state when the simulation system is running, nor does it support separate configuration of the physical cores bound to the simulation environment. Summary of the invention
[0005] In response to the above problems, the purpose of the present invention is to provide a dynamic configuration system, device and readable storage medium for a simulation environment, which can select simulation environments of different modes according to simulation performance requirements and server load conditions, and achieve more optimized configuration of CPU resources by dynamically configuring the hyper-threading state of the CPU core.
[0006] In order to achieve the above object, the present invention is implemented through the following technical solutions:
[0007] In a first aspect, the present invention discloses a dynamic configuration system for a simulation environment, the system running in a server, the system comprising: a basic configuration unit, a user simulation environment application processing unit, a simulation environment release processing unit, a resource management pool and a resource management pool maintenance unit;
[0008] The basic configuration unit is used to initialize the CPU core configuration of the server, configure the resource management pool, set the core allocation principle of the simulation environment, and set the hyperthreading switch mode of a single physical core;
[0009] A user simulation environment application processing unit, used to receive a simulation environment application sent by a user, adjust the hyperthreading of the CPU core using a resource management pool according to the simulation environment mode selected by the user, and allocate the simulation environment; the simulation environment mode includes a function mode and a performance mode;
[0010] A resource management pool, used to store the hyperthreading status information of the available CPU cores in the simulation environment and the current simulation environment information; the simulation environment information includes the process number of the simulation environment process, the simulation environment mode, and the bound logical core number;
[0011] A simulation environment release processing unit, used to receive a simulation environment release request sent by a user, obtain simulation environment information of the simulation environment from a resource management pool, restore the bound logical core to an initial state according to the simulation environment information, and release the simulation environment;
[0012] The resource management pool maintenance unit is used to regularly check the usage of available logical cores in each simulation environment and the simulation environment information of the resource management pool, so as to identify the simulation environment process that abnormally exits the performance mode and perform correction processing.
[0013] Furthermore, the basic configuration unit is specifically used for:
[0014] Enable the Hyper-Threading function through BIOS and set all logical cores to online;
[0015] Based on the CPU cores of the current server, the number of available logical cores is allocated to the simulation environment, a logical core number is set for each logical core, and the logical cores are isolated; the mapping relationship between logical cores and physical cores is set, and each physical core corresponds to two logical cores; the hyperthreading status information of the available CPU cores in the simulation environment and the current simulation environment information are written to the resource management pool;
[0016] The core allocation principle of the simulation environment is set as follows: each simulation environment is independently bound to a logical core and does not share logical cores with other simulation environments; when allocating simulation environment processes, idle logical cores are bound;
[0017] The hyperthreading switch mode of the single physical core is set as follows: by setting a corresponding logical core on each physical core to offline, one logical core is reserved to correspond to one physical core, so as to turn off the hyperthreading of the single physical core.
[0018] Further, the user simulation environment application processing unit includes:
[0019] The first interactive interface is used to receive a simulation environment application sent by a user;
[0020] A mode configuration module, used to determine the physical core for executing the simulation environment by executing the physical core configuration mechanism according to the simulation environment mode selected by the user;
[0021] The simulation environment allocation module is used to allocate physical cores to the simulation environment and update the hyperthreading state information of the available CPU cores of the simulation environment in the resource management pool and the current simulation environment information.
[0022] Furthermore, when the simulation environment mode selected by the user is the performance mode, the physical core configuration mechanism is specifically as follows:
[0023] Based on the simulation environment information, find out the logical core numbers bound to all current simulation environment processes;
[0024] Determine the currently idle logical core according to the logical core numbers bound to all current simulation environment processes;
[0025] If there is no idle logical core at present, it is considered that the simulation environment application has failed and an error message is returned;
[0026] If there is currently an idle logical core, obtain the number of the idle logical core;
[0027] Based on the number of the idle logical cores and the mapping relationship between the logical cores and the physical cores, the idle physical cores are screened out; the two logical cores corresponding to the idle physical cores are both in an idle state;
[0028] If no idle physical cores can be screened out, it is considered that the simulation environment application has failed and an error message is returned;
[0029] If an idle physical core can be screened out, the numbers of the two logical cores corresponding to the idle physical core are determined and recorded as a and b, respectively, where a<b; the two logical cores corresponding to the idle physical core are recorded as logical core a and logical core b, respectively; the state of logical core b is set to offline;
[0030] The logical core a is used as the logical core for running the simulation environment process.
[0031] Furthermore, when the simulation environment mode selected by the user is the performance mode, the physical core configuration mechanism is specifically as follows:
[0032] Based on the simulation environment information, find out the logical core numbers bound to all current simulation environment processes;
[0033] Determine the currently idle logical core according to the logical core numbers bound to all current simulation environment processes;
[0034] If there is no idle logical core at present, it is considered that the simulation environment application has failed and an error message is returned;
[0035] If there is currently an idle logical core, obtain the number of the idle logical core;
[0036] Based on the numbers of the idle logical cores and the mapping relationship between the logical cores and the physical cores, the physical cores corresponding to the idle logical cores are determined as the physical cores to be screened;
[0037] According to the mapping relationship between the logical core and the physical core, determine whether another logical core mapped to the physical core to be screened is in use;
[0038] If yes, the physical core is bound to a simulation environment process, and the idle logical core mapped to the physical core is used as a logical core for running the simulation environment process;
[0039] If all the physical cores to be screened are not bound to the simulation environment process, the idle logical core with the smallest number is used as the logical core for running the simulation environment process.
[0040] Further, the simulation environment release processing unit includes:
[0041] The second interactive interface is used to receive a simulation environment release request sent by a user;
[0042] The configuration restoration module is used to determine the physical core bound to the simulation environment by executing the hyperthreading state recovery mechanism according to the simulation environment release request, and restore its hyperthreading state;
[0043] The simulation environment release module is used to release the simulation environment and update the hyperthreading state information of the available CPU cores in the simulation environment in the resource management pool and the current simulation environment information.
[0044] Furthermore, the hyperthreading state recovery mechanism includes:
[0045] Acquire simulation environment information from the resource management pool, find out the process number of the corresponding simulation environment process according to the simulation environment release request, and determine the simulation environment mode of the simulation environment process;
[0046] When the simulation environment mode is the performance mode, based on the simulation environment information, the logical core number X bound to the simulation environment process is found according to the process number of the simulation environment process; based on the mapping relationship between the logical core and the physical core, according to the logical core number X, the physical core mapped by the logical core X is found, and the number Y of another logical core mapped by the physical core is determined; the state of the logical core Y is set to online.
[0047] Furthermore, the resource management pool maintenance unit is specifically used for:
[0048] At each preset interval, based on the simulation environment information, the logic cores in the idle state are screened out, and the logic cores in the offline state are further screened out;
[0049] For each logical core in the offline state, determine the physical core corresponding to the logical core in the offline state according to the mapping relationship between the logical core and the physical core;
[0050] Determine another logical core mapped to the physical core, and determine whether the logical core is in an idle state;
[0051] If yes, set the state of the logical core to online;
[0052] If not, determining the simulation environment mode of the logic core according to the simulation environment information;
[0053] If it is in performance mode, the logical core is running normally;
[0054] If it is in functional mode, the hyperthreading of the corresponding physical core is turned on.
[0055] In a second aspect, the present invention further discloses a dynamic configuration device for a simulation environment, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the function of the dynamic configuration system for the simulation environment as described in any one of the above items is implemented.
[0056] In a third aspect, the present invention further discloses a readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the function of the dynamic configuration system of the simulation environment as described in any one of the above items is realized.
[0057] Compared with the prior art, the present invention has the following beneficial effects:
[0058] 1. After receiving the simulation environment application, the present invention can adjust the hyperthreading of the CPU core according to different modes. During the adjustment process, it is necessary to interact with the resource management pool to obtain the current hyperthreading state of the CPU core and the core binding state of the existing simulation environment, and allocate the simulation environment after the configuration is completed; at the same time, after receiving the user's simulation environment release request, it can obtain the hyperthreading configuration of the simulation environment binding core from the resource management pool and restore it to the initial state through the configuration restoration module, and then release the simulation environment. In addition, the present invention can also regularly check whether the status of the CPU core and the simulation environment resource pool is normal, and promptly discover and correct the abnormal CPU hyperthreading state and the error storage information of the simulation environment.
[0059] 2 The present invention achieves the effect of turning on or off hyperthreading by turning on or off a logical core corresponding to a physical core. This configuration method can realize the dynamic allocation of CPU resources by the simulation process.
[0060] 3. The present invention develops a simulation environment management method that supports users to select different modes according to performance requirements, so that users can apply for simulation environments with different CPU resource configurations according to performance requirements or server user quantity requirements.
[0061] It can be seen that compared with the prior art, the present invention has outstanding substantive features and significant progress, and the beneficial effects of its implementation are also obvious. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0063] Figure 1 It is a system structure diagram of a specific implementation mode of the present invention.
[0064] Figure 2 It is a flowchart of the physical core configuration mechanism of a specific implementation mode of the present invention.
[0065] Figure 3 It is a flow chart of a hyperthreading state recovery mechanism according to a specific implementation mode of the present invention.
[0066] Figure 4 It is a schematic diagram of the resource maintenance process of a specific implementation mode of the present invention.
[0067] In the figure, 1. basic configuration unit; 2. user simulation environment application processing unit; 3. simulation environment release processing unit; 4. resource management pool; 5. resource management pool maintenance unit; 21. first interactive interface; 22. mode configuration module; 23. simulation environment allocation module; 31. second interactive interface; 32. configuration restoration module; 33. simulation environment release module. DETAILED DESCRIPTION
[0068] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in the specification of the present invention herein are only for the purpose of describing specific embodiments and are not intended to limit the present invention.
[0069] The key terms appearing in the present invention are explained below.
[0070] CPU (Central Processing Unit): The central processing unit, as the computing and control core of the computer system, is the final execution unit for information processing and program running.
[0071] BIOS (Basic Input Output System): A set of programs fixed on a ROM chip on the computer's motherboard that stores the computer's basic input and output programs, system settings, self-test programs after powering on, and system startup programs.
[0072] Physical core: A real CPU core with independent circuit elements and L1 and L2 caches that can execute instructions independently.
[0073] Logical core: A core at the logical level within the same physical core.
[0074] In order to enable those skilled in the art to better understand the scheme of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0075] See also Figure 1 As shown, this embodiment provides a dynamic configuration system for a simulation environment, which runs in a server and specifically includes: a basic configuration unit 1, a user simulation environment application processing unit 2, a simulation environment release processing unit 3, a resource management pool 4 and a resource management pool maintenance unit 5.
[0076] The basic configuration unit 1 is used to initialize the CPU core configuration of the server, configure the resource management pool, set the core allocation principle of the simulation environment, and set the hyperthreading switch mode of a single physical core.
[0077] In a specific implementation, the basic configuration unit 1 is specifically used to perform basic configuration of the system, and the configuration content is as follows:
[0078] 1. CPU core initialization configuration:
[0079] (1) Enable Hyper-Threading through BIOS and put the processor in Hyper-Threading state.
[0080] (2) Set all logical cores to online.
[0081] 2. Resource management pool configuration:
[0082] (1) Based on the CPU cores of the current server, the number and number of available logical cores in the simulation environment are allocated and these logical cores are isolated.
[0083] (2) Determine the mapping relationship between logical cores and physical cores, where each physical core is mapped to two logical cores.
[0084] (3) Writing the hyperthreading status information of the available CPU cores in the simulation environment and the current simulation environment information into the resource management pool; the simulation environment information includes the process number of the existing simulation environment process, the simulation environment mode, the bound logical core number, etc.
[0085] 3. Set the core allocation principle of the simulation environment:
[0086] (1) Each simulation environment is independently bound to a logical core and is not shared with other simulation environments;
[0087] (2) Bind idle logical cores when allocating simulation environment processes.
[0088] 4. Hyperthreading on / off configuration for a single physical core:
[0089] Currently, turning on or off the hyperthreading state through BIOS requires restarting the server, which will cause the simulation task in progress to be interrupted, data to be lost or damaged, and may also cause unnecessary wear and tear on the hardware, affecting the stability and availability of the system. In order to ensure the continuity of the simulation environment and the integrity of the data, frequent power on and off operations should be avoided as much as possible. Therefore, this system chooses to turn off hyperthreading at the software layer (inside the OS), that is, turn off (offline) a logical core corresponding to each physical core, and retain one logical core corresponding to one physical core to achieve the effect of turning off hyperthreading.
[0090] It should be noted that the operating system kernel controls the enable or disable status of a specific CPU core by writing 1 or 0 to the / sys / devices / system / cpu / cpuX / online file. The hyperthreading on / off mentioned later refers to the enable or disable of a single physical core of the CPU configured by the operating system.
[0091] The user simulation environment application processing unit 2 is used to receive the simulation environment application sent by the user, adjust the hyperthreading of the CPU core using the resource management pool according to the simulation environment mode selected by the user, and allocate the simulation environment.
[0092] Among them, users can choose the simulation environment mode when applying for the simulation environment. The simulation environment mode includes functional mode and performance mode. The functional mode only requires the correctness, stability and integrity of the simulation function; while the performance mode expects the system to allocate more CPU computing resources and has higher requirements for the performance of the simulation environment.
[0093] In a specific implementation, the user simulation environment application processing unit 2 includes: a first interaction interface 21 , a mode configuration module 22 and a simulation environment allocation module 23 .
[0094] The first interactive interface 21 is used to receive a simulation environment application sent by a user.
[0095] The mode configuration module 22 is used to determine the physical cores for executing the simulation environment by executing the physical core configuration mechanism according to the simulation environment mode selected by the user.
[0096] The simulation environment allocation module 23 is used to allocate physical cores to the simulation environment and update the hyperthreading state information of the available CPU cores of the simulation environment in the resource management pool and the current simulation environment information.
[0097] The resource management pool 4 is used to store the hyperthreading status information of the available CPU cores in the simulation environment and the current simulation environment information; the simulation environment information includes the process number of the simulation environment process, the simulation environment mode, and the bound logical core number.
[0098] It should be noted that the CPU core or simulation environment information involved in the hyperthreading adjustment or recovery process is all called from the resource management pool 4, and the resource management pool 4 can be implemented through a database or other algorithms.
[0099] The simulation environment release processing unit 3 is used to receive a simulation environment release request sent by a user, obtain the simulation environment information of the simulation environment from the resource management pool, restore the bound logical core to the initial state according to the simulation environment information, and release the simulation environment.
[0100] In a specific implementation, the simulation environment release processing unit 3 includes: a second interaction interface 31 , a configuration restoration module 32 and a simulation environment release module 33 .
[0101] The second interactive interface 31 is used to receive a simulation environment release request sent by a user.
[0102] The configuration restoration module 32 is used to determine the physical core bound to the simulation environment by executing the hyperthreading state recovery mechanism according to the simulation environment release request, and restore its hyperthreading state.
[0103] The simulation environment releasing module 33 is used to release the simulation environment and update the hyperthreading state information of the available CPU cores in the simulation environment in the resource management pool and the current simulation environment information.
[0104] The resource management pool maintenance unit 5 is used to regularly check the usage of the available logical cores of each simulation environment and the simulation environment information of the resource management pool, so as to identify the simulation environment process that abnormally exits the performance mode and perform correction processing.
[0105] The present invention discloses a dynamic configuration system for a simulation environment. When the system is running, after the user simulation environment application processing unit 2 receives the simulation environment application through the first interactive interface 21, the mode configuration module 22 adjusts the hyperthreading of the CPU core according to different modes. During the adjustment process, it is necessary to interact with the resource management pool 4 to obtain the current hyperthreading state of the CPU core and the core binding state of the existing simulation environment, and use the simulation environment allocation module 23 to perform corresponding configuration. After the configuration is completed, the simulation environment is allocated. After the second interactive interface 31 of the simulation environment release processing unit 3 receives the user simulation environment release request, it obtains the hyperthreading configuration of the core bound to the simulation environment from the resource management pool 4 and restores it to the initial state through the configuration restoration module 32, and then uses the simulation environment release module 33 to release the simulation environment. The main function of the resource management pool maintenance unit 5 is to regularly check whether the status of the CPU core and the simulation environment resource pool is normal, and to promptly discover and correct the abnormality of the CPU hyperthreading state and the error storage information of the simulation environment.
[0106] In a specific implementation, the mode configuration module 22 determines the physical cores for executing the simulation environment by executing the physical core configuration mechanism according to the simulation environment mode selected by the user. The initial state of the CPU core is that the hyperthreading is turned on. The mode configuration module 22 adjusts the hyperthreading state according to the simulation environment requirements, and processes the performance mode and function mode by executing the physical core configuration mechanism.
[0107] like Figure 2 As shown, the physical core configuration mechanism is as follows:
[0108] When the simulation environment mode selected by the user is the performance mode, the work of the mode configuration module mainly includes finding an idle physical core and disabling the hyperthreading of the physical core. The specific steps are as follows:
[0109] S1001: Find idle physical cores:
[0110] First, based on the simulation environment information, find out the logical core numbers bound to all current simulation environment processes; then, determine the currently idle logical cores based on the logical core numbers bound to all current simulation environment processes, and further determine the idle logical core numbers among the available logical cores in the simulation environment.
[0111] If there is no idle logical core at present, it is considered that the simulation environment application has failed and an error message is returned.
[0112] If there is an idle logical core currently, the number of the idle logical core is obtained. Based on the number of the idle logical core and the mapping relationship between the logical core and the physical core, the idle physical core is screened out; wherein the two logical cores corresponding to the idle physical core are both in an idle state.
[0113] At this time, if the idle physical core cannot be screened out, it is deemed that the simulation environment application has failed and an error message is returned; if the idle physical core can be screened out, the numbers of the two logical cores corresponding to the idle physical core are determined, and are recorded as a and b, respectively, a<b; the two logical cores corresponding to the idle physical core are recorded as logical core a and logical core b, respectively.
[0114] S1002: Disable the hyperthreading of the physical core:
[0115] Since disabling the hyperthreading of a physical core is achieved by controlling the enabling or disabling state of a corresponding logical core, first, the state of logical core b is set to offline; then logical core a is used as a logical core for running the simulation environment process.
[0116] At this point, the simulation environment process can be assigned to the logical core a, so that the corresponding physical core can run the simulation environment process in performance mode.
[0117] When the simulation environment mode selected by the user is the performance mode, the work of the mode configuration module mainly includes giving priority to the hyperthreaded physical cores to execute the simulation environment. If such physical cores do not exist, the idle physical cores are used to execute the simulation environment. The specific steps are as follows:
[0118] S1003: Find idle logical cores:
[0119] First, based on the simulation environment information, find out the logical core numbers bound to all current simulation environment processes; then, determine the currently idle logical cores based on the logical core numbers bound to all current simulation environment processes. If there are no idle logical cores, it is considered that the simulation environment application has failed and an error message is returned.
[0120] If there is currently an idle logical core, the number of the idle logical core is obtained; at this time, based on the number of the idle logical core and the mapping relationship between the logical core and the physical core, the physical core corresponding to the idle logical core is determined as the physical core to be screened.
[0121] Then, according to the mapping relationship between the logical cores and the physical cores, it is determined whether another logical core mapped to the physical core to be screened is in use.
[0122] If yes, it can be determined that the physical core is bound to a simulation environment process, and the idle logical core mapped to the physical core is used as the logical core for running the simulation environment process. That is, according to the mapping relationship between the logical core and the physical core, the physical core mapped to it is preferentially selected as an idle logical core in use to run the simulation environment process (that is, another logical core mapped to the same physical core as the logical core has a process bound to it).
[0123] If all the physical cores to be screened are not bound to the simulation environment process, the idle logical core with the smallest number is used as the logical core for running the simulation environment process.
[0124] At this point, the simulation environment process can be assigned to the screened logical cores, so that the corresponding physical cores can run the simulation environment process in the functional mode.
[0125] In a specific implementation, after receiving a simulation environment release request, the simulation environment release processing unit 3 restores the hyperthreading state of the physical core bound to the simulation environment by configuring the restoration module 32 to execute the hyperthreading state recovery mechanism. Figure 3 As shown, the hyperthreading state recovery mechanism is as follows:
[0126] First, the simulation environment information is obtained from the resource management pool, the process number of the corresponding simulation environment process is found out according to the simulation environment release request, and the simulation environment mode of the simulation environment process is determined.
[0127] When the simulation environment mode is the performance mode, based on the simulation environment information, the logical core number X bound to the simulation environment process is found according to the process number of the simulation environment process; based on the mapping relationship between the logical core and the physical core, according to the logical core number X, the physical core mapped by the logical core X is found, and the number Y of another logical core mapped by the physical core is determined; the state of the logical core Y is set to online.
[0128] When the simulation environment mode is functional mode, no operation is performed.
[0129] After the hyperthreading state recovery mechanism is executed, the simulation environment is released and the relevant information of the resource management pool is updated.
[0130] In a specific implementation, under normal circumstances, the simulation environment release operation is performed by the user, but there are also other situations where the simulation environment program terminates abnormally, such as insufficient memory, simulation program bugs, initial data errors, etc. In order to handle these abnormal situations, the system is provided with a resource management pool maintenance unit 5.
[0131] Since the simulation environment configuration of the functional mode does not need to change the hyperthreading state of the physical core to which it is bound, the abnormal exit of the program does not affect the physical core to which it is bound. However, the hyperthreading of the physical core to which it is bound is turned off during the simulation environment configuration of the performance mode, and the abnormal exit of the program cannot restore the initial state of the core. Therefore, the resource management pool maintenance unit 5 is used to filter out the simulation environment process that abnormally exits the performance mode and perform correction processing. The resource management pool maintenance unit 5 can implement the above functions by executing the resource maintenance process. Figure 4 As shown, the resource maintenance process includes the following steps:
[0132] Step 1: Filter out the processor cores in the idle state. Specifically, filter out the logic cores in the idle state based on the simulation environment information at each preset time interval.
[0133] Step 2: Filter out n processor cores in the offline state. Specifically, filter out n logical cores in the offline state from the logical cores in the idle state, and set a variable i, with an initial value of i set to 1. The n processor cores in the offline state are filtered one by one.
[0134] Step 3: Find the physical core mapped to the ith processor core according to the mapping relationship between the logical cores and the physical cores. Specifically, determine the physical core corresponding to the ith logical core according to the mapping relationship between the logical cores and the physical cores.
[0135] Step 4: Find another logical core that is mapped to the physical core. Specifically, determine another logical core other than the i-th logical core among the two logical cores mapped to the physical core according to the mapping relationship between the logical cores and the physical cores.
[0136] Step 5: Determine whether the logic core is in an idle state. If yes, execute step 6; if no, execute step 7.
[0137] Step 6: Enable the hyperthreading of the corresponding physical core, and execute step 8. Specifically, the hyperthreading of the corresponding physical core is enabled by setting the state of the logical core to online.
[0138] Step 7: Determine whether the simulation environment mode of the logic core is the performance mode; if so, execute step 8; if not, execute step 6.
[0139] Step 8: i=i+1;
[0140] Step 9: Determine whether i≥n; if so, end directly; if not, execute step 3.
[0141] In the above resource maintenance process, firstly, all processor cores in an idle state are screened out.
[0142] Then, filter out all the processor cores in the offline state, and perform the following screening on these cores one by one:
[0143] 1) Determine the physical core corresponding to the CPU core according to the mapping relationship between the logical core and the physical core;
[0144] 2) Determine another logical core mapped to the physical core (normally, the logical core with a smaller number), and determine whether it is an idle CPU core:
[0145] If yes, enable hyperthreading for the physical core and continue to check the next core;
[0146] If not, determine whether the simulation environment it is bound to is in performance mode:
[0147] If yes, continue to check the next core;
[0148] If not, turn on hyperthreading for that physical core and continue checking the next core.
[0149] Based on the dynamic configuration system of the above simulation environment, in order to better illustrate the implementation process of the specific functions of the system, the operation process of each functional unit of the system is explained with a specific example, as follows:
[0150] 1. Design a database table structure as a resource management pool to store the core binding information and mode information of the simulation environment process. For example, define the database table structure as follows:
[0151] id: Auto-increment primary key that uniquely identifies each record.
[0152] pid: Process ID.
[0153] command: The command name or path of the process.
[0154] cpu_affinity: CPU affinity of the process (bound CPU core information).
[0155] status: The status of the process (such as running, terminated, etc.).
[0156] mode: performance mode or functional mode.
[0157] 2. Use the basic configuration unit to perform the following operations:
[0158] Enable hyperthreading through BIOS; allocate 8 available logical cores for the simulation environment to the current server, numbered 0-7; every two logical cores share one physical core resource, and define the mapped 4 physical core numbers as 0, 1, 2, and 3 respectively. At this time, set the mapping relationship between logical cores and physical cores. The specific mapping relationship is shown in Table 1 below:
[0159] Table 1: Mapping relationship between logical cores and physical cores
[0160] Logic Core 0 1 2 3 4 5 6 7 Mapped physical cores 0 0 1 1 2 2 3 3
[0161] At this time, all CPU cores are online, and a simulation environment of up to 8 functional modes can be configured.
[0162] 3. Use the user simulation environment to apply for the processing unit to perform the following operations:
[0163] 3.1. When the simulation environment mode selected by the user is the performance mode, first search the database for the logical core numbers bound to all current simulation processes, and obtain that the current logical cores 0, 1, and 2 are bound. Then, based on the information of all available cores in the simulation environment that is initialized, determine that the idle logical core numbers in the available logical cores of the simulation environment are 3, 4, 5, 6, and 7. At this time, logical cores 4 and 5 are also mapped to physical core 2, and are both in an idle state, indicating that physical core 2 is idle. Finally, set the state of logical core 5 to offline, and use logical core 4 as the CPU core bound to the simulation environment to be run, start configuring the simulation environment, and update the database information.
[0164] 3.2. When the simulation environment mode selected by the user is the functional mode, first search the database for the logical core numbers bound to all current simulation processes, and obtain that the current logical cores 0, 1, and 2 are bound. Then, based on the information of all available cores in the simulation environment that is initialized and configured, determine that the idle logical core numbers in the available logical cores of the simulation environment are 3, 4, 5, 6, and 7. At this time, it can be determined that logical core 3 is mapped to physical core 1, and the other logical core 2 mapped to physical core 1 is non-idle. Finally, select logical core 3 as the CPU core bound to the simulation environment to be run, start configuring the simulation environment, and update the database information.
[0165] 4. Use the simulation environment to release the processing unit to perform the following operations:
[0166] If the simulation environment release processing unit receives a release request from the simulation process, it finds out that the simulation process is in performance mode and is bound to logical core 4. By querying Table 1, it is known that logical core 4 and logical core 5 belong to physical core 2, and it is determined that logical core 5 is in the offline state. Finally, logical core 5 is configured to be online, the database is updated, and the simulation environment release is executed.
[0167] If the simulation environment release processing unit receives a release application of a simulation process, it finds out that the simulation process is in a functional mode, directly executes the simulation environment release and updates the database information.
[0168] 5. Use the resource management pool maintenance unit to perform the following operations every 30 minutes:
[0169] 5.1. Query the database and obtain the logical core serial numbers of all current simulation processes to find that logical core 0, logical core 1, and logical core 2 are in use.
[0170] 5.2. It is further calculated that the processor cores in the idle state are logical core 3, logical core 4, logical core 5, logical core 6, and logical core 7.
[0171] 5.3. Query the processor cores in the offline state based on the cpu information. Find that logical core 3 and logical core 5 are in the offline state. Perform the following screening on logical core 3 and logical core 5:
[0172] First, according to the mapping relationship between logical cores and physical cores, it is determined that logical core 3 is mapped to physical core 1, and logical core 5 is mapped to physical core 2.
[0173] At this time, another logical core 2 mapped to the physical core 1 can be determined based on the logical core 3. After querying, the simulation process bound to the logical core 2 is in performance mode, and the process is running normally, so the logical core 5 is checked again.
[0174] According to logical core 5, another logical core 4 mapped to physical core 2 can be determined. After query, it is found that there is a process bound to core 4, but according to the process number, it is found that the process does not exist, indicating that the simulation program exits abnormally. Therefore, by configuring logical core 5 to be online, physical core 2 is restored to its initial state and the database information is updated.
[0175] It can be seen that the present invention discloses a dynamic configuration system for a simulation environment, which can realize the selective configuration of the simulation environment performance and form a relatively complete simulation environment management method and system by supplementing the resource management pool maintenance unit.
[0176] The present invention also provides a dynamic configuration device for a simulation environment, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the function of dynamic configuration of the simulation environment as described in any one of the above items when executing the computer program.
[0177] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the function of dynamically configuring the simulation environment is realized.
[0178] The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors, application-specific integrated circuits, field programmable gate arrays, or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.
[0179] The memory can be used to store the computer program and / or module, and the processor realizes various functions of the blockchain-based medical material refined management system in the invention by running or executing the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.). In addition, the memory can include a high-speed random access memory and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card, a secure digital card, a flash memory card, at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0180] If the dynamic configuration system of the simulation environment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be stored in a computer-readable storage medium through a computer program. When the computer program is executed by the processor, the steps of the above-mentioned various method embodiments can be implemented. Among them, the computer program includes computer program code, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device that can carry the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory, random access memory, point carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction.
[0181] The present invention has described the basic concepts. Obviously, for those skilled in the art, the above detailed disclosure is only for example and does not constitute a limitation of this specification. Although not explicitly stated herein, those skilled in the art may make various modifications, improvements and corrections to this specification. Such modifications, improvements and corrections are suggested in this specification, so such modifications, improvements and corrections still belong to the spirit and scope of the exemplary embodiments of this specification.
[0182] In addition, it will be understood by those skilled in the art that various aspects of this specification may be illustrated and described by a number of patentable categories or situations, including any new and useful process, machine, product or combination of substances, or any new and useful improvements thereto. Accordingly, various aspects of this specification may be performed entirely by hardware, entirely by software (including firmware, resident software, microcode, etc.), or by a combination of hardware and software. The above hardware or software may be referred to as "data blocks", "modules", "engines", "units", "components" or "systems". In addition, various aspects of this specification may be represented as a computer product located in one or more computer-readable media, which includes computer-readable program code.
[0183] A computer storage medium may include a propagated data signal containing computer program code, for example, in baseband or as part of a carrier wave. The propagated signal may be in a variety of forms, including electromagnetic, optical, etc., or a suitable combination. A computer storage medium may be any computer-readable medium other than a computer-readable storage medium, which can be connected to an instruction execution system, device or apparatus to communicate, propagate or transmit the program for use. The program code on the computer storage medium may be transmitted via any suitable medium, including radio, cable, fiber optic cable, RF, or similar media, or any combination of the above media.
[0184] The computer program code required for the operation of each part of this specification can be written in any one or more programming languages, including object-oriented programming languages such as Java, Scala, Smalltalk, Eiffel, JADE, Emerald, C++, C#, VB.NET, Python, etc., conventional procedural programming languages such as C language, VisualBasic, Fortran2003, Perl, COBOL2002, PHP, ABAP, dynamic programming languages such as Python, Ruby and Groovy, or other programming languages, etc. The program code can be run entirely on the user's computer, or run on the user's computer as an independent software package, or run partially on the user's computer and partially on a remote computer, or run entirely on a remote computer or server. In the latter case, the remote computer can be connected to the user's computer through any network form, such as a local area network (LAN) or a wide area network (WAN), or connected to an external computer (e.g., via the Internet), or in a cloud computing environment, or used as a service such as software as a service (SaaS).
[0185] In addition, unless explicitly stated in the claims, the order of the processing elements and sequences described in this specification, the use of alphanumeric characters, or the use of other names are not intended to limit the order of the processes and methods of this specification. Although the above disclosure discusses some invention embodiments that are currently considered useful through various examples, it should be understood that such details are only for illustrative purposes, and the attached claims are not limited to the disclosed embodiments. On the contrary, the claims are intended to cover all modifications and equivalent combinations that are consistent with the essence and scope of the embodiments of this specification. For example, although the system components described above can be implemented by hardware devices, they can also be implemented only by software solutions, such as installing the described system on an existing server or mobile device.
[0186] Similarly, it should be noted that in order to simplify the description disclosed in this specification and thus help understand one or more embodiments of the invention, in the above description of the embodiments of this specification, multiple features are sometimes combined into one embodiment, figure or description thereof. However, this disclosure method does not mean that the features required by the subject matter of this specification are more than the features mentioned in the claims. In fact, the features of the embodiments are less than all the features of the single embodiment disclosed above.
[0187] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0188] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A dynamic configuration system for a simulation environment, characterized in that: The system runs in a server, and includes: a basic configuration unit, a user simulation environment application processing unit, a simulation environment release processing unit, a resource management pool, and a resource management pool maintenance unit; The basic configuration unit is used to initialize the CPU core configuration of the server, configure the resource management pool, set the core allocation principle of the simulation environment, and set the hyperthreading switch mode of a single physical core; A user simulation environment application processing unit, used to receive a simulation environment application sent by a user, adjust the hyperthreading of the CPU core using a resource management pool according to the simulation environment mode selected by the user, and allocate the simulation environment; the simulation environment mode includes a function mode and a performance mode; A resource management pool, used to store the hyperthreading status information of the available CPU cores in the simulation environment and the current simulation environment information; the simulation environment information includes the process number of the simulation environment process, the simulation environment mode, and the bound logical core number; A simulation environment release processing unit, used to receive a simulation environment release request sent by a user, obtain simulation environment information of the simulation environment from a resource management pool, restore the bound logical core to an initial state according to the simulation environment information, and release the simulation environment; The resource management pool maintenance unit is used to regularly check the usage of available logical cores in each simulation environment and the simulation environment information of the resource management pool, so as to identify the simulation environment process that abnormally exits the performance mode and perform correction processing.
2. The dynamic configuration system of the simulation environment according to claim 1, characterized in that: The basic configuration unit is specifically used for: Enable the Hyper-Threading function through BIOS and set all logical cores to online; Based on the CPU cores of the current server, the number of available logical cores is allocated to the simulation environment, a logical core number is set for each logical core, and the logical cores are isolated; Set the mapping relationship between logical cores and physical cores, with each physical core corresponding to two logical cores; write the hyperthreading status information of the available CPU cores in the simulation environment and the current simulation environment information to the resource management pool; The core allocation principle of the simulation environment is set as follows: each simulation environment is independently bound to a logical core and does not share logical cores with other simulation environments; when allocating simulation environment processes, idle logical cores are bound; The hyperthreading switch mode of the single physical core is set as follows: by setting a corresponding logical core on each physical core to offline, one logical core is reserved to correspond to one physical core, so as to turn off the hyperthreading of the single physical core.
3. The dynamic configuration system of the simulation environment according to claim 2, characterized in that: The user simulation environment application processing unit comprises: The first interactive interface is used to receive a simulation environment application sent by a user; A mode configuration module, used to determine the physical core for executing the simulation environment by executing the physical core configuration mechanism according to the simulation environment mode selected by the user; The simulation environment allocation module is used to allocate physical cores to the simulation environment and update the hyperthreading state information of the available CPU cores of the simulation environment in the resource management pool and the current simulation environment information.
4. The dynamic configuration system of the simulation environment according to claim 3, characterized in that: When the simulation environment mode selected by the user is the performance mode, the physical core configuration mechanism is specifically as follows: Based on the simulation environment information, find out the logical core numbers bound to all current simulation environment processes; Determine the currently idle logical core according to the logical core numbers bound to all current simulation environment processes; If there is no idle logical core at present, it is considered that the simulation environment application has failed and an error message is returned; If there is currently an idle logical core, obtain the number of the idle logical core; Based on the number of the idle logical cores and the mapping relationship between the logical cores and the physical cores, the idle physical cores are screened out; the two logical cores corresponding to the idle physical cores are both in an idle state; If no idle physical cores can be screened out, it is considered that the simulation environment application has failed and an error message is returned; If an idle physical core can be screened out, the numbers of the two logical cores corresponding to the idle physical core are determined and recorded as a and b, respectively, where a<b; the two logical cores corresponding to the idle physical core are recorded as logical core a and logical core b, respectively; the state of logical core b is set to offline; The logical core a is used as the logical core for running the simulation environment process.
5. The dynamic configuration system of the simulation environment according to claim 4, characterized in that: When the simulation environment mode selected by the user is the performance mode, the physical core configuration mechanism is specifically as follows: Based on the simulation environment information, find out the logical core numbers bound to all current simulation environment processes; Determine the currently idle logical core according to the logical core numbers bound to all current simulation environment processes; If there is no idle logical core at present, it is considered that the simulation environment application has failed and an error message is returned; If there is currently an idle logical core, obtain the number of the idle logical core; Based on the numbers of the idle logical cores and the mapping relationship between the logical cores and the physical cores, the physical cores corresponding to the idle logical cores are determined as the physical cores to be screened; According to the mapping relationship between the logical core and the physical core, determine whether another logical core mapped to the physical core to be screened is in use; If yes, the physical core is bound to a simulation environment process, and the idle logical core mapped to the physical core is used as a logical core for running the simulation environment process; If all the physical cores to be screened are not bound to the simulation environment process, the idle logical core with the smallest number is used as the logical core for running the simulation environment process.
6. The dynamic configuration system of the simulation environment according to claim 5, characterized in that: The simulation environment release processing unit comprises: The second interactive interface is used to receive a simulation environment release request sent by a user; The configuration restoration module is used to determine the physical core bound to the simulation environment by executing the hyperthreading state recovery mechanism according to the simulation environment release request, and restore its hyperthreading state; The simulation environment release module is used to release the simulation environment and update the hyperthreading state information of the available CPU cores in the simulation environment in the resource management pool and the current simulation environment information.
7. The dynamic configuration system of the simulation environment according to claim 6, characterized in that: The hyperthreading state recovery mechanism includes: Acquire simulation environment information from the resource management pool, find out the process number of the corresponding simulation environment process according to the simulation environment release request, and determine the simulation environment mode of the simulation environment process; When the simulation environment mode is the performance mode, based on the simulation environment information, the logical core number X bound to the simulation environment process is found according to the process number of the simulation environment process; based on the mapping relationship between the logical core and the physical core, according to the logical core number X, the physical core mapped by the logical core X is found, and the number Y of another logical core mapped by the physical core is determined; the state of the logical core Y is set to online.
8. The dynamic configuration system of the simulation environment according to claim 7, characterized in that: The resource management pool maintenance unit is specifically used for: At each preset interval, based on the simulation environment information, the logic cores in the idle state are screened out, and the logic cores in the offline state are further screened out; For each logical core in the offline state, determine the physical core corresponding to the logical core in the offline state according to the mapping relationship between the logical core and the physical core; Determine another logical core mapped to the physical core, and determine whether the logical core is in an idle state; If yes, set the state of the logical core to online; If not, determining the simulation environment mode of the logic core according to the simulation environment information; If it is in performance mode, the logical core is running normally; If it is in functional mode, the hyperthreading of the corresponding physical core is turned on.
9. A dynamic configuration device for a simulation environment, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the function of the dynamic configuration system of the simulation environment as claimed in any one of claims 1 to 8 is realized.
10. A readable storage medium, characterized in that: The readable storage medium stores a computer program, which, when executed by a processor, implements the functions of the dynamic configuration system of the simulation environment as claimed in any one of claims 1 to 8.
Citation Information
Patent Citations
Multi-core communication acceleration using hardware queue device
CN108292239A
Method, device, equipment and product for improving performance of storage system
CN112231102A
Python-based simulation environment management platform, method, equipment and medium
CN114818565A
Task scheduling method and device, equipment and storage medium
CN114968500A
Accelerating eight-way parallel keccak execution
US20240211268A1