Cross-array task scheduling method and device and related equipment

By utilizing the mutex mechanism in the cross-array system, the efficient execution of cross-array task scheduling is solved, and the problems of high system complexity and low efficiency caused by the introduction of third-party tools are improved, and the flexibility and efficiency of task scheduling are improved.

CN120256153APending Publication Date: 2025-07-04SUGON INFORMATION IND +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510281599.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-10
Publication Date
2025-07-04

AI Technical Summary

Technical Problem

The introduction of third-party tools into the existing cross-array task scheduling method leads to problems of high system complexity and low efficiency.

Method used

By sending mutex addition instructions to the second array after the first array is successfully added, the second array is made to add mutex and lock the target resources, and send task execution instructions after executing the task, cross-array task scheduling is realized.

Benefits of technology

Without introducing third-party tools, the system complexity is reduced, task scheduling efficiency is improved, and deadlocks and resource conflicts are avoided.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120256153A_ABST
    Figure CN120256153A_ABST
Patent Text Reader

Abstract

The invention relates to a cross-array task scheduling method, a cross-array task scheduling device and related equipment, which are used for realizing cross-array task scheduling on the premise of not introducing a third-party tool, reducing the complexity of a system and improving the efficiency of the cross-array task scheduling. Comprising the steps that in response to a service instruction sent by a user, a mutual exclusion lock is added to a first array, the service instruction comprises a first target service to be executed by the first array, a second array and target resources, and the target resources are resources needed in the second array when a first target task is executed; if the mutual exclusion lock is successfully added to the first array, a mutual exclusion lock adding instruction is sent to the second array, so that after the second array receives the mutual exclusion lock adding instruction, the mutual exclusion lock is added to the second array, and the target resource is locked; and after an instruction that the mutual exclusion lock is successfully increased sent by the second array is received, executing the first target service, and sending a task execution instruction to the second array, so that the second array executes the first target service by using the target resource.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing, and in particular, to a task scheduling method, device, and related equipment across arrays. Background Art

[0002] In a cross-array system, when multiple controllers access shared resources simultaneously, to avoid data inconsistency or concurrent conflict issues, it is necessary to ensure that only one controller node can acquire the lock and execute the critical code block at the same time. Other controller nodes need to wait or give up execution. The main goal is to ensure mutual exclusion and consistency among multiple controllers. It can be used in scenarios such as controlling access to shared resources, avoiding race conditions, and implementing distributed transactions.

[0003] Common lock implementation methods in cross-array task scheduling include those based on databases, file systems, memory, and message queues, etc. In currently commonly used technical solutions, whether it is based on databases, file systems, memory, or message queue solutions, the idea of introducing third-party tools is adopted to implement. However, introducing third-party tools will increase the complexity of the system and result in low efficiency of cross-array task scheduling. Summary of the Invention

[0004] The present invention provides a cross-array task scheduling method, which realizes cross-array task scheduling without introducing third-party tools, reduces the complexity of the system, and improves the efficiency of cross-array task scheduling.

[0005] In a first aspect, the present application provides a cross-array task scheduling method, which is applied to a first array. The method includes:

[0006] In response to a service instruction sent by a user, add a mutex lock to the first array, where the service instruction includes a first target service to be executed by the first array, a second array, and a target resource, and the target resource is the resource required in the second array when executing the first target task;

[0007] If the mutex lock is successfully added to the first array, send a mutex lock addition instruction to the second array, so that after the second array receives the mutex lock addition instruction, add a mutex lock to the second array and lock the target resource;

[0008] After receiving the instruction that the mutex lock addition to the second array is successful, after executing the first target service, send a task execution instruction to the second array, so that the second array uses the target resource to execute the first target service.

[0009] In the above method, after successfully adding a mutex lock to the first array, a mutex lock addition instruction is sent to the second array. After the second array receives the mutex lock addition instruction, the mutex lock of the second array is increased and the target resource is locked. After receiving the instruction indicating that the mutex lock addition to the second array is successful, after executing the first target service, a task execution instruction is sent to the second array so that the second array can execute the first target service using the target resource. Thus, in the embodiment of the present application, a third-party tool is not required to implement the task scheduling process, reducing the complexity and improving the efficiency of task scheduling.

[0010] In a possible implementation manner, after the second array executes the first target service using the target resource, the method further includes:

[0011] Releasing the mutex lock in the first array.

[0012] In the above method, after executing the first target service, the mutex lock in the first array is released. This facilitates the normal execution of subsequent services and improves the efficiency of service scheduling.

[0013] In a possible implementation manner, the method further includes:

[0014] If the addition of the mutex lock to the first array fails, end, or,

[0015] If an instruction indicating that the addition of the mutex lock to the second array fails is received, release the mutex lock in the first array.

[0016] In the above method, if the addition of the mutex lock fails for one of the arrays in the dual-end array, the target service is not continued to be executed. This saves computing resources.

[0017] In a possible implementation manner, adding the mutex lock to the first array includes:

