CN113448701A - Multi-process outbound control method, system, electronic equipment and storage medium - Google Patents

Multi-process outbound control method, system, electronic equipment and storage medium Download PDF

Info

Publication number
CN113448701A
CN113448701A CN202110580616.0A CN202110580616A CN113448701A CN 113448701 A CN113448701 A CN 113448701A CN 202110580616 A CN202110580616 A CN 202110580616A CN 113448701 A CN113448701 A CN 113448701A
Authority
CN
China
Prior art keywords
outbound
lock
executed
database queue
acquiring
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110580616.0A
Other languages
Chinese (zh)
Inventor
周圣凯
陈孝良
苏少炜
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing SoundAI Technology Co Ltd
Original Assignee
Beijing SoundAI Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing SoundAI Technology Co Ltd filed Critical Beijing SoundAI Technology Co Ltd
Priority to CN202110580616.0A priority Critical patent/CN113448701A/en
Publication of CN113448701A publication Critical patent/CN113448701A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores
    • G06F9/524Deadlock detection or avoidance
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M3/00Automatic or semi-automatic exchanges
    • H04M3/42Systems providing special services or facilities to subscribers
    • H04M3/50Centralised arrangements for answering calls; Centralised arrangements for recording messages for absent or busy subscribers ; Centralised arrangements for recording messages
    • H04M3/51Centralised call answering arrangements requiring operator intervention, e.g. call or contact centers for telemarketing
    • H04M3/5183Call or contact centers with computer-telephony arrangements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M3/00Automatic or semi-automatic exchanges
    • H04M3/42Systems providing special services or facilities to subscribers
    • H04M3/50Centralised arrangements for answering calls; Centralised arrangements for recording messages for absent or busy subscribers ; Centralised arrangements for recording messages
    • H04M3/51Centralised call answering arrangements requiring operator intervention, e.g. call or contact centers for telemarketing
    • H04M3/523Centralised call answering arrangements requiring operator intervention, e.g. call or contact centers for telemarketing with call distribution or queueing
    • H04M3/5232Call distribution algorithms

Abstract

The invention provides a multiprocess outbound control method, a multiprocess outbound control system, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring a plurality of outbound commands corresponding to a plurality of outbound tasks to be executed simultaneously; acquiring a lock authority used for locking a process lock of a database queue according to the outbound command, and starting the process for acquiring the lock authority, wherein the process lock is used for controlling the starting or blocking of the process, and the database queue is used for storing all outbound tasks; and acquiring the outbound task lists which are executed and not executed in the database queue, and selecting an optimal outbound task allocation scheme through a dynamic programming algorithm to allocate to a plurality of processes for execution. The invention solves the problem of simultaneously carrying out external calling by multiple users by adopting multiple processes, and dynamically allocates the current external calling line, thereby optimizing the allocation scheme and improving the utilization rate of the external calling line.

Description

