Business execution method, device, terminal device and storage medium
By managing thread memory applications in the client, determining core memory and extended memory, the system lag caused by frequent memory application by multiple threads is solved, and the stability of business execution is improved.
Patent Information
- Application Number
- CN202010753712.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-30
- Publication Date
- 2025-06-27
- Estimated Expiration
- 2040-07-30
AI Technical Summary
When the client executes multiple tasks, multiple threads frequently apply for memory, resulting in insufficient memory, system lag, and affecting the stability of business execution.
By obtaining the number of memory required by each thread in the business to be executed, comparing the pre-set core memory and maximum memory number, determining the core memory and extended memory, executing threads through these memory, managing memory footprints, and avoiding frequent memory application.
It effectively avoids multiple threads frequently requesting memory, prevents system lag, and improves the stability of business execution.
Smart Images

Figure CN112052079B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technologies, and particularly to a service execution method, apparatus, terminal device, and storage medium. Background Art
[0002] When a client executes a task, a task may include multiple threads, and each thread requires a memory to execute. If multiple tasks are performed simultaneously, multiple threads will frequently apply for memory, which may cause the client to experience system lag due to insufficient memory, affecting the stability of service execution. Summary of the Invention
[0003] In view of the above problems, embodiments of the present invention are proposed to provide a service execution method, apparatus, terminal device, and storage medium that overcome the above problems or at least partially solve the above problems.
[0004] In a first aspect, an embodiment of the present invention provides a service execution method, which includes:
[0005] Obtain a first memory number m required to be applied by each thread in the service to be executed;
[0006] Compare the first memory number m with a pre-set core memory number n and a pre-set maximum memory number respectively;
[0007] If the first memory number m is greater than the pre-set core memory number n and the first memory number is less than or equal to the pre-set maximum memory number, determine a core memory corresponding to the pre-set core memory number n and m - n extended memories, where m and n are natural numbers greater than 0;
[0008] Execute each thread in the service to be executed through the core memory and the extended memories.
[0009] Optionally, the method further includes:
[0010] If the m - n extended memories are not occupied to execute the service to be executed within a preset waiting time, release the m - n extended memories.
[0011] Optionally, the method further includes:
[0012] Within a preset waiting time and when each thread in the service to be executed has been completed, occupy the core memory and extended memories corresponding to the first memory number to execute each thread of a new service.
[0013] Optionally, the method further includes:
[0014] If the first memory number m is greater than the pre-set maximum memory number max, determine the memory space corresponding to the pre-set maximum memory number max;
[0015] Sort each thread in the to-be-executed task in a preset order to obtain a thread sequence, and execute the first max first threads in the order of the thread sequence through the memory space;
[0016] Store the remaining m - max second threads in the thread sequence in a pre-established waiting queue, where max and m - max are natural numbers greater than 0, and m - max is less than or equal to the pre-set waiting queue length;
[0017] If a first thread is executed, then occupy the idle memory space corresponding to the first thread to execute the second thread.
[0018] Optionally, the method further includes:
[0019] If the number of the m - max second threads is greater than the pre-set waiting queue length a, execute a pre-set waiting queue policy, where the waiting queue policy is to delete the first m - max - a threads in the waiting queue or delete the last m - max - a threads in the waiting queue, where a and m - max - a are natural numbers greater than 0.
[0020] Optionally, the method further includes:
[0021] If the first memory number m is less than or equal to the pre-set core memory number n, determine the core memory corresponding to the first memory number m to execute each thread in the to-be-executed service.
[0022] In a second aspect, an embodiment of the present invention provides a service execution device, and the device includes:
[0023] An acquisition module, configured to acquire the first memory number m required by each thread in the to-be-executed service;
[0024] A comparison module, configured to compare the first memory number m with a pre-set core memory number n and a pre-set maximum memory number respectively;
[0025] A memory application module, configured to determine the core memory corresponding to the pre-set core memory number n and m - n extended memories if the first memory number m is greater than the pre-set core memory number n and the first memory number is less than or equal to the pre-set maximum memory number, where m and n are natural numbers greater than 0;
[0026] An execution module, configured to execute each thread in the to-be-executed service through the core memory and the extended memory.
[0027] Optionally, the device further includes a release module, and the release module is configured to:
[0028] If the m - n extended memories are not occupied to execute the to-be-executed service within a preset waiting time, release the m - n extended memories.
[0029] Optionally, the device further includes an occupation module, and the occupation module is configured to:
[0030] Within a preset waiting time and when each thread in the to-be-executed service is executed, occupy the core memory and the extended memory corresponding to the first memory number to execute each thread of the new service.
[0031] Optionally, the memory application module is further configured to:
[0032] If the first memory number m is greater than the preset maximum memory number max, determine the memory space corresponding to the preset maximum memory number max;
[0033] The execution module is further configured to:
[0034] Sort each thread in the to-be-executed task in a preset order to obtain a thread sequence, and execute the first max first threads in the order of the thread sequence through the memory space;
[0035] Store the remaining m - max second threads in the thread sequence in a pre-established waiting queue, where max and m - max are natural numbers greater than 0, and m - max is less than or equal to the preset waiting queue length;
[0036] If a first thread is executed, then occupy the idle memory space corresponding to the first thread to execute the second thread.
[0037] Optionally, the execution module is further configured to:
[0038] If the number of the m - max second threads is greater than the preset waiting queue length a, execute a preset waiting queue policy, where the waiting queue policy is to delete the first m - max - a threads in the waiting queue or delete the last m - max - a threads in the waiting queue, where a and m - max - a are natural numbers greater than 0.
[0039] Optionally, the memory application module is further configured to:
[0040] If the first memory number m is less than or equal to the pre-set core memory number n, determine the core memory corresponding to the first memory number m to execute each thread in the to-be-executed service.
[0041] In a third aspect, an embodiment of the present invention provides a terminal device, including: at least one processor and a memory;
[0042] The memory stores a computer program; the at least one processor executes the computer program stored in the memory to implement the service execution method provided in the first aspect.
[0043] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed, the service execution method provided in the first aspect is implemented.
[0044] The embodiments of the present invention include the following advantages:
[0045] The service execution method, device, terminal device and storage medium provided by the embodiments of the present invention obtain the first memory number m required for each thread in the to-be-executed service; compare the first memory number m with the pre-set core memory number n and the pre-set maximum memory number respectively; if the first memory number m is greater than the pre-set core memory number n and less than or equal to the pre-set maximum memory number, determine the core memory corresponding to the pre-set core memory number n and m - n extended memories, where m and n are natural numbers greater than 0; execute each thread in the to-be-executed service through the core memory and the extended memories, and manage the memory occupied by the threads in each service, avoiding the problem that multiple threads frequently apply for memory, resulting in system lag of the client due to insufficient memory, and providing the stability of service execution. Description of the Drawings
[0046] Figure 1 is a flowchart of the steps of an embodiment of a service execution method of the present invention;
[0047] Figure 2 is a flowchart of the steps of another embodiment of a service execution method of the present invention;
[0048] Figure 3 is a flowchart of the steps of yet another embodiment of a service execution method of the present invention;
[0049] Figure 4 is a structural block diagram of an embodiment of a service execution device of the present invention;
[0050] Figure 5 is a schematic structural diagram of a terminal device of the present invention. Detailed Embodiments
[0051] In order to make the above objects, features and advantages of the present invention more obvious and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0052] The Visual Networking is an important milestone in the development of the network. It is a real-time network that can achieve real-time transmission of high-definition videos, pushing many Internet applications towards high-definition video and high-definition face-to-face.
[0053] The Visual Networking adopts real-time high-definition video exchange technology, and can integrate dozens of services such as high-definition video conferencing, video surveillance, intelligent surveillance analysis, emergency command, digital radio and television, delayed television, online teaching, live broadcast, VOD on demand, TV mail, personalized recording (PVR), internal network (self-run) channels, intelligent video playback control, information release, etc. of videos, voices, pictures, texts, communications, data, etc. on a network platform, and realizes high-definition quality video playback through a TV or a computer.
[0054] An embodiment of the present invention provides a service execution method for the memory corresponding to a service application applied by a terminal. The execution subject of this embodiment is a service execution device, which is set on a terminal device. Among them, the terminal device can be a computer, a tablet computer, a mobile phone terminal, etc.
[0055] Refer to Figure 1 , which shows a step flow chart of an embodiment of a service execution method of the present invention. The method may specifically include the following steps:
[0056] S101. Obtain the first memory number m required by each thread in the service to be executed;
[0057] Specifically, multiple applications can be installed on the terminal device. An application includes multiple processes, that is, multiple services. A service includes multiple threads, and each thread execution requires memory space. The number of memory spaces required is the same as the number of threads.
[0058] When the terminal device needs to execute a certain service, determine how many threads are included in the service, that is, determine how many memory spaces are required to execute the service, that is, determine the first memory number m required by each thread in the service to be executed.
[0059] S102. Compare the first memory number m with a pre-set core memory number n and a pre-set maximum memory number respectively;
[0060] Specifically, a core memory number n and a maximum memory number max are pre-set on the terminal device, and the terminal device compares the first memory number m with the pre-set core memory number n and the maximum memory number max respectively.
[0061] S103. If the first memory number m is greater than the pre-set core memory number n and the first memory number is less than or equal to the pre-set maximum memory number, determine the core memory corresponding to the pre-set core memory number n and m - n extended memories, where m and n are natural numbers greater than 0.
[0062] Specifically, the terminal device determines the first memory number, the pre-set core memory number, and the maximum memory number. If the first memory number m is greater than the pre-set core memory number n and the first memory number is less than or equal to the pre-set maximum memory number max, then n core memories and m - n extended memories need to be applied for. Here, m, n, and m - n are natural numbers greater than 0. The core memory does not need to be released after the thread execution is completed, while the extended memory needs to be released.
[0063] S104. Execute each thread in the to-be-executed service through the core memory and the extended memory.
[0064] Specifically, the terminal device executes each thread in the to-be-executed service through the applied core memory and extended memory.
[0065] Exemplarily, if the number of threads in the to-be-executed service is 13 threads, the core memory number is 10, and the maximum memory number is 15, that is, 10 < 13 < 15, then 10 core memories and 3 extended memories need to be determined, and the terminal device occupies 10 core memories and 3 extended memories to execute 13 threads.
[0066] The service execution method provided by the embodiment of the present invention obtains the first memory number m required by each thread in the to-be-executed service; compares the first memory number m with the pre-set core memory number n and the pre-set maximum memory number respectively; if the first memory number m is greater than the pre-set core memory number n and the first memory number is less than or equal to the pre-set maximum memory number, determine the core memory corresponding to the pre-set core memory number n and m - n extended memories, where m and n are natural numbers greater than 0; execute each thread in the to-be-executed service through the core memory and the extended memory. By managing the memory occupied by the threads in each service, it avoids the problem that multiple threads frequently apply for memory, resulting in system lags due to insufficient memory on the client side, and provides the stability of service execution.
[0067] Another embodiment of the present invention further supplements and explains the service execution method provided in the above embodiment.
[0068] As Figure 2 shown, it shows the step flowchart of another embodiment of the service execution method of the present invention. The service execution method includes:
[0069] S201. Obtain the first memory quantity m required by each thread in the business to be executed.
[0070] S202. Compare the first memory quantity m with the pre-set core memory quantity n and the pre-set maximum memory quantity respectively.
[0071] Since steps S201 to S202 are the same as steps S101 and S102 in the Figure 1 illustrated embodiment. The detailed description of steps S101 to S102 has been given in Figure 1 . Therefore, steps S201 to S202 will not be elaborated here.
[0072] The magnitudes of the first memory quantity m, the pre-set core memory quantity n, and the pre-set maximum memory quantity are as described below.
[0073] S2021. If the first memory quantity m is less than or equal to the pre-set core memory quantity n, determine the core memory corresponding to the first memory quantity m to execute each thread in the business to be executed.
[0074] Exemplarily, if the first memory quantity is 8 and the pre-set core memory quantity is 10, and 8 is less than 10, then 8 core memories need to be applied for to execute 8 threads.
[0075] S2022. If the first memory quantity m is greater than the pre-set core memory quantity n and the first memory quantity is less than or equal to the pre-set maximum memory quantity, determine the core memory corresponding to the pre-set core memory quantity n and m - n extended memories, where m and n are natural numbers greater than 0.
[0076] S203. Execute each thread in the business to be executed through the core memory and the extended memories.
[0077] S204. If within the preset waiting time, the m - n extended memories are not occupied to execute the business to be executed, release the m - n extended memories.
[0078] Specifically, in this case, apply for n core memories and m - n extended memories, preset a waiting time on the terminal device. If the extended memories are not occupied to execute the threads within this waiting time, release the extended memories, but do not release the n core memories.
[0079] S205. Within the preset waiting time and when each thread in the business to be executed has been completed, occupy the core memory and the extended memories corresponding to the first memory quantity to execute each thread of the new business.
[0080] Specifically, within a preset waiting time, if all threads of the task to be executed have been completed, then the memory space applied for is occupied to continue executing all threads of the new task, so that there is no need to frequently apply for memory space. Here, the memory space includes the core memory corresponding to the preset number n of core memories, and m - n extended memories.
[0081] S2023. If the first memory number m is greater than the preset maximum memory number max, then determine the memory space corresponding to the preset maximum memory number max.
[0082] S206. Sort all threads in the task to be executed in a preset order to obtain a thread sequence, and execute the first max first threads in the order of the thread sequence through the memory space.
[0083] S207. Store the remaining m - max second threads in the preset waiting queue, where max and m - max are natural numbers greater than 0, and m - max is less than or equal to the preset length of the waiting queue.
[0084] S208. If a first thread has been completed, then occupy the idle memory space corresponding to the first thread to execute the second thread.
[0085] Specifically, when the first memory number m is greater than the preset maximum memory number max, then apply for max memory spaces, and the first max threads occupy max memory spaces, and the remaining m - max threads are stored in the waiting queue. When any one of the first max threads has been completed, the memory space corresponding to this thread becomes idle, and the threads in the waiting queue will occupy the idle memory space to execute.
[0086] S209. If the number of the m - max second threads is greater than the preset length a of the waiting queue, then execute the preset waiting queue strategy, where the waiting queue strategy is to delete the first m - max - a threads in the waiting queue, or delete the last m - max - a threads in the waiting queue, where a and m - max - a are natural numbers greater than 0.
[0087] Specifically, when the number of m - max threads is greater than the preset length a of the waiting queue, then execute the preset waiting queue strategy.
[0088] Exemplarily, if the first memory number m is 15, the maximum memory number max is 10, and the preset waiting queue length is 3, then m - max is 5, 5 > 3, so the first 2 threads in the waiting queue are deleted, or the last 2 threads in the waiting queue are deleted.
[0089] Figure 3 It is a step flowchart of another embodiment of the service execution method of the present invention. As Figure 3 shown, the service execution method includes:
[0090] When the client (terminal device) executes a service, it will first initialize the number of core memories that can be applied for (n), the maximum memory that can be applied for (max), the free memory release time (time), the number of waiting execution queues (length), and the execution policy (policy) for tasks greater than the waiting queue.
[0091] When the client executes a task, it will first determine whether the currently applied memory quantity is greater than n. If it is less than n, it will apply for memory to execute the thread. After execution, the applied memory is not released and waits for the execution of the next task.
[0092] If the currently applied memory quantity is greater than n, it will then determine whether the applied memory number is greater than max. If it is less than max, it will apply for memory to execute the thread. After execution, it will wait for time and then release the core memory in this memory space;
[0093] If there is a new task within the time of time, it will continue to use this memory to execute.
[0094] When the currently applied memory quantity is greater than max, the unexecuted threads will be placed in the waiting queue and wait to be executed when there are idle threads. However, the premise is that it is not greater than the length of the waiting queue. If it is greater than length, then policy will be executed.
[0095] Among them, policy can be customized: for example, if the applied memory number is already greater than length, when there is a task, new tasks will be discarded, or old tasks in the queue will be discarded and new tasks will be executed. Solving the problem of increased occupied memory when the client performs a lot of services simultaneously can significantly improve the execution efficiency of the client software and the performance of multi-task execution, thereby improving the efficiency and performance of the software.
[0096] It should be noted that for the method embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art should know that the embodiments of the present invention are not limited by the described action sequences, because according to the embodiments of the present invention, certain steps can be carried out in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily essential for the embodiments of the present invention.
[0097] The business execution method provided by the embodiments of the present invention includes: obtaining the first memory number m required by each thread in the business to be executed; comparing the first memory number m with the pre-set core memory number n and the pre-set maximum memory number respectively; if the first memory number m is greater than the pre-set core memory number n and less than or equal to the pre-set maximum memory number, determining the core memory corresponding to the pre-set core memory number n and m - n extended memories, where m and n are natural numbers greater than 0; executing each thread in the business to be executed through the core memory and the extended memories. By managing the memory occupied by the threads in each business, it avoids the problem that multiple threads frequently apply for memory, resulting in system lag of the client due to insufficient memory, and provides the stability of business execution.
[0098] Another embodiment of the present invention provides a business execution device for executing the business execution method provided by the above embodiments.
[0099] Referring to Figure 4 , a structural block diagram of an embodiment of a business execution device of the present invention is shown. The device may specifically include the following modules: an acquisition module 401, a comparison module 402, a memory application module 403, and an execution module 404, where:
[0100] The acquisition module 401 is used to obtain the first memory number m required by each thread in the business to be executed;
[0101] The comparison module 402 is used to compare the first memory number m with the pre-set core memory number n and the pre-set maximum memory number respectively;
[0102] The memory application module 403 is used to, if the first memory number m is greater than the pre-set core memory number n and less than or equal to the pre-set maximum memory number, determine the core memory corresponding to the pre-set core memory number n and m - n extended memories, where m and n are natural numbers greater than 0;
[0103] The execution module 404 is used to execute each thread in the business to be executed through the core memory and the extended memories.
[0104] The service execution device provided by the embodiment of the present invention obtains the first memory number m required by each thread in the service to be executed; compares the first memory number m with the pre-set core memory number n and the pre-set maximum memory number respectively; if the first memory number m is greater than the pre-set core memory number n and less than or equal to the pre-set maximum memory number, determines the core memory corresponding to the pre-set core memory number n and m - n extended memories, where m and n are natural numbers greater than 0; executes each thread in the service to be executed through the core memory and the extended memories, and manages the memory occupied by the threads in each service, avoiding the problem that multiple threads frequently apply for memory, resulting in system lag due to insufficient memory of the client, and providing the stability of service execution.
[0105] Another embodiment of the present invention further supplements the service execution device provided by the above embodiment.
[0106] Optionally, the device further includes a release module, and the release module is used for:
[0107] If the m - n extended memories are not occupied to execute the service to be executed within the preset waiting time, releases the m - n extended memories.
[0108] Optionally, the device further includes an occupation module, and the occupation module is used for:
[0109] Within the preset waiting time and when each thread in the service to be executed is completed, occupies the core memory and the extended memories corresponding to the first memory number to execute each thread of the new service.
[0110] Optionally, the memory application module is further used for:
[0111] If the first memory number m is greater than the pre-set maximum memory number max, determines the memory space corresponding to the pre-set maximum memory number max;
[0112] The execution module is further used for:
[0113] Sorts each thread in the task to be executed in a preset order to obtain a thread sequence, and executes the first max first threads in the order of the thread sequence through the memory space;
[0114] Stores the remaining m - max second threads in the thread sequence in a pre-established waiting queue, where max and m - max are natural numbers greater than 0, and m - max is less than or equal to the pre-set waiting queue length;
[0115] If the first thread is executed and completed, the second thread is executed by occupying the free memory space corresponding to the first thread.
[0116] Optionally, the execution module is further configured to:
[0117] If the number of the m-max second threads is greater than the preset waiting queue length a, a preset waiting queue policy is executed, where the waiting queue policy is to delete the first m-max-a threads in the waiting queue, or to delete the last m-max-a threads in the waiting queue, where a and m-max-a are natural numbers greater than 0.
[0118] Optionally, the memory application module is further configured to:
[0119] If the first memory number m is less than or equal to the preset core memory number n, the core memory corresponding to the first memory number m is determined to execute each thread in the to-be-executed service.
[0120] It should be noted that each implementable manner in this embodiment can be implemented separately, or can be implemented in any combination manner without conflict. The present application makes no limitation.
[0121] For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple. For related parts, refer to the partial description of the method embodiment.
[0122] The service execution device provided by the embodiment of the present invention obtains the first memory number m required by each thread in the to-be-executed service; compares the first memory number m with the preset core memory number n and the preset maximum memory number respectively; if the first memory number m is greater than the preset core memory number n and less than or equal to the preset maximum memory number, the core memory corresponding to the preset core memory number n and m-n extended memories are determined, where m and n are natural numbers greater than 0; each thread in the to-be-executed service is executed through the core memory and the extended memory, and by managing the memory occupied by the threads in each service, the problem that multiple threads frequently apply for memory, resulting in system lag of the client due to insufficient memory, is avoided, and the stability of service execution is provided.
[0123] Another embodiment of the present invention provides a terminal device for executing the service execution method provided in the above embodiment.
[0124] Figure 5 is a schematic structural diagram of a terminal device of the present invention, as Figure 5 shown, the terminal device includes: at least one processor 501 and a memory 502;
[0125] The memory stores a computer program; the at least one processor executes the computer program stored in the memory to implement the service execution method provided in the foregoing embodiments.
[0126] For the terminal device provided in this embodiment, by obtaining the first memory number m required by each thread in the service to be executed; comparing the first memory number m with the pre-set core memory number n and the pre-set maximum memory number respectively; if the first memory number m is greater than the pre-set core memory number n and the first memory number is less than or equal to the pre-set maximum memory number, then determine the core memory corresponding to the pre-set core memory number n and m - n extended memories, where m and n are natural numbers greater than 0; execute each thread in the service to be executed through the core memory and the extended memories, and manage the memory occupied by the threads in each service, avoiding the problem that multiple threads frequently apply for memory, resulting in system lag on the client side due to insufficient memory, and providing the stability of service execution.
[0127] Another embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed, it implements the service execution method provided in any one of the foregoing embodiments.
[0128] For the computer-readable storage medium according to this embodiment, by obtaining the first memory number m required by each thread in the service to be executed; comparing the first memory number m with the pre-set core memory number n and the pre-set maximum memory number respectively; if the first memory number m is greater than the pre-set core memory number n and the first memory number is less than or equal to the pre-set maximum memory number, then determine the core memory corresponding to the pre-set core memory number n and m - n extended memories, where m and n are natural numbers greater than 0; execute each thread in the service to be executed through the core memory and the extended memories, and manage the memory occupied by the threads in each service, avoiding the problem that multiple threads frequently apply for memory, resulting in system lag on the client side due to insufficient memory, and providing the stability of service execution.
[0129] Each embodiment in this specification is described in a progressive manner. The key point of each embodiment is the difference from other embodiments. The same or similar parts among the embodiments can be referred to each other.
[0130] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, an apparatus, or a computer program product. Therefore, the embodiments of the present invention can take the form of an all-hardware embodiment, an all-software embodiment, or an embodiment combining software and hardware aspects. Moreover, the embodiments of the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memory, CD-ROM, optical memory, etc.) that contain computer-usable program code.
[0131] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of methods, electronic devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each flow and / or block in the flowchart and / or block diagram, as well as the combination of flows and / or blocks in the flowchart and / or block diagram, can be realized by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing electronic devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing electronic devices generate a device for realizing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0132] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing electronic devices to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufactured article including an instruction device, and the instruction device realizes the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0133] These computer program instructions can also be loaded onto a computer or other programmable data processing electronic devices, such that a series of operation steps are executed on the computer or other programmable electronic devices to generate a computer-implemented process, and thus the instructions executed on the computer or other programmable electronic devices provide steps for realizing the functions specified in Figure 1 one flow or multiple flows and / or blocks Figure 1 one block or multiple blocks.
[0134] Although the preferred embodiments of the embodiments of the present invention have been described, those skilled in the art can make additional changes and modifications once they learn the basic creative concepts. Therefore, the appended claims are intended to be construed to include the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present invention.
[0135] Finally, it should also be noted that in this text, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or electronic device comprising a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or electronic device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the existence of additional identical elements in the process, method, article or electronic device comprising the said element.
[0136] The above has introduced in detail a service execution method and a service execution device provided by the present invention. Specific examples are used in this text to elaborate on the principle and implementation manner of the present invention. The description of the above embodiments is only used to help understand the method and its core idea of the present invention; at the same time, for those of ordinary skill in the art, according to the idea of the present invention, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation to the present invention.
Claims
1. A service execution method, characterized in that, The method includes: Obtaining the first memory number m required by each thread in the business to be executed; Comparing the first memory number m with a pre-set core memory number n and a pre-set maximum memory number respectively; If the first memory number m is greater than the pre-set core memory number n and the first memory number is less than or equal to the pre-set maximum memory number, determining the core memory corresponding to the pre-set core memory number n and m - n extended memories, where m and n are natural numbers greater than 0; Executing each thread in the business to be executed through the core memory and the extended memories; The method further includes: If the first memory number m is greater than the pre-set maximum memory number max, determining the memory space corresponding to the pre-set maximum memory number max; Sorting each thread in the task to be executed in a preset order to obtain a thread sequence, and executing the first max first threads in the order of the thread sequence through the memory space; Storing the remaining m - max second threads in the thread sequence in a pre-established waiting queue, where max and m - max are natural numbers greater than 0, and m - max is less than or equal to the pre-set waiting queue length; If a first thread is executed, then occupying the idle memory space corresponding to the first thread to execute the second thread.
2. The method according to claim 1, wherein The method further includes: If the m - n extended memories are not occupied to execute the business to be executed within a preset waiting time, releasing the m - n extended memories.
3. The method according to claim 2, wherein The method further includes: Within a preset waiting time and when each thread in the business to be executed is completed, occupying the core memory and the extended memories corresponding to the first memory number to execute each thread of the new business.
4. The method according to claim 1, characterized in that, The method further includes: If the number of the m - max second threads is greater than the pre-set waiting queue length a, executing a pre-set waiting queue policy, where the waiting queue policy is to delete the first m - max - a threads in the waiting queue or delete the last m - max - a threads in the waiting queue, where a and m - max - a are natural numbers greater than 0.
5. The method according to claim 1, wherein The method further includes: If the first memory number m is less than or equal to the pre-set core memory number n, determining the core memory corresponding to the first memory number m to execute each thread in the business to be executed.
6. A service execution device, characterized in that, The device includes: An obtaining module, configured to obtain the first memory number m required by each thread in the business to be executed; A comparing module, configured to compare the first memory number m with a pre-set core memory number n and a pre-set maximum memory number respectively; A memory application module, configured to, if the first memory number m is greater than the pre-set core memory number n and the first memory number is less than or equal to the pre-set maximum memory number, determine the core memory corresponding to the pre-set core memory number n and m - n extended memories, where m and n are natural numbers greater than 0; An execution module, configured to execute each thread in the to-be-executed service through the core memory and the extended memory; The application memory module is further configured to: If the first memory number m is greater than the preset maximum memory number max, sort each thread in the to-be-executed task in a preset order to obtain a thread sequence, and execute the first max first threads in the order of the thread sequence; Store the remaining m - max second threads in the thread sequence in a pre-established waiting queue, where max and m - max are natural numbers greater than 0, and m - max is less than or equal to the preset length of the waiting queue; If a first thread is executed, then occupy the idle thread corresponding to the first thread to execute the second thread.
7. A terminal device, characterized in that, Comprising: At least one processor and a memory; The memory stores a computer program; The at least one processor executes the computer program stored in the memory to implement the service execution method according to any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, A computer-readable storage medium stores a computer program, and when the computer program is executed, it implements the service execution method according to any one of claims 1-5.
Citation Information
Patent Citations
Memory pool management method, device, apparatus, and readable storage medium
CN109388497A
Memory allocation method and device, computer equipment and storage medium
CN111324461A