[0018] Using the pre-set correspondence between services and mutex services, determining the target mutex service corresponding to the first target service;

[0019] Using the first target service and the target mutex service to obtain a mutex lock and adding the mutex lock to the first array.

[0020] In the above method, using the pre-set correspondence between services and mutex services, determining the target mutex service corresponding to the first target service, using the first target service and the target mutex service to obtain a mutex lock, and adding the mutex lock to the first array. Thus, the flexibility and scalability of mutex operations in the task scheduling process are improved.

[0021] In a possible implementation manner, the method further includes:

[0022] When a mutex increment instruction is sent to the second array and the mutex increment instruction sent by the second array is received, it is determined whether the priorities of the first target service and the second target service are the same, where the second target service is the service in the received mutex increment instruction;

[0023] If they are not the same and the priority of the first target service is greater than the priority of the second target service, continue to execute the mutex increment instruction sent to the second array;

[0024] Otherwise, withdraw the mutex increment instruction and release the mutex in the first array.

[0025] The above method determines which service to execute through the arrangement of the priorities of the services, avoiding the problem of simultaneous operation failure of the dual - end arrays and the problem of deadlock when performing the same type of service operations on the dual - end arrays simultaneously.

[0026] In a second aspect, the present application provides a task scheduling method for cross - array remote replication, which is applied to the second array. The method includes:

[0027] Receive a mutex increment instruction sent by the first array and add a mutex to the second array, where the mutex increment instruction is sent after the first array successfully adds a mutex;

[0028] If the mutex is successfully added to the second array, lock the target resource, where the target resource is obtained based on the mutex increment instruction;

[0029] Send an instruction indicating that the mutex addition is successful to the first array so that the first array can execute the first target service; where the first target service is obtained based on the mutex increment instruction;

[0030] Receive the service execution instruction sent by the first array and execute the first target service using the target resource.

[0031] The above method receives a mutex increment instruction sent by the first array, adds a mutex to the second array. If the mutex is successfully added to the second array, lock the target resource; send an instruction indicating that the mutex addition is successful to the first array so that the first array can execute the first target service; receive the service execution instruction sent by the first array and execute the first target service using the target resource. Thus, in the process of task scheduling in the embodiments of the present application, a third - party tool is not required for implementation, reducing the complexity and improving the efficiency of task scheduling.

[0032] In a possible implementation manner, the method further includes:

[0033] If the addition of a mutex lock to the second array fails, an instruction indicating the failure of mutex lock addition is sent to the first array, so that the first array releases the mutex lock in the first array.

[0034] In the above method, if the addition of a mutex lock to the second array fails, an instruction indicating the failure of mutex lock addition is sent to the first array, so that the first array releases the mutex lock in the first array. Thus, it ensures that subsequent services can be executed normally.

[0035] In a possible implementation manner, after locking the target resource, the method further includes:

[0036] Releasing the mutex lock in the second array.

[0037] In the above method, since the second array pre-occupies the target resource, it will cause the request of the next service expecting to occupy the target resource to fail. Therefore, in the embodiments of the present application, releasing the mutex lock in advance can release the thread in advance and does not affect the continued execution of other services. It improves the efficiency of task scheduling.

[0038] In a possible implementation manner, the method further includes:

[0039] When sending a mutex lock addition instruction to the first array, if the mutex lock addition instruction sent by the first array is received, it is determined whether the priorities of the first target service and the second target service are the same, where the second target service is the service in the sent mutex lock addition instruction;

[0040] If they are not the same and the priority of the second target service is greater than the priority of the first target service, continue to execute the instruction of sending a mutex lock addition to the first array;

[0041] Otherwise, withdraw the mutex lock addition instruction and release the mutex lock in the second array.

[0042] In the above method, by arranging the priorities of services to determine which service to execute, it avoids the problem of simultaneous operation failures of both-end arrays and the problem of deadlocks when performing the same type of service operations on both-end arrays simultaneously.

[0043] In a third aspect, the present application provides a cross-array task scheduling device, which is applied to the first array. The device includes:

[0044] A first mutex lock addition module, configured to add a mutex lock to the first array in response to a service instruction sent by a user, where the service instruction includes a first target service to be executed by the first array, a second array, and a target resource, and the target resource is the resource required in the second array when executing the first target task;

[0045] The first instruction sending module is configured to, if a mutex lock is successfully added to the first array, send a mutex lock addition instruction to the second array, so that after the second array receives the mutex lock addition instruction, add a mutex lock to the second array and lock the target resource;

[0046] The first service execution module is configured to, after receiving the instruction indicating successful addition of the mutex lock sent by the second array, execute the first target service and then send a task execution instruction to the second array, so that the second array executes the first target service using the target resource.

[0047] In a possible implementation manner, the device further includes:

[0048] The first lock release module is configured to release the mutex lock in the first array after the second array executes the first target service using the target resource.

[0049] In a possible implementation manner, the device further includes:

[0050] The lock addition module is configured to, if the addition of the mutex lock to the first array fails, end, or,