Multi-process outbound control method, system, electronic equipment and storage medium
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method, a system, an electronic device, and a storage medium for controlling a multi-process outbound call.
Background
Outbound calls are generally divided into two phases: the method comprises the steps of obtaining outbound data and initiating an outbound action. The outbound line refers to an outbound line, and the calling of a customer can be realized only by the outbound line. In an outbound scenario, the total number of outbound lines is usually fixed, and lines required by multiple users for outbound at the same time are often different, and the prior art has the main disadvantage that the distribution lines are fixed, which often causes waste of the outbound lines.
Disclosure of Invention
The invention provides a multiprocess outbound control method, a multiprocess outbound control system, electronic equipment and a storage medium, which are used for solving the problem that an outbound line is wasted due to fixed distribution lines in the prior art and realizing dynamic distribution of the current outbound line so as to improve the utilization rate of the outbound line.
The invention provides a multi-process outbound control method, which comprises the following steps:
acquiring a plurality of outbound commands corresponding to a plurality of outbound tasks to be executed simultaneously;
acquiring a lock authority used for locking a process lock of a database queue according to the outbound command, and starting the process for acquiring the lock authority, wherein the process lock is used for controlling the starting or blocking of the process, and the database queue is used for storing all outbound tasks;
and acquiring the outbound task lists which are executed and not executed in the database queue, and selecting an optimal outbound task allocation scheme through a dynamic programming algorithm to allocate to a plurality of processes for execution.
According to the multiprocess outbound control method of the invention, before acquiring a plurality of outbound instructions corresponding to a plurality of outbound tasks to be executed simultaneously, the method further comprises the following steps:
storing the relevant information of all outbound tasks into a database queue;
marking the execution states of all outbound tasks in the database queue;
the relevant information of the outbound task comprises one or more combinations of required line number, total number of calling telephones, creation time and execution state, and the execution state of the outbound task comprises the currently executed outbound task, the unexecuted outbound task and the executed outbound task.
According to the multiprocess outbound control method of the invention, the acquiring the lock authority of the process lock for locking the database queue according to the outbound command and starting the process for acquiring the lock authority comprises:
judging whether the requested access database queue is locked by a process using a process lock;
if so, the process which does not acquire the lock authority for locking the database queue is blocked;
otherwise, the process acquiring the lock authority for locking the database queue is started.
According to the multiprocess outbound control method of the present invention, the judging whether the requested access database queue is locked by a process using a process lock comprises:
judging whether the requested access database queue is locked by a process lock by a process according to the file version number for recording the process lock locking database queue;
and when the file version number used for recording the progress lock locking database queue is read to be equal to the current file version number of the database queue, allowing the database queue to execute data updating and allowing a process lock to be used by a certain process to lock the database queue, wherein the process lock adopts an optimistic lock.
According to the multiprocess outbound control method, the step of obtaining the unexecuted outbound task list in the database queue and selecting the optimal outbound task allocation scheme to be allocated to the multiprocess execution through a dynamic programming algorithm comprises the following steps:
the process of obtaining the lock authority reads the database queue, and obtains outbound task lists which are executed and are not executed in the database queue, wherein the database queue adopts a Redis database queue;
and converting the solution of the optimal outbound task allocation scheme into a 01-knapsack problem of a dynamic canonical algorithm, namely solving that the total number of lines for executing the outbound task plus the number of lines for executing the outbound task is not more than the upper limit of the preset total number of lines, wherein the total number of lines for executing the outbound task plus the number of lines for executing the outbound task is the largest under the condition that the outbound task is not executed.
According to the multiprocess outbound control method of the invention, the calculation equation of the 01 knapsack problem is as follows:
m[i][j]=max(m[i-1][j],m[i-1][j-v[i]]+v[i]);
wherein m [ i ] [ j ] represents the line number of the first i outbound tasks, v [ i ] represents the line number of the outbound tasks to be executed at the moment i, j represents the total line number of the executed outbound tasks, the maximum value of j is not more than the preset upper limit of the total line number, and i represents the first i outbound tasks.
According to the multiprocess outbound control method of the present invention, after the optimal outbound task allocation scheme is selected by the dynamic programming algorithm, the method further comprises:
and marking the outbound task of the optimal outbound task allocation scheme in the database queue as an executed state, and releasing the lock authority of the process acquiring the lock authority.
The invention also provides a multi-process outbound control system, which comprises:
the receiving module is used for acquiring a plurality of outbound instructions corresponding to a plurality of outbound tasks to be executed simultaneously;
the process lock module is used for acquiring the lock authority of a process lock for locking a database queue according to the outbound command and starting the process for acquiring the lock authority, the process lock is used for controlling the starting or blocking of the process, and the database queue is used for storing all outbound tasks;
and the dynamic planning module is used for acquiring the outbound task lists which are executed and not executed in the database queue, and selecting an optimal outbound task allocation scheme through a dynamic planning algorithm to allocate to the multi-process execution.
The invention also provides an electronic device, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor executes the program to realize the steps of any one of the multi-process outbound control methods.
The present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the multi-process outbound control method as described in any of the above.
The multi-process outbound control method, the multi-process outbound control system, the electronic equipment and the storage medium solve the problem that multiple users simultaneously call the outbound by adopting the multi-process and dynamically distribute the current outbound line, thereby optimizing the distribution scheme and improving the utilization rate of the outbound line.
Drawings
In order to more clearly illustrate the technical solutions of the present invention or the prior art, the drawings needed for the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
FIG. 1 is a flow chart of a multi-process outbound control method provided by the present invention;
FIG. 2 is a schematic flow chart of database queue management provided by the present invention;
FIG. 3 is a flow diagram of a process lock provided by the present invention;
FIG. 4 is a schematic flow chart of dynamic programming provided by the present invention;
FIG. 5 is a flow chart illustrating the present invention following the execution of an outbound task;
FIG. 6 is a schematic structural diagram of a multi-process outbound control system provided by the present invention;
fig. 7 is a schematic structural diagram of an electronic device provided by the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is obvious that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terms "first," "second," and the like in the description and in the claims, and in the drawings described above, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that the embodiments described herein may be practiced otherwise than as specifically illustrated or described herein.
In an outbound scenario, the total number of outbound lines is usually fixed, and lines required for a plurality of users to simultaneously make an outbound are often different, whereas in the prior art, lines allocated to a plurality of users are fixed, which often causes waste of outbound line resources. Assuming that the total number of outbound lines is 100, 5 subscribers are simultaneously making an outbound call, each subscriber is assigned a fixed line, for example, each subscriber is assigned 20 lines to perform an outbound call task, and some subscribers may not need as many as 20 lines, and some subscribers may need more than 20 lines. Therefore, the outbound line resource is easily wasted in the allocation of the outbound resource.
The invention adopts multi-process synchronization and dynamic planning technology to dynamically distribute the current outbound line, so that the line utilization rate is highest aiming at the outbound requirements of a full number of users at the same time.
The multi-process outbound control method, system, electronic device, and storage medium of the present invention are described below with reference to fig. 1-7.
Fig. 1 is a schematic flow chart of a multi-process outbound control method provided by the present invention, as shown in fig. 1. A method of multi-process outbound control, the method comprising:
step 101, obtaining a plurality of outbound commands corresponding to a plurality of outbound tasks to be executed simultaneously.
Since the outbound call is generally divided into two phases, one phase is the acquisition of the outbound data and the other phase is the initiation of the outbound action. Therefore, when the terminal (or the seat) needs to make an outbound call, the data of the outbound task needs to be acquired from the background management system. The data of the outbound task is obtained to initiate the outbound action, namely, the outbound task is executed.
102, acquiring a lock authority of a process lock for locking a database queue according to the outbound command, and starting the process for acquiring the lock authority, wherein the process lock is used for controlling the starting or blocking of the process, and the database queue is used for storing all outbound tasks.
Optionally, synchronization between processes can be achieved by using the Redis database queue and the thread lock, so that conflict or dirty reading cannot be caused when reading between processes and applying a line to execute an outbound task.
Dirty read, when a transaction is accessing data and has made a modification to the data that has not yet been committed to the database, another transaction accesses the data and then uses the data. Because the data is not committed yet, the data read by another transaction is dirty, and the operation performed on the dirty data may not be correct.
And 103, acquiring the outbound task lists which are executed and not executed in the database queue, and selecting an optimal outbound task allocation scheme to be allocated to a plurality of processes for execution through a dynamic programming algorithm.
Optionally, each process may also adopt the same dynamic planning algorithm according to the remaining lines, and continuously and effectively select the outbound task of the optimal outbound task allocation scheme from the waiting tasks (i.e., the outbound tasks that are not executed) in the data queue to perform the call, thereby avoiding the waste of outbound lines and maximizing the actual effect of the outbound task.
It should be noted that one line can only make one outgoing call at the same time, and if one outgoing call task needs to make m calls, n lines (n ≧ m) need to be applied, that is, m calls are made by using n lines.
The database queue management, process lock, dynamic programming algorithm, and the like involved in the above steps 101 to 103 will be described in detail below.
Fig. 2 is a schematic flow chart of database queue management provided by the present invention, as shown in fig. 2. In step 101, before the obtaining of the multiple outbound commands that need to execute the multiple outbound tasks at the same time, the method further includes:
step 201, storing the relevant information of all outbound tasks into a database queue.
Step 202, marking the execution state of all outbound tasks in the database queue.
The relevant information of the outbound task comprises one or more combinations of required number of lines, total number of calling calls, creation time and execution state, wherein the execution state of the outbound task comprises the currently executed outbound task (namely the currently calling task), the outbound task which is not executed yet (namely the waiting task) and the executed outbound task (namely the historically completed task).
Optionally, the database queue adopts a Redis database queue. Redis is stored as a data structure in memory, often used as a database, cache, and message broker. Redis supports data structures such as strings, hashes, lists, collections. Redis has built-in replication, Lua scripts, LRU evictions, transactions and different levels of disk persistence, and is automatically partitioned by Redis Sentinel and Redis Cluster.
The Redis list of a Redis database queue is a simple list of strings, ordered in insertion order, that may add an element to the head (left) or tail (right) of the list. A list may contain up to 2321 element (4294967295, each list exceeding 40 hundred million elements).
Optionally, the Redis database queue according to the present invention is entered into the queue by using an lpush operation, for example, the following example is that the lpush is used to insert three values into a list named unoobkey:
Figure BDA0003085977930000071
the advantages of the invention adopting Redis database queue are:
first, the performance of Redis is higher. For example, Redis can read at 110000 times/s and write at 81000 times/s.
Second, Redis has a rich data type. Redis, for example, supports Strings, Lists, Hashes, Sets, and Ordered Sets data type operations for binary cases.
Furthermore, the atoms of Redis are specific. All operations such as Redis are atomicity, i.e., either execute successfully or fail to execute at all.
FIG. 3 is a flow chart of a process lock provided by the present invention, as shown in FIG. 3. In step 102, the acquiring, according to the outbound command, a lock authority for locking a process lock of a database queue, and starting a process for acquiring the lock authority includes:
step 301, determine whether the requested access to the database queue is locked by a process using a process lock.
Optionally, in the present invention, multiple processes share the same database queue, and when a process locks the database queue, the database queue cannot be accessed by other processes.
Optionally, the relevant information of the outbound task includes one or more combinations of the required number of lines, the total number of calling phones, the creation time, and the execution state, where the execution state of the outbound task includes the currently executed outbound task, the outbound task that has not been executed, and the executed outbound task.
When a concurrency condition that a plurality of outbound tasks are executed simultaneously may occur in a multi-process, it is necessary to ensure the accuracy of data in the concurrency condition to ensure that when the current terminal and other terminals operate together, the obtained result is the same as the result when the current terminal operates. The purpose of concurrency control is to ensure that the operation of one terminal does not unreasonably affect the operation of another terminal. If the concurrency control is not well done, problems of dirty reading, unreal reading, unrepeatable reading and the like can be caused.
Concurrency control is typically associated with a database management system (DBMS). The task of concurrency control in a DBMS is to ensure that when multiple transactions access the same data in a database simultaneously, the isolation, consistency and uniformity of the transactions and the uniformity of the database are not destroyed. The main means for implementing concurrency control can be roughly divided into optimistic concurrency control and pessimistic concurrency control. An optimistic lock (belonging to a mode of optimistic concurrency control) is suitable for a case of reading more and writing less (a scenario of more reading), and a pessimistic lock (belonging to a mode of pessimistic concurrency control) is suitable for a case of writing more and reading less (a scenario of more writing).
Optionally, the process lock of the present invention adopts an Optimistic Locking (Optimistic Locking). The optimistic lock is a pessimistic lock, and the optimistic lock assumes that data generally does not cause a conflict, so that when the data is submitted and updated, whether the data conflicts or not is formally detected, and if the data conflicts are found, wrong information is returned to a user, so that the user determines how to do the conflict. Optimistic locks are suitable for read-many scenarios, which may improve program throughput.
Specifically, the optimistic lock is realized by judging whether a requested access database queue is locked by a process lock by a certain process according to a file version number for recording the process lock locking database queue; and if the read file version number for recording the process lock locking database queue is equal to the current file version number of the database queue, allowing data updating to be carried out and allowing a process to lock by using the process lock.
For example, an optimistic lock adds a file version number version field to a data table to indicate the number of times data has been modified. When the data is modified, the version value will be + 1. When the process A needs to update the data value, the version value is read while the data is read, when the update is submitted, the update is carried out if the read version value is equal to the version value in the current database, otherwise, the operation is abandoned and error information is returned.
Therefore, concurrent control is carried out through the optimistic lock, and a mechanism that data processing errors are caused by unreal reading of the database, overlong service processing time and the like can be avoided. And the optimistic lock does not need to use a lock mechanism of a database, for example, CAS (Compare and Swap) of the optimistic lock is a mechanism for solving performance loss caused by using the lock under the condition of multi-process parallel, when a plurality of processes attempt to update the same variable by using CAS at the same time, only one process can update the value of the variable, and other processes all fail, and the failed process is not suspended, but is informed of failure in the competition and can try again.
If so, the process that does not acquire the lock authority to lock the database queue may be blocked, step 302.
When an ongoing process temporarily fails to continue execution due to an event, the process may be aborted and be in a suspended state, i.e., the execution of the process is blocked. The one or more processes in the blocking state may be arranged in a queue, or the one or more processes in the blocking state may be arranged in a plurality of queues according to the blocking reason. When the execution of the process is blocked, the process blocks the process by calling a blocking command and is awakened after a corresponding event occurs.
Step 303, otherwise, the process acquiring the lock authority to lock the database queue is started.
It should be noted that the present invention is not limited to the above-mentioned optimistic lock, and other locking methods may be adopted in the present invention.
Fig. 4 is a schematic flow chart of dynamic programming provided by the present invention, as shown in fig. 4. In the step 103, the obtaining of the outbound task list that is not executed yet in the database queue and selecting an optimal outbound task allocation scheme to be allocated to a multi-process execution through a dynamic programming algorithm includes:
step 401, obtaining the process of the lock authority, reading the database queue, and obtaining the outbound task list being executed and not being executed in the database queue, where the database queue is a Redis database queue.
It should be noted that, only one process can acquire the lock authority for locking the database queue at the same time, that is, only one process can read and update the data of the database queue at the same time.
Specifically, the read-write strategy of the Redis database queue is as follows:
if the value of the write database is the same as the value updated to the cache, the cache can be updated immediately without any computation, but if this solution is not suitable for the scenario where the write data is frequent and the read data is low, there may be cases where the data is deleted or modified without a query, which wastes time and resources.
If the value of the write data base is inconsistent with the value of the update cache, the result obtained by the data written into the cache after correlation calculation of a plurality of tables is inserted into the cache, so that the cache does not need to be updated immediately, the cache can be deleted, and the result obtained after calculation can be inserted into the cache when query is carried out.
Therefore, when the data needs to be updated, the cache data is deleted, then the database is updated instead of updating the cache, and the latest data is updated to the cache when the data needs to be queried.
For example, when the outbound task needs to be updated, the currently executed outbound task is 100, and now needs to be updated to 99, the database queue is updated to 99 first, and then the cache is deleted, and it is found that the cache deletion fails, which means that the database is 99 and the cache is 100, which results in inconsistency between the database queue and the cache. Therefore, under the condition, the invention deletes the cache firstly and then updates the database queue, if the cache deletion fails, the database queue is not required to be updated, if the cache deletion succeeds and the database update fails, only old data is searched from the database queue during the query, thereby ensuring the consistency of the database queue and the cache.
Step 402, the solution of the optimal outbound task allocation scheme is converted into a 01-knapsack problem of a dynamic canonical algorithm, that is, the total number of lines on which outbound tasks are being executed plus the number of lines on which outbound tasks are to be executed is not greater than a preset upper limit of the total number of lines, and the total number of lines on which outbound tasks are being executed plus the number of lines on which outbound tasks are to be executed is the largest under the condition that outbound tasks are not executed yet.
The Knapsack problem (Knapack proplem) is a combination-optimized NP-Complete (NPC) problem. The problem can be described as: given a set of items, each item has its own weight and price, and how to choose, within a defined total weight, will maximize the total price of the items. The NPC problem is solver without polynomial time complexity, but with dynamic programming, the knapsack problem can be solved with pseudo-polynomial time complexity. Generally speaking, the backpack problem has several classifications: 01 backpack problems; the problem of complete backpack; the problem of multiple backpacks.
Optionally, the invention solves the optimal outbound task assignment scheme by using a 01-knapsack problem. The computational equation for the 01 knapsack problem is:
m[i][j]=max(m[i-1][j],m[i-1][j-v[i]]+v[i]);
wherein m [ i ] [ j ] represents the line number of the first i outbound tasks, v [ i ] represents the line number of the outbound tasks to be executed at the moment i, j represents the total line number of the executed outbound tasks, the maximum value of j is not more than the preset upper limit of the total line number, and i represents the first i outbound tasks.
According to the calculation equation, the space can be optimized by adopting a method (rolling array) commonly used in dynamic programming, and finally, the optimal outbound task allocation scheme is obtained through optimization.
Such as: the upper limit of the total number of preset lines is 60, a first outbound task is executed at present, 10 lines are applied to the first outbound task, 40 lines are applied to a second outbound task which is not executed yet, 5 lines are applied to a third outbound task which is not executed yet, and 10 lines are applied to a fourth outbound task which is not executed yet. Then, according to the known conditions, the optimal outbound task allocation scheme is obtained by solving and is used for executing a second outbound task and a fourth outbound task.
In another case, the known conditions of the first outbound task, the second outbound task, the third outbound task and the fourth outbound task are not changed, and if the upper limit of the total number of preset lines is 40, the optimal outbound task scheme is obtained by solving to execute the third outbound task and the fourth outbound task.
In conclusion, each process for obtaining the lock authority can adopt the same dynamic planning scheme according to the number of the remaining lines and effectively select the optimal task from the waiting tasks in the database queue for calling, thereby avoiding the waste of the outbound line and maximizing the actual effect of the outbound task.
Fig. 5 is a flow chart after the outbound task is performed, as shown in fig. 5, according to the present invention. In step 103, after selecting the optimal outbound task assignment scheme through the dynamic programming algorithm, the method further includes:
step 501, the outbound task of the optimal outbound task allocation scheme in the database queue is marked as an executed state, and the lock authority of the process acquiring the lock authority is released.
Optionally, after releasing the lock authority of the process that acquires the lock authority, the multi-process executes the outbound task of the optimal outbound task allocation scheme.
The principle of locking and unlocking (i.e. releasing lock privileges) is that when a process enters a critical section, it will hold a lock of some type. When other processes attempt to enter the critical section (lock) when the process does not release the lock, it will be set to sleep and then placed in the process queue (of some priority) waiting for the lock. When the lock is released, i.e., an unlock event occurs, the kernel will look for a process from the process priority queue waiting for the lock and place it in a ready state, waiting for scheduling.
Therefore, synchronization among processes can be realized by using the Redis database synchronization queue and the process lock, so that conflict or dirty reading cannot be caused when a line is read and applied among the processes.
The multi-process outbound control system provided by the present invention is described below, and the multi-process outbound control system described below and the multi-process outbound control method described above may be referred to in correspondence with each other.
Fig. 6 is a schematic structural diagram of a multi-process outbound control system provided by the present invention, as shown in fig. 6. A multi-process outbound control system 600 includes a receiving module 610, a process lock module 620, and a dynamic programming module 630. Wherein the content of the first and second substances,
the receiving module 610 is configured to obtain a plurality of outbound commands corresponding to a plurality of outbound tasks that need to be executed simultaneously.
And the process lock module 620 is configured to acquire a lock authority of a process lock for locking a database queue according to the outbound command, and start the process for acquiring the lock authority, where the process lock is used to control starting or blocking of a process, and the database queue is used to store all outbound tasks.
And the dynamic planning module 630 is configured to obtain the outbound task lists being executed and not being executed in the database queue, and select an optimal outbound task allocation scheme for allocating to multiple processes for execution through a dynamic planning algorithm.
Optionally, the multi-process outbound control system 600 is further configured to perform the following steps:
before the plurality of outbound commands corresponding to the plurality of outbound tasks which need to be executed simultaneously are obtained, storing the relevant information of all the outbound tasks into a database queue; marking the execution states of all outbound tasks in the database queue;
the relevant information of the outbound task comprises one or more combinations of required line number, total number of calling telephones, creation time and execution state, and the execution state of the outbound task comprises the currently executed outbound task, the unexecuted outbound task and the executed outbound task.
Optionally, the process lock module 620 is further configured to perform the following steps:
judging whether the requested access database queue is locked by a process using a process lock;
if so, the process which does not acquire the lock authority for locking the database queue is blocked;
otherwise, the process acquiring the lock authority for locking the database queue is started.
Optionally, the process lock module 620 is further configured to perform the following steps:
judging whether the requested access database queue is locked by a process lock by a process according to the file version number for recording the process lock locking database queue;
and when the read file version number for recording the progress lock locking database queue is equal to the current file version number of the database queue, allowing the database queue to execute data updating and allowing a process lock to be used by a certain process to lock the database queue, wherein the process lock adopts an optimistic lock.
Optionally, the dynamic planning module 630 is further configured to perform the following steps:
the process of obtaining the lock authority reads the database queue, and obtains outbound task lists which are executed and are not executed in the database queue, wherein the database queue adopts a Redis database queue;
and converting the solution of the optimal outbound task allocation scheme into a 01-knapsack problem of a dynamic canonical algorithm, namely solving that the total number of lines for executing the outbound task plus the number of lines for executing the outbound task is not more than the upper limit of the preset total number of lines, wherein the total number of lines for executing the outbound task plus the number of lines for executing the outbound task is the largest under the condition that the outbound task is not executed.
Optionally, the calculation equation of the 01 knapsack problem is:
m[i][j]=max(m[i-1][j],m[i-1][j-v[i]]+v[i]);
wherein m [ i ] [ j ] represents the line number of the first i outbound tasks, v [ i ] represents the line number of the outbound tasks to be executed at the moment i, j represents the total line number of the executed outbound tasks, the maximum value of j is not more than the preset upper limit of the total line number, and i represents the first i outbound tasks.
Optionally, the multi-process outbound control system 600 is further configured to perform the following steps:
after the optimal outbound task allocation scheme is selected through a dynamic programming algorithm, the outbound task of the optimal outbound task allocation scheme in the database queue is marked as an executed state, and the lock authority of the process acquiring the lock authority is released.
Fig. 7 illustrates a physical structure diagram of an electronic device, and as shown in fig. 7, the electronic device may include: a processor (processor)710, a communication Interface (Communications Interface)720, a memory (memory)730, and a communication bus 740, wherein the processor 710, the communication Interface 720, and the memory 730 communicate with each other via the communication bus 740. Processor 710 may call logic instructions in memory 730 to perform the multi-process outbound control method described above, the method comprising:
acquiring a plurality of outbound commands corresponding to a plurality of outbound tasks to be executed simultaneously;
acquiring a lock authority used for locking a process lock of a database queue according to the outbound command, and starting the process for acquiring the lock authority, wherein the process lock is used for controlling the starting or blocking of the process, and the database queue is used for storing all outbound tasks;
and acquiring the outbound task lists which are executed and not executed in the database queue, and selecting an optimal outbound task allocation scheme through a dynamic programming algorithm to allocate to a plurality of processes for execution.
In addition, the logic instructions in the memory 730 can be implemented in the form of software functional units and stored in a computer readable storage medium when the software functional units are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In another aspect, the present invention also provides a computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions which, when executed by a computer, enable the computer to perform the multi-process outbound control method provided by the above methods, the method comprising:
acquiring a plurality of outbound commands corresponding to a plurality of outbound tasks to be executed simultaneously;
acquiring a lock authority used for locking a process lock of a database queue according to the outbound command, and starting the process for acquiring the lock authority, wherein the process lock is used for controlling the starting or blocking of the process, and the database queue is used for storing all outbound tasks;
and acquiring the outbound task lists which are executed and not executed in the database queue, and selecting an optimal outbound task allocation scheme through a dynamic programming algorithm to allocate to a plurality of processes for execution.
In yet another aspect, the present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, is implemented to perform the multi-process outbound control method provided in each of the above aspects, the method comprising:
acquiring a plurality of outbound commands corresponding to a plurality of outbound tasks to be executed simultaneously;
acquiring a lock authority used for locking a process lock of a database queue according to the outbound command, and starting the process for acquiring the lock authority, wherein the process lock is used for controlling the starting or blocking of the process, and the database queue is used for storing all outbound tasks;
and acquiring the outbound task lists which are executed and not executed in the database queue, and selecting an optimal outbound task allocation scheme through a dynamic programming algorithm to allocate to a plurality of processes for execution.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A method for multi-process outbound control, the method comprising:
acquiring a plurality of outbound commands corresponding to a plurality of outbound tasks to be executed simultaneously;
acquiring a lock authority used for locking a process lock of a database queue according to the outbound command, and starting the process for acquiring the lock authority, wherein the process lock is used for controlling the starting or blocking of the process, and the database queue is used for storing all outbound tasks;
and acquiring the outbound task lists which are executed and not executed in the database queue, and selecting an optimal outbound task allocation scheme through a dynamic programming algorithm to allocate to a plurality of processes for execution.
2. The multiprocess outbound control method according to claim 1, characterised in that before obtaining a plurality of outbound commands corresponding to a plurality of outbound tasks to be executed simultaneously, the method further comprises:
storing the relevant information of all outbound tasks into a database queue;
marking the execution states of all outbound tasks in the database queue;
the relevant information of the outbound task comprises one or more combinations of required line number, total number of calling telephones, creation time and execution state, and the execution state of the outbound task comprises the currently executed outbound task, the unexecuted outbound task and the executed outbound task.
3. The multi-process outbound control method according to claim 1, wherein the acquiring, according to the outbound command, a lock authority for locking a process lock of a database queue and starting a process for acquiring the lock authority includes:
judging whether the requested access database queue is locked by a process using a process lock;
if so, the process which does not acquire the lock authority for locking the database queue is blocked;
otherwise, the process acquiring the lock authority for locking the database queue is started.
4. The method of claim 3, wherein the determining whether the queue requested to access the database is locked by a process using a process lock comprises:
judging whether the requested access database queue is locked by a process lock by a process according to the file version number for recording the process lock locking database queue;
and when the file version number used for recording the progress lock locking database queue is read to be equal to the current file version number of the database queue, allowing the database queue to execute data updating and allowing a process lock to be used by a certain process to lock the database queue, wherein the process lock adopts an optimistic lock.
5. The multiprocess outbound control method according to claim 1, wherein said obtaining the list of outbound tasks not yet executed in the database queue, and selecting the optimal outbound task allocation scheme to allocate to multiprocess execution by a dynamic programming algorithm, comprises:
the process of obtaining the lock authority reads the database queue, and obtains outbound task lists which are executed and are not executed in the database queue, wherein the database queue adopts a Redis database queue;
and converting the solution of the optimal outbound task allocation scheme into a 01-knapsack problem of a dynamic canonical algorithm, namely solving that the total number of lines for executing the outbound task plus the number of lines for executing the outbound task is not more than the upper limit of the preset total number of lines, wherein the total number of lines for executing the outbound task plus the number of lines for executing the outbound task is the largest under the condition that the outbound task is not executed.
6. The method of claim 5, wherein the computational equation for the 01 knapsack problem is:
m[i][j]=max(m[i-1][j],m[i-1][j-v[i]]+v[i]);
wherein m [ i ] [ j ] represents the line number of the first i outbound tasks, v [ i ] represents the line number of the outbound tasks to be executed at the moment i, j represents the total line number of the executed outbound tasks, the maximum value of j is not more than the preset upper limit of the total line number, and i represents the first i outbound tasks.
7. The multi-process outbound control method of claim 1 wherein after said selecting an optimal outbound task assignment scheme by a dynamic programming algorithm, said method further comprises:
and marking the outbound task of the optimal outbound task allocation scheme in the database queue as an executed state, and releasing the lock authority of the process acquiring the lock authority.
8. A multi-process outbound control system, the system comprising:
the receiving module is used for acquiring a plurality of outbound instructions corresponding to a plurality of outbound tasks to be executed simultaneously;
the process lock module is used for acquiring the lock authority of a process lock for locking a database queue according to the outbound command and starting the process for acquiring the lock authority, the process lock is used for controlling the starting or blocking of the process, and the database queue is used for storing all outbound tasks;
and the dynamic planning module is used for acquiring the outbound task lists which are executed and not executed in the database queue, and selecting an optimal outbound task allocation scheme through a dynamic planning algorithm to allocate to the multi-process execution.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the steps of the multi-process outbound control method according to any of claims 1 to 7 are implemented when the processor executes the program.
10. A non-transitory computer readable storage medium, having stored thereon a computer program, wherein the computer program, when executed by a processor, implements the steps of the multi-process outbound control method according to any one of claims 1 to 7.
CN202110580616.0A 2021-05-26 2021-05-26 Multi-process outbound control method, system, electronic equipment and storage medium Pending CN113448701A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110580616.0A CN113448701A (en) 2021-05-26 2021-05-26 Multi-process outbound control method, system, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110580616.0A CN113448701A (en) 2021-05-26 2021-05-26 Multi-process outbound control method, system, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113448701A true CN113448701A (en) 2021-09-28