[0051] The first lock release module is further configured to, if receiving the instruction indicating failure of adding the mutex lock sent by the second array, release the mutex lock in the first array.

[0052] In a possible implementation manner, the lock addition module is further configured to:

[0053] Determine a target mutex service corresponding to the first target service by using a pre-set correspondence between services and mutex services;

[0054] Obtain a mutex lock by using the first target service and the target mutex service, and add the mutex lock to the first array.

[0055] In a possible implementation manner, the device further includes:

[0056] The first judgment module is configured to, if receiving the mutex lock addition instruction sent by the second array when sending the mutex lock addition instruction to the second array, judge whether the priorities of the first target service and the second target service are the same, where the second target service is the service in the received mutex lock addition instruction;

[0057] The first sending module is configured to, if they are not the same and the priority of the first target service is greater than the priority of the second target service, continue to execute sending the mutex lock addition instruction to the second array;

[0058] The first withdrawal module is used to, otherwise, withdraw the mutex increment instruction and release the mutex in the first array.

[0059] In a fourth aspect, the present application provides a cross-array task scheduling device, which is applied to a second array. The device includes:

[0060] The second mutex increment module is used to receive the mutex increment instruction sent by the first array and increment the mutex for the second array, where the mutex increment instruction is sent after the first array successfully increments the mutex;

[0061] The resource locking module is used to lock the target resource if the mutex for the second array is successfully incremented, where the target resource is obtained based on the mutex increment instruction;

[0062] The second specified sending module is used to send the instruction indicating successful mutex increment to the first array so that the first array can execute the first target service; where the first target service is obtained based on the mutex increment instruction;

[0063] The second service execution module is used to receive the service execution instruction sent by the first array and execute the first target service using the target resource.

[0064] In a possible implementation, the device further includes:

[0065] The failure instruction sending module is used to send an instruction indicating failure of mutex increment to the first array if the mutex increment for the second array fails, so that the first array can release the mutex in the first array.

[0066] In a possible implementation, the device further includes:

[0067] The second lock release module is used to release the mutex in the second array after locking the target resource.

[0068] In a possible implementation, the device further includes:

[0069] The second judgment module is used to judge whether the priorities of the first target service and the second target service are the same if the mutex increment instruction sent by the first array is received when sending the mutex increment instruction to the first array, where the second target service is the service in the sent mutex increment instruction;

[0070] The second sending module is used to continue to execute sending the mutex increment instruction to the first array if they are different and the priority of the second target service is greater than the priority of the first target service;

[0071] A second withdrawal module, configured to otherwise withdraw the mutex increment instruction and release the mutex in the second array.

[0072] In a fifth aspect, an embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps in the above cross-array task scheduling method are implemented.

[0073] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, the steps in the above cross-array task scheduling method of the present application are implemented.

[0074] In a seventh aspect, an embodiment of the present application provides a computer program product, including a computer program stored in a computer-readable storage medium. When a processor of a memory access device reads the computer program from the computer-readable storage medium, the processor executes the computer program, causing the memory access device to execute the steps in the above cross-array task scheduling method of the present application.

[0075] For the various aspects in the above second to seventh aspects and the possible technical effects that each aspect may achieve, please refer to the description of the possible technical effects that can be achieved by the various possible solutions in the first aspect above, and details will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0076] To more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0077] Figure 1 It is a schematic diagram of an application scenario provided by an embodiment of the present application;

[0078] Figure 2 It is one of the flowcharts of a cross-array task scheduling method provided by an embodiment of the present application;

[0079] Figure 3 It is a flowchart of task scheduling when business operations are simultaneously performed on a dual-end array provided by an embodiment of the present application;

[0080] Figure 4 It is the second flowchart of the cross-array task scheduling method provided by an embodiment of the present application;

[0081] Figure 5One of the schematic diagrams of a cross-array task scheduling device provided by an embodiment of the present application;

[0082] Figure 6 Another schematic diagram of a cross-array task scheduling device provided by an embodiment of the present application;

[0083] Figure 7 Schematic diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners

[0084] In order to make the objectives, technical solutions, and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings. The specific operation methods in the method embodiments can also be applied to the device embodiments or system embodiments.

[0085] In the description of the present application, "a plurality of" is understood as "at least two". "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone. The connection between A and B may represent: the direct connection between A and B and the connection between A and B through C. In addition, in the description of the present application, terms such as "first" and "second" are only used for the purpose of distinguishing descriptions, and cannot be understood as indicating or implying relative importance, nor can they be understood as indicating or implying order.

[0086] Common lock implementation methods in cross-array task scheduling include those based on databases, file systems, memory, and message queues, etc. In the currently commonly used technical solutions, whether it is based on databases, file systems, memory, or message queue solutions, the idea of introducing third-party tools is adopted for implementation. However, introducing third-party tools will increase the complexity of the system and result in low efficiency of cross-array task scheduling.

[0087] In response to this, an embodiment of the present application provides a cross-array task scheduling method. When a mutex lock is successfully added to the first array, a mutex lock addition instruction is sent to the second array. After the second array receives the mutex lock addition instruction, the mutex lock is added to the second array, and the target resource is locked. After receiving the instruction indicating the successful addition of the mutex lock sent by the second array, after executing the first target service, a task execution instruction is sent to the second array, so that the second array uses the target resource to execute the first target service. Thus, in the process of task scheduling in the embodiment of the present application, there is no need for a third-party tool to implement, reducing the complexity and improving the efficiency of task scheduling.

[0088] As Figure 1 shown, an application scenario of a cross-array task scheduling method, which includes a first array 110 and a second array 120 in this application scenario.

[0089] In a possible application scenario, the first array 110 adds a mutex lock in response to a service instruction sent by a user. The service instruction includes a first target service to be executed by the first array 110, a second array 120, and a target resource, where the target resource is a resource required in the second array 120 when executing the first target task. If the mutex lock is successfully added to the first array 110, a mutex lock addition instruction is sent to the second array 120 to add a mutex lock to the second array 120. If the mutex lock is successfully added to the second array 120, the target resource is locked. An instruction indicating successful addition of the mutex lock is sent to the first array 110. After receiving the instruction indicating successful addition of the mutex lock sent by the second array 120, the first array 110 executes the first target service and then sends a task execution instruction to the second array 120 so that the second array 120 uses the target resource to execute the first target service.

[0090] Wherein, Figure 1 Information interaction can be performed between the first array 110 and the second array 120 through a communication network. The communication mode adopted by the communication network can be divided into a wireless communication mode or a wired communication mode.

[0091] Exemplarily, the first array 110 can access the network through cellular mobile communication technology and communicate with the second array 120. The cellular mobile communication technology, for example, includes the fifth-generation mobile communication (5th Generation Mobile Networks, 5G) technology.

[0092] Optionally, the first array 110 can access the network through a short-range wireless communication mode and communicate with the second array 120. The short-range wireless communication mode, for example, includes Wireless Fidelity (Wi-Fi) technology.

[0093] In the description of the present application, only a single first array 110 and a single second array 120 are described in detail. However, those skilled in the art should understand that the shown first array 110 and second array 120 are intended to represent the operations of the first array 110 and second array 120 involved in the technical solution of the present application. It does not imply any limitation on the number, type, or location of the first array 110 and the second array 120. It should be noted that if additional modules are added to or individual modules are removed from the illustrated environment, the underlying concept of the exemplary embodiments of the present application will not be changed.

[0094] It should be noted that the cross-array task scheduling method proposed in the present application is not only applicable to Figure 1 the shown application scenario, but also applicable to any cross-array task scheduling device.

[0095] Next, in combination with the above-described application scenarios, the cross-array task scheduling method of exemplary embodiments of the present application will be described with reference to the accompanying drawings. It should be noted that the above application scenarios are only shown for the convenience of understanding the method and principle of the present application, and the embodiments of the present application are not limited in this regard.

[0096] The present application will be further described in detail below with reference to the accompanying drawings. Refer to Figure 2 As shown, it is a schematic flowchart of a cross-array task scheduling method provided by an embodiment of the present application. The specific implementation process of this method is as follows:

[0097] Step 201: In response to a service instruction sent by a user, the first array adds a mutex lock to the first array. Among them, the service instruction includes a first target service to be executed by the first array, a second array, and a target resource, and the target resource is a resource required in the second array when executing the first target task;

[0098] In a possible implementation manner, the mutex lock is added to the first array in the following manner:

[0099] Using the pre-set correspondence between services and mutually exclusive services, determine the target mutually exclusive service corresponding to the first target service; use the first target service and the target mutually exclusive service to obtain a mutex lock, and add the mutex lock to the first array. Among them, Table 1 shows the correspondence between services and mutually exclusive services:

[0100]

[0101]

[0102] Table 1

[0103] For example, as shown in Table 1, if the first target service is Service 1, then the mutually exclusive service corresponding to the first target service is determined to be Service a.

[0104] It should be noted that: in the embodiments of the present application, there is a correspondence between the services and mutually exclusive services in Table 1, but in the embodiments of the present application, the number of mutually exclusive services corresponding to each service is not limited. The number of mutually exclusive services corresponding to each service in the embodiments of the present application can be limited according to specific actual situations.

[0105] Step 202: If the mutex lock is successfully added to the first array, the first array sends a mutex lock addition instruction to the second array;

[0106] The mutex lock addition instruction in the embodiments of the present application includes a target resource, a first target service, and / or a target mutually exclusive service corresponding to the first target service.

[0107] The first target service in the embodiments of the present application can be operations such as creation, modification, deletion, etc. The embodiments of the present application do not limit the first target service herein, and the first target service in the embodiments of the present application can be defined according to specific actual situations. The target resources in the embodiments of the present application can be data, locations, etc. The target resources in the embodiments of the present application can be set according to specific actual situations, and the embodiments of the present application do not limit the target resources herein.

[0108] In a possible implementation manner, if the mutex addition of the first array fails, the process ends.

[0109] Step 203: The second array receives the mutex addition instruction sent by the first array and adds a mutex to the second array;

[0110] In a possible implementation manner, before adding a mutex to the second array, it is determined whether the mutex addition instruction includes a target mutex service; if it includes, the second array is added a mutex using the first target service and the target mutex; if it does not include, the corresponding target mutex service corresponding to the first target service is determined using the pre-set correspondence between services and mutex services; and the second array is added a mutex using the first target service and the target mutex.

[0111] Step 204: If the mutex is successfully added to the second array, the second array locks the target resources;

[0112] In a possible implementation manner, if the addition of the mutex to the second array fails, an instruction indicating the failure of mutex addition is sent to the first array so that the first array releases the mutex in the first array.

[0113] In order not to affect the continued execution of other services, in a possible implementation manner, after the second array executes Step 204, the mutex in the second array is released.

[0114] Step 205: The second array sends an instruction indicating successful mutex addition to the first array;

[0115] Step 206: When the first array receives the instruction indicating successful mutex addition sent by the second array, the first target service is executed;

[0116] In a possible implementation manner, if an instruction indicating the failure of mutex addition sent by the second array is received, the mutex in the first array is released.

[0117] Step 207: The first array sends a task execution instruction to the second array;

[0118] Step 208: The second array receives the service execution instruction sent by the first array, and executes the first target service by using the target resource.

[0119] In a possible implementation manner, after executing step 208, the first array releases the mutex lock in the first array.

[0120] In the embodiment of the present application, after the second array executes the first target service, an instruction indicating that the task has been completed is sent to the first array. When the first array receives the instruction indicating that the task has been completed, the first array releases the mutex lock in the first array.

[0121] To avoid the problem of deadlock when performing the same type of service operations on the dual-end array at the same time, and to avoid the problem of simultaneous operation failure of the dual-end array. As Figure 3 shown, it is a schematic flowchart of task scheduling when the dual-end array performs service operations simultaneously, which may specifically include the following steps:

[0122] Step 301: If the first array sends a mutex lock increment instruction to the second array and receives the mutex lock increment instruction sent by the second array, it determines whether the priorities of the first target service and the second target service are the same, where the second target service is the service in the received mutex lock increment instruction; if not, step 302 is executed, and if so, step 304 is executed;

[0123] In the embodiment of the present application, step 301 describes that when the first array and the second array at both ends simultaneously receive the mutex increment instructions sent by the opposite end, the priorities of the corresponding services in the two instructions will be judged first.

[0124] Step 302: The first array determines whether the priority of the first target service is greater than the priority of the second target service; if so, step 303 is executed, and if not, step 304 is executed;

[0125] In a possible implementation manner, the priorities corresponding to each service are determined by the following method:

[0126] Using the pre-set corresponding relationship between each service and each priority, the priority corresponding to each service is determined.

[0127] Step 303: The first array continues to execute the operation of sending a mutex lock increment instruction to the second array;

[0128] In an embodiment of the present application, if the priority of the first target service is higher than that of the second target service, the first array continues to execute the instruction to increase the mutex lock and send it to the second array. At this time, the second array will withdraw the instruction to increase the mutex lock and release the mutex lock in the second array. The mutex lock at this time is the local lock added by the second array. Then, the service required in the first array will be executed.

[0129] In an embodiment of the present application, if the priority of the second target service is higher than that of the first target service, the second array continues to execute the instruction to increase the mutex lock and send it to the second array. At this time, the first array will withdraw the instruction to increase the mutex lock and release the mutex lock in the first array. The mutex lock at this time is the local lock added by the first array. Then, the service required in the second array will be executed.

[0130] That is, when the same type of instructions are sent simultaneously at both ends of the array, the service with a higher priority is executed first.

[0131] Step 304: The first array withdraws the instruction to increase the mutex lock and releases the mutex lock in the first array;

[0132] Step 305: The second array determines whether the priorities of the first target service and the second target service are the same. If not, step 306 is executed; if so, step 308 is executed.

[0133] It should be noted that: In an embodiment of the present application, step 305 and the step in step 301 where the first array determines whether the priorities of the first target service and the second target service are the same are executed simultaneously.

[0134] Step 306: Determine whether the priority of the second target service is higher than that of the first target service. If so, step 307 is executed; if not, step 308 is executed.

[0135] In an embodiment of the present application, step 306 and step 302 are executed simultaneously.

[0136] Step 307: Continue to execute the instruction to increase the mutex lock and send it to the first array;

[0137] Step 308: Withdraw the instruction to increase the mutex lock and release the mutex lock in the second array.

[0138] In an embodiment of the present application, if the priorities of the services in the mutex lock increase instructions sent simultaneously by both arrays are the same, the first array withdraws the instruction to increase the mutex lock and releases the mutex lock in the first array; and the second array withdraws the instruction to increase the mutex lock and releases the mutex lock in the second array. Therefore, the problem of deadlock is avoided.

[0139] It should be noted that: The priorities among the various services in the embodiments of the present application are preset. However, the embodiments of the present application do not limit the priorities among the various services herein. The priorities among the various services in the embodiments of the present application can be set according to specific actual situations.

[0140] Next, in combination with Figure 4 The task scheduling method across arrays in the embodiments of the present application will be described. Specifically, it may include the following steps:

[0141] Step 401: In response to a service instruction sent by a user, the first array adds a mutex lock to the first array. Among them, the service instruction includes a first target service to be executed by the first array, a second array, and a target resource, and the target resource is the resource required in the second array when executing the first target task;

[0142] Step 402: The first array determines whether the mutex lock is successfully added. If so, step 403 is executed; if not, it ends;

[0143] Step 403: The first array sends a mutex lock addition instruction to the second array;

[0144] Step 404: After receiving the mutex lock addition instruction sent by the first array, the second array adds a mutex lock to the second array;

[0145] Step 405: The second array determines whether the mutex lock is successfully added to the second array. If so, step 406 is executed; if not, step 412 is executed;

[0146] Step 406: After the second array locks the target resource, it releases the mutex lock in the second array;

[0147] Step 407: The second array sends an instruction indicating that the mutex lock addition is successful to the first array;

[0148] Step 408: When the first array receives the instruction indicating that the mutex lock addition is successful sent by the second array, it executes the first target service;

[0149] Step 409: The first array sends a task execution instruction to the second array;

[0150] Step 410: The second array receives the service execution instruction sent by the first array and executes the first target service by using the target resource;

[0151] Step 411: The first array releases the mutex lock in the first array;

[0152] Step 412: The second array sends an instruction indicating that the mutex lock addition fails to the first array;

[0153] Step 413: If the first array receives an instruction indicating that the mutex lock increment in the second array fails, release the mutex lock in the first array.

[0154] Based on the same inventive concept, the present application also provides a task scheduling device 500 for cross-array remote replication, which is applied to the first array. As Figure 5 shown, the device includes:

[0155] A first mutex lock increment module 501, configured to increment a mutex lock for the first array in response to a service instruction sent by a user, where the service instruction includes a first target service to be executed by the first array, a second array, and a target resource, and the target resource is a resource required in the second array when executing the first target task;

[0156] A first instruction sending module 502, configured to, if the mutex lock for the first array is successfully incremented, send a mutex lock increment instruction to the second array, so that after the second array receives the mutex lock increment instruction, increment the mutex lock for the second array and lock the target resource;

[0157] A first service execution module 503, configured to, after receiving an instruction indicating that the mutex lock increment in the second array is successful, execute the first target service and then send a task execution instruction to the second array, so that the second array uses the target resource to execute the first target service.

[0158] In a possible implementation, the device further includes:

[0159] A first lock release module 504, configured to release the mutex lock in the first array after executing the first target service.

[0160] In a possible implementation, the device further includes:

[0161] A lock increment module 505, configured to end if the mutex lock increment in the first array fails, or

[0162] The first lock release module 504 is further configured to release the mutex lock in the first array if it receives an instruction indicating that the mutex lock increment in the second array fails.

[0163] In a possible implementation, the lock increment module 505 is further configured to:

[0164] Determine a target mutex service corresponding to the first target service by using a pre-set correspondence between services and mutex services;

[0165] Obtain a mutex lock by using the first target service and the target mutually exclusive service, and add the mutex lock to the first array.

[0166] In a possible implementation manner, the device further includes:

[0167] A first determination module 506, configured to determine whether the priorities of the first target service and the second target service are the same if a mutex lock addition instruction is received when sending a mutex lock addition instruction to the second array, where the second target service is the service in the received mutex lock addition instruction;

[0168] A sending module 507, configured to, if they are not the same and the priority of the first target service is greater than the priority of the second target service, continue to execute the operation of sending a mutex lock addition instruction to the second array;

[0169] A withdrawal module 508, configured to otherwise, withdraw the mutex lock addition instruction and release the mutex lock in the first array.

[0170] Based on the same inventive concept, the present application further provides a task scheduling device 600 for cross-array remote replication, which is applied to the first array, as Figure 6 shown, the device includes:

[0171] A second mutex lock addition module 601, configured to receive a mutex lock addition instruction sent by the first array and add a mutex lock to the second array, where the mutex lock addition instruction is sent after the first array successfully adds a mutex lock;

[0172] A resource locking module 602, configured to lock a target resource if the mutex lock is successfully added to the second array, where the target resource is obtained based on the mutex lock addition instruction;

[0173] A second specified sending module 603, configured to send an instruction indicating that the mutex lock addition is successful to the first array, so that the first array can execute the first target service; where the first target service is obtained based on the mutex lock addition instruction;

[0174] A second service execution module 604, configured to receive a service execution instruction sent by the first array and execute the first target service by using the target resource.

[0175] In a possible implementation manner, the device further includes:

[0176] A failure instruction sending module 605, configured to, if the addition of the mutex lock to the second array fails, send an instruction indicating that the mutex lock addition fails to the first array, so that the first array can release the mutex lock in the first array.

[0177] In a possible implementation, the apparatus further includes:

[0178] A second lock release module 606, configured to release the mutex lock in the second array after executing the first target service by using the target resource.

[0179] In a possible implementation, the apparatus further includes:

[0180] A second determination module 607, configured to determine whether the priorities of the first target service and the second target service are the same if a mutex lock increment instruction is received when sending a mutex lock increment instruction to the first array, where the second target service is the service in the sent mutex lock increment instruction;

[0181] A second sending module 608, configured to continue to execute sending a mutex lock increment instruction to the first array if they are different and the priority of the second target service is greater than the priority of the first target service;

[0182] A second withdrawal module 609, configured to otherwise withdraw the mutex lock increment instruction and release the mutex lock in the second array.

[0183] Based on the same inventive concept, an electronic device is further provided in an embodiment of the present application. The electronic device can implement the functions of the foregoing cross-array task scheduling apparatus. Refer to Figure 7 , the electronic device includes:

[0184] At least one processor 701, and a memory 702 connected to at least one processor 701. In the embodiment of the present application, the specific connection medium between the processor 701 and the memory 702 is not limited. Figure 7 In is taken as an example that the processor 701 and the memory 702 are connected through a bus 700. The bus 700 is Figure 7 represented by a thick line in. The connection manners between other components are only for illustrative purposes and are not limited thereto. The bus 700 can be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation, Figure 7 only a thick line is used to represent it in, but it does not mean that there is only one bus or one type of bus. Alternatively, the processor 701 can also be referred to as a controller, and the name is not limited.

[0185] In the embodiment of the present application, the memory 702 stores instructions executable by at least one processor 701. At least one processor 701 can execute the cross-array task scheduling method described above by executing the instructions stored in the memory 702. The processor 701 can implement Figure 5 and / orFigure 6 The functions of each module in the device shown

[0186] Among them, the processor 701 is the control center of the device. It can connect various parts of the entire control device through various interfaces and circuits. By running or executing instructions stored in the memory 702 and calling data stored in the memory 702, various functions of the device and data processing are performed, thereby overall monitoring the device.

[0187] In a possible design, the processor 701 may include one or more processing units. The processor 701 may integrate an application processor and a modem processor. Among them, the application processor mainly processes the operating system, user interface, application programs, etc., and the modem processor mainly processes wireless communication. It can be understood that the above modem processor may not be integrated into the processor 701 either. In some embodiments, the processor 701 and the memory 702 may be implemented on the same chip, and in some embodiments, they may also be separately implemented on independent chips.

[0188] The processor 701 may be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application-specific integrated circuit, a field-programmable gate array, or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, which can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the task scheduling method across arrays disclosed in the embodiments of the present application in combination can be directly embodied as being executed by a hardware processor, or executed by a combination of hardware and software modules in the processor.

[0189] The memory 702, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. The memory 702 can include at least one type of storage medium. For example, it can include flash memory, hard disks, multimedia cards, card-type memories, random access memory (RAM), static random access memory (SRAM), programmable read-only memory (PROM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), magnetic memories, magnetic disks, optical disks, and so on. The memory 702 is any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 702 in the embodiments of the present application can also be a circuit or any other device capable of implementing a storage function, for storing program instructions and / or data.

[0190] By designing and programming the processor 701, the code corresponding to the cross-array task scheduling method introduced in the foregoing embodiments can be solidified into the chip, so that the chip can execute Figure 2 the steps of the cross-array task scheduling method of the illustrated embodiments. How to design and program the processor 701 is a well-known technology to those skilled in the art and will not be elaborated here.

[0191] The embodiments of the present application also provide a computer-readable storage medium, storing computer-executable instructions required to be executed by the foregoing processor, which includes a program for executing the operations required to be executed by the foregoing processor.

[0192] In some possible implementation manners, various aspects of the cross-array task scheduling method provided in the present application can also be implemented in the form of a program product, which includes program code. When the program product runs on an electronic device, the program code is used to cause the electronic device to execute the steps in the cross-array task scheduling method according to various exemplary embodiments of the present application described above in this specification.

[0193] Those skilled in the art should understand that the embodiments of the present application can be provided as methods, devices, or computer program products. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0194] The present application is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (devices), and computer program products according to the embodiments of the present application. 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 implemented 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 devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing devices generate a device for implementing the functions specified in Figure 1 one or more of the processes or multiple processes and / or blocks Figure 1 one or more of the blocks or multiple blocks.

[0195] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufactured article including an instruction device that implements the functions specified in Figure 1 one or more of the processes or multiple processes and / or blocks Figure 1 one or more of the blocks or multiple blocks.

[0196] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process, so that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in Figure 1 one or more of the processes or multiple processes and / or blocks Figure 1 one or more of the blocks or multiple blocks.

[0197] Although the preferred embodiments of the present application 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 that fall within the scope of the present application.

[0198] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Thus, if these modifications and variations of this application fall within the scope of the claims of this application and their equivalent technologies, this application is also intended to include these modifications and variations.

Claims

1. A task scheduling method across arrays, characterized in that, Applied to the first array, the method includes: In response to a service instruction sent by a user, adding a mutex lock to the first array, where the service instruction includes a first target service to be executed by the first array, a second array, and a target resource, and the target resource is the resource required in the second array when executing the first target task; If the mutex lock is successfully added to the first array, sending a mutex lock addition instruction to the second array, so that after the second array receives the mutex lock addition instruction, adding a mutex lock to the second array and locking the target resource; After receiving the instruction indicating successful addition of the mutex lock sent by the second array, executing the first target service and then sending a task execution instruction to the second array, so that the second array uses the target resource to execute the first target service.

2. The method according to claim 1, wherein After the second array uses the target resource to execute the first target service, the method further includes: Releasing the mutex lock in the first array.

3. The method according to claim 1, characterized in that, The method further includes: If the addition of the mutex lock to the first array fails, end, or If receiving an instruction indicating failure of adding the mutex lock sent by the second array, releasing the mutex lock in the first array.

4. The method according to claim 1, wherein The adding of the mutex lock to the first array includes: Using the pre-set correspondence between services and mutex services to determine the target mutex service corresponding to the first target service; Using the first target service and the target mutex service to obtain a mutex lock and adding the mutex lock to the first array.

5. The method according to claim 1, characterized in that The method further includes: When sending the mutex lock addition instruction to the second array and receiving the mutex lock addition instruction sent by the second array, determining whether the priorities of the first target service and the second target service are the same, where the second target service is the service in the received mutex lock addition instruction; If they are not the same and the priority of the first target service is greater than the priority of the second target service, continue to send the mutex lock addition instruction to the second array; Otherwise, withdraw the mutex lock addition instruction and release the mutex lock in the first array.

6. A task scheduling method for cross-array remote replication, characterized in that, Applied to the second array, the method includes: Receiving the mutex lock addition instruction sent by the first array and adding a mutex lock to the second array, where the mutex lock addition instruction is sent after the first array successfully adds the mutex lock; If the mutex lock is successfully added to the second array, locking the target resource, where the target resource is obtained based on the mutex lock addition instruction; Sending an instruction indicating successful addition of the mutex lock to the first array, so that the first array can execute the first target service; where the first target service is obtained based on the mutex lock addition instruction; Receiving the task execution instruction sent by the first array and using the target resource to execute the first target service.

7. The method according to claim 6, wherein The method further includes: If the addition of the mutex lock to the second array fails, sending an instruction indicating failure of adding the mutex lock to the first array, so that the first array can release the mutex lock in the first array.

8. The method according to claim 6, characterized in that, After locking the target resource, the method further includes: Releasing the mutex in the second array.

9. The method according to claim 6, wherein The method further includes: When receiving a mutex increment instruction sent by the first array when sending a mutex increment instruction to the first array, determine whether the priorities of the first target service and the second target service are the same, where the second target service is the service in the sent mutex increment instruction; If they are not the same, and the priority of the second target service is greater than the priority of the first target service, continue to execute the mutex increment instruction sent to the first array; Otherwise, withdraw the mutex increment instruction and release the mutex in the second array.

10. A task scheduling device across arrays, characterized in that, Applied to the first array, the device includes: A first mutex increment module, configured to increment a mutex for the first array in response to a service instruction sent by a user, where the service instruction includes a first target service to be executed by the first array, a second array, and a target resource, and the target resource is a resource required in the second array when executing the first target task; A first instruction sending module, configured to send a mutex increment instruction to the second array if the mutex is successfully incremented for the first array, so that after receiving the mutex increment instruction, the second array increments the mutex for the second array and locks the target resource; A first service execution module, configured to execute the first target service after receiving an instruction indicating successful mutex increment sent by the second array, and send a task execution instruction to the second array, so that the second array uses the target resource to execute the first target service.

11. A task scheduling device for cross-array remote replication, characterized in that, Applied to the second array, the device includes: A second mutex increment module, configured to increment a mutex for the second array when receiving a mutex increment instruction sent by the first array, where the mutex increment instruction is sent after the mutex is successfully incremented for the first array; A resource locking module, configured to lock a target resource if the mutex is successfully incremented for the second array, where the target resource is obtained based on the mutex increment instruction; A second specified sending module, configured to send an instruction indicating successful mutex increment to the first array, so that the first array executes the first target service; where the first target service is obtained based on the mutex increment instruction; A second service execution module, configured to receive a task execution instruction sent by the first array and execute the first target service using the target resource.

12. An electronic device, characterized in that, Including: A memory for storing a computer program; A processor, configured to implement the method according to any one of claims 1-9 when executing the computer program stored on the memory.

13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1-9 is implemented.