Family

ID=77810447

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110580616.0A Pending CN113448701A (en) 2021-05-26 2021-05-26 Multi-process outbound control method, system, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113448701A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114938413A (en) * 2022-05-19 2022-08-23 马上消费金融股份有限公司 Outbound task compensation method, device, equipment and storage medium
CN116028204A (en) * 2022-05-16 2023-04-28 荣耀终端有限公司 Process management and control method and electronic equipment

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116028204A (en) * 2022-05-16 2023-04-28 荣耀终端有限公司 Process management and control method and electronic equipment
CN116028204B (en) * 2022-05-16 2023-10-20 荣耀终端有限公司 Process management and control method and electronic equipment
CN114938413A (en) * 2022-05-19 2022-08-23 马上消费金融股份有限公司 Outbound task compensation method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
KR940005819B1 (en) Consistent timestamping for transactions in distributed systems
US9430388B2 (en) Scheduler, multi-core processor system, and scheduling method
US6678802B2 (en) Method and apparatus for controlling access by a plurality of concurrently operating processes to a resource
CN105103130B (en) For realizing the system and method for the adaptive statistical counter of expansible contention
US5999976A (en) Parallel file system and method with byte range API locking
CN108509462B (en) Method and device for synchronizing activity transaction table
CN113448701A (en) Multi-process outbound control method, system, electronic equipment and storage medium
CN105190559B (en) For realizing the system and method for the shared probability counters of storage update probability value
US9086911B2 (en) Multiprocessing transaction recovery manager
US11372681B2 (en) Slab memory allocator with dynamic buffer resizing
CN107533474B (en) Transaction processing method and device
CN112241400A (en) Method for realizing distributed lock based on database
CN106897345A (en) A kind of method and device of data storage
CN107220275B (en) Database handles processing method, device and computer equipment
US6976260B1 (en) Method and apparatus for serializing a message queue in a multiprocessing environment
CN113254223B (en) Resource allocation method and system after system restart and related components
CN115964176B (en) Cloud computing cluster scheduling method, electronic equipment and storage medium
McGee The information management system IMS/VS, Part V: Transaction processing facilities
US11138231B2 (en) Method and system for data handling
KR102239280B1 (en) System and method for supporting adaptive self-tuning locking mechanism in transactional middleware machine environment
CN111597147B (en) Space recovery method, device, storage medium and processor
CN110377614B (en) Order processing lock system under distributed environment
EP3686751A1 (en) Method and system for data handling
CN112035503A (en) Transaction data updating method and device
Niklander et al. A real-time database for future telecommunication services

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination