CN113448701B - 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
CN113448701B
CN113448701B CN202110580616.0A CN202110580616A CN113448701B CN 113448701 B CN113448701 B CN 113448701B CN 202110580616 A CN202110580616 A CN 202110580616A CN 113448701 B CN113448701 B CN 113448701B
Authority
CN
China
Prior art keywords
outbound
lock
database queue
executed
tasks
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.)
Active
Application number
CN202110580616.0A
Other languages
Chinese (zh)
Other versions
CN113448701A (en
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/CN113448701B/en
Publication of CN113448701A publication Critical patent/CN113448701A/en
Application granted granted Critical
Publication of CN113448701B publication Critical patent/CN113448701B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Marketing (AREA)
  • Signal Processing (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a multi-process outbound control method, a system, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring a plurality of outbound instructions corresponding to a plurality of outbound tasks to be executed simultaneously; acquiring a lock authority of a process lock for locking a database queue according to the outbound instruction, starting a 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 obtaining outbound task lists which are being executed and are not yet executed in the database queue, and selecting an optimal outbound task allocation scheme to be allocated to multi-process execution through a dynamic programming algorithm. The invention solves the problem of simultaneous external calling of multiple users by adopting multiple processes, and dynamically distributes the current external calling line, so that the distribution scheme is optimized, and the utilization rate of the external calling line is improved.

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 and system for controlling a multi-process outbound call, an electronic device, and a storage medium.
Background
Outbound calls are generally divided into two phases: the method comprises the steps of obtaining outbound data and initiating outbound actions. The outgoing line refers to a line for calling outside, and the dialing of the customer telephone can be realized only by the outgoing line. In the outbound scenario, the total number of outbound lines is usually fixed, but the lines required for a plurality of users to make outbound at the same time are often different, and the disadvantage of the prior art is mainly that the distribution lines are fixed, which often results in waste of 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 the distribution line is fixed and the outbound line is wasted in the prior art, and realizing the 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 instructions corresponding to a plurality of outbound tasks to be executed simultaneously;
Acquiring a lock authority of a process lock for locking a database queue according to the outbound instruction, starting a 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 obtaining outbound task lists which are being executed and are not yet executed in the database queue, and selecting an optimal outbound task allocation scheme to be allocated to multi-process execution through a dynamic programming algorithm.
According to the multi-process outbound control method of the invention, before a plurality of outbound instructions corresponding to a plurality of outbound tasks to be executed simultaneously are acquired, the method further comprises:
storing the related information of all outbound tasks into a database queue;
marking the execution state of all outbound tasks in the database queue;
The related information of the outbound task comprises one or more of the number of lines required, the total number of call phones, creation time and execution state, and the execution state of the outbound task comprises the outbound task in current execution, the outbound task which is not executed yet and the outbound task which is executed yet.
According to the multi-process outbound control method of the invention, the process for acquiring the lock authority of the process lock for locking the database queue according to the outbound instruction and starting the process for acquiring the lock authority comprises the following steps:
Judging whether the requested access database queue is locked by a process using a process lock;
If so, the process of not obtaining the lock authority for locking the database queue is blocked;
Otherwise, the process of acquiring the lock authority for locking the database queue is started.
According to the multi-process outbound control method of the present invention, the judging whether the requested access database queue is locked by a process using a process lock includes:
judging whether the requested access database queue is locked by a certain process by using the process lock according to the file version number of the process lock locking database queue;
And when the file version number used for recording the process 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 certain process to lock the database queue by using the process lock, wherein the process lock adopts an optimistic lock.
According to the multi-process outbound control method of the present invention, the obtaining the outbound task list not yet executed in the database queue, selecting the optimal outbound task allocation scheme for allocation to multi-process execution by a dynamic programming algorithm, includes:
The process of the lock authority is obtained, the database queue is read, the outbound task list which is being executed and is not executed in the database queue is obtained, and the database queue adopts a Redis database queue;
And converting the solution of the optimal outbound task allocation scheme into a 01 back packet problem of a dynamic specification algorithm, namely solving the problem that the total number of lines which are executing outbound tasks plus the number of lines which are waiting for executing outbound tasks is not more than the upper limit of the total number of preset lines, wherein the total number of the lines which are currently executing outbound tasks is the largest in the case of the outbound tasks which are not yet executed.
According to the multi-process 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 number of lines of the first i outbound tasks, v [ i ] represents the number of lines of the outbound tasks to be executed at the moment i, j represents the total number of lines of the outbound tasks to be executed, the maximum value of j is not more than the upper limit of the preset total number of lines, and i represents the first i outbound tasks.
According to the multi-process outbound control method of the 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 for 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 a lock authority of a process lock for locking a database queue according to the outbound instruction, starting a 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 the dynamic planning module is used for acquiring the outbound task list which is being executed and not yet executed in the database queue, and selecting the optimal outbound task allocation scheme to be allocated to the multi-process execution through a dynamic planning algorithm.
The invention also provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of any of the multi-process outbound control methods described above when executing the program.
The present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of a multi-process outbound control method as described in any one of the above.
According to the multiprocess outbound control method, the multiprocess outbound control system, the electronic equipment and the storage medium, the problem that users simultaneously carry out outbound calls is solved by adopting multiprocess, and the current outbound line is dynamically allocated, so that the allocation scheme is optimized, and the utilization rate of the outbound line is improved.
Drawings
In order to more clearly illustrate the invention or the technical solutions of the prior art, the following description will briefly explain the drawings used in the embodiments or the description of the prior art, and it is obvious that the drawings in the following description are some embodiments of the invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic flow chart of a multi-process outbound control method provided by the invention;
FIG. 2 is a 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 flow chart of dynamic programming provided by the present invention;
FIG. 5 is a schematic flow chart of the present invention after performing 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
For the purpose of making the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The terms first, second and the like in the description and in the claims and in the above-described figures, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments described herein may be implemented in other sequences than those illustrated or otherwise described herein.
In the outbound scenario, the total number of outbound lines is usually fixed, and the lines required when a plurality of users make outbound at the same time are often different, while the lines allocated by the plurality of users in the prior art are fixed, so that the waste of outbound line resources is often caused. Assuming that the total number of outbound lines is 100, and 5 users make outbound simultaneously, each user is allocated a fixed line, for example, 20 lines are allocated to each user to perform outbound tasks, so that some users may not need 20 lines, and some users may need more than 20 lines. Therefore, the outbound line resources are easy to waste in the allocation of outbound resources.
The invention dynamically distributes the current outbound line by adopting a multiprocess synchronization and dynamic programming technology, so that the line utilization rate is highest for the whole user outbound demand 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 flow chart of a multi-process outbound control method provided by the invention, as shown in fig. 1. A multi-process outbound control method, the method comprising:
Step 101, obtaining a plurality of outbound instructions corresponding to a plurality of outbound tasks to be executed simultaneously.
Since outbound is generally divided into two phases, one is the acquisition of outbound data and the other is the initiation of outbound actions. Therefore, when the terminal (or the seat) needs to make an outbound call, the data of the outbound call task needs to be acquired by the background management system. And the outbound action can be initiated by acquiring the data of the outbound task, namely the outbound task is executed.
Step 102, obtaining a lock authority of a process lock for locking a database queue according to the outbound command, and starting a process for obtaining 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 realized by using the Redis database queue and the thread lock, so that conflict or dirty reading can not be caused when reading between processes and applying a line to execute outbound tasks.
Dirty reads refer to when one transaction is accessing data and has modified the data, but the modification has not been committed to the database, then another transaction also accesses the data and then uses the data. Because this data is not yet committed, then the data read by another transaction is dirty, and operations performed on the dirty data may be incorrect.
Step 103, obtaining the outbound task list which is being executed and is not yet executed in the database queue, and selecting the optimal outbound task allocation scheme to be allocated to the multi-process execution through a dynamic programming algorithm.
Optionally, each process can also adopt the same dynamic planning algorithm according to the rest lines, and then effectively select the outbound task of the optimal outbound task allocation scheme from the waiting tasks (i.e. the outbound tasks which are not executed yet) in the data queue to call, thereby avoiding the waste of the outbound lines and maximizing the actual effect of the outbound tasks.
It should be noted that, one line can only make one outgoing call at the same time, if one outgoing call task needs to make m calls, n lines (n is greater than or equal to m) need to be applied, that is, m calls are made by using n lines.
The database queue management, process locking, dynamic programming algorithm, etc. involved in the above steps 101 to 103 will be specifically described below.
Fig. 2 is a schematic flow chart of database queue management provided in the present invention, as shown in fig. 2. In step 101, before the obtaining the plurality of outbound instructions for executing the plurality of outbound tasks simultaneously, the method further includes:
And step 201, storing the related information of all outbound tasks into a database queue.
And 202, marking the execution state of all outbound tasks in the database queue.
Wherein the information about the outbound task includes one or more combinations of a required line number, a total number of calls, a creation time, and an execution state, and the execution state of the outbound task includes an outbound task currently being executed (i.e., a currently calling task), an outbound task that has not been executed (i.e., a waiting task), and an outbound task that has been executed (i.e., a history 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 script, LRU eviction, transaction and different levels of disk persistence, and is automatically partitioned by REDIS SENTINEL and Redis Cluster.
The Redis list of the Redis database queue is a simple list of strings, ordered in insert order, to which an element can be added to the head (left) or tail (right) of the list. A list may contain up to 2 32 -1 elements (4294967295, more than 40 hundred million elements each).
Alternatively, the Redis database queue of the present invention is enqueued using lpush operations, such as the following example is using lpush to insert three values into a list named runoobkey:
The invention adopts the Redis database queue to have the advantages that:
first, redis has higher performance. For example, redis can read at 110000 times/s and write at 81000 times/s.
Second, redis has rich data types. Such as Redis support the Strings, lists, hashes, set and Ordered set data type operations of binary cases.
Furthermore, the atoms of Redis are specific. All operations such as Redis are atomic, 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 step of obtaining the lock authority of the process lock for locking the database queue according to the outbound command, and starting the process of obtaining the lock authority includes:
step 301, determining whether the requested access database queue is locked by a process using a process lock.
Optionally, the same database queue is commonly used by multiple processes, and when a certain process locks the database queue, the database queue cannot be accessed by other processes.
Optionally, the related information of the outbound task includes one or more combinations of a required line number, a total number of call phones, a creation time and an execution state, and the execution state of the outbound task includes an outbound task in current execution, an outbound task that has not yet been executed, and an outbound task that has been executed.
When concurrent situations in which a plurality of outbound tasks are executed simultaneously may occur in a multi-process, it is necessary to ensure accuracy of data in the concurrent situations to ensure that when the current terminal and the other terminals operate together, the obtained result is the same as that when the current terminal operates. The purpose of concurrency control is to ensure that the operation of one terminal does not have an unreasonable impact on the operation of the other terminal. If concurrency control is not done, dirty reading, unreadable reading and the like may result.
Concurrency control is typically associated with database management systems (DBMS). The task of concurrency control in a DBMS is to ensure that when multiple transactions access the same data in a database at the same time, the isolation, consistency and database uniformity of the transactions are not destroyed. The main means for implementing concurrency control can be broadly divided into optimistic concurrency control and pessimistic concurrency control. Optimistic locks (a way of optimistic concurrency control) are more suitable for read-many-read-few situations (a multi-read scenario) and pessimistic locks (a way of pessimistic concurrency control) are more suitable for write-many-read-few situations (a multi-write scenario).
Optionally, the process lock of the present invention employs an optimistic lock (Optimistic Locking). The optimistic lock is relative to the pessimistic lock, and the optimistic lock assumes that the data will not collide under normal conditions, so that whether the data collide or not is formally detected when the data is submitted and updated, and if the data is found to collide, wrong information is returned to the user, so that the user can decide how to do so. Optimistic locks are suitable for use in scenarios where there are many read operations, which may improve the throughput of the program.
Specifically, the optimistic lock is implemented by determining, according to a file version number used to record a process lock locking database queue, whether a requested access database queue is locked by a process using the process lock; and if the read version number of the file version number used for recording the process lock locking database queue is equal to the current version number of the file version number of the database queue, allowing the data update to be executed and locking by a certain process by using the process lock.
For example, an optimistic lock is a file version number version field added to the data table that indicates the number of times the data has been modified. When the data is modified, the version value will be +1. When the process A is to update the data value, the version value is read while the data is read, and when the update is submitted, the version value which is just read is updated when the version value is equal to the version value in the current database, otherwise, the operation is abandoned and error information is returned.
Therefore, concurrency control is performed through the optimistic lock, and a mechanism for avoiding data processing errors caused by reasons such as unreal database reading, overlong service processing time and the like can be avoided. And optimistic locks do not need to resort to a database lock mechanism, such as the CAS (Compare and Swap) of an optimistic lock, which is a mechanism that solves the problem of performance loss caused by using locks in a multi-process parallel scenario, when multiple processes attempt to update the same variable at the same time using the CAS, only one of the processes can update the value of the variable while the other processes fail, the failed process is not suspended, but is informed of the failure in the race and can try again.
If so, the process of not obtaining the lock authority to lock the database queue is blocked 302.
When an ongoing process temporarily fails to continue execution due to the occurrence of an event, the process may be aborted and suspended, i.e., the execution of the process is blocked, and the process in the blocked state may be in a waiting state or a blocked state. The one or more processes in the blocking state may be queued or queued depending on the cause of the blocking. When the execution of the process is blocked, the process blocks itself by calling a blocking command, and is awakened after waiting for the occurrence of a corresponding event.
Step 303, otherwise, a process of acquiring the lock authority for locking the database queue is started.
It should be noted that the invention is not limited to the optimistic locks described above, and that other locking means may be used.
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 step of obtaining the outbound task list that is not yet executed in the database queue, and selecting the optimal outbound task allocation scheme for allocation to the 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 which is being executed and is not executed in the database queue, wherein the database queue adopts 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 update to the cache value, the cache can be updated immediately without any calculation, but if this solution is not appropriate for a scenario where the write data is frequent and the read data is small, there may be cases where the query has not been deleted or modified yet, which wastes time and resources.
If the value of the write database is inconsistent with the value of the update cache, the data written into the cache is required to be inserted into the cache through the results obtained by the association calculation of a plurality of tables, the cache is not required to be updated immediately, the cache is only required to be deleted, and the calculated results are required to be inserted into the cache when the query is completed.
Therefore, when the data needs to be updated, the cache data is deleted, then the database is updated instead of the cache, and the latest data is updated to the cache when the query is needed.
For example, when the outbound task needs to be updated, the currently executed outbound task is 100, the update is now 99, the database queue is updated to 99, then the cache is deleted, and the deletion of the cache is found to be failed, which means that the database is in stock of 99, and the cache is 100, which leads to inconsistent database queues and caches. Therefore, under the condition, the method and the device delete the cache firstly and then update the database queue, if the deletion of the cache fails, the database queue is not updated, and if the deletion of the cache is successful and the update of the database fails, the old data is only searched from the database queue during the inquiry, so that the consistency of the database queue and the cache can be ensured.
Step 402, converting the solution of the optimal outbound task allocation scheme into a 01 back packet problem of a dynamic specification algorithm, namely solving the sum of lines performing outbound tasks plus the number of lines to be performed outbound tasks not greater than a preset upper limit of the sum of lines performing outbound tasks currently, wherein the sum of lines performing outbound tasks plus the number of lines to be performed outbound tasks is the largest under the condition of the outbound tasks not yet being performed.
The backpack problem (Knapsack problem) 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 within a defined total weight, how to choose to maximize the total price of the item. The NPC problem is solved without polynomial time complexity, but with dynamic programming, the knapsack problem can be solved with pseudo polynomial time complexity. Generally, backpack problems are classified into the following categories: 01 knapsack problem; a complete knapsack problem; multiple backpack problem.
Optionally, the invention solves the optimal outbound task allocation scheme by using the 01 knapsack problem. 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 number of lines of the first i outbound tasks, v [ i ] represents the number of lines of the outbound tasks to be executed at the moment i, j represents the total number of lines of the outbound tasks to be executed, the maximum value of j is not more than the upper limit of the preset total number of lines, and i represents the first i outbound tasks.
The calculation equation shows that the space can be optimized by adopting a method (rolling array) commonly used for dynamic programming, and finally the optimal outbound task allocation scheme is obtained by optimization.
Such as: the upper limit of the total number of preset lines is 60, a first outbound task is currently executed, 10 lines are applied for the first outbound task, 40 lines are applied for the second outbound task which is not executed yet, 5 lines are applied for the third outbound task which is not executed yet, and 10 lines are applied for the fourth outbound task which is not executed yet. Then, according to the known conditions, solving and obtaining the optimal outbound task allocation scheme to execute the second outbound task and the fourth outbound task.
In another case, the above known conditions of the first outbound task, the second outbound task, the third outbound task and the fourth outbound task are unchanged, and if the total number of preset lines is up to 40, the optimal outbound task scheme is obtained by solving to execute the third outbound task and the fourth outbound task.
In summary, each process of obtaining the lock authority adopts the same dynamic planning scheme according to the number of the remaining lines, and effectively selects the optimal task from the waiting tasks in the database queue to call, thereby avoiding the waste of outbound lines and maximizing the actual effect of outbound tasks.
Fig. 5 is a schematic flow chart after performing an outbound task, as shown in fig. 5. In step 103, after the optimal outbound task allocation scheme is selected by the dynamic programming algorithm, the method further includes:
And step 501, marking the outbound task of the optimal outbound task allocation scheme in the database queue as an executed state, and releasing the locking authority of the process for acquiring the locking authority.
Optionally, after releasing the lock authority of the process that acquires the lock authority, the multiprocess executes the outbound task of the optimal outbound task allocation scheme.
The principle of locking and unlocking (i.e., releasing lock rights) is that when a process enters a critical section, it will hold a lock of some type. When another process attempts to enter a critical section (lock) while the process is not releasing the lock, it will be put into sleep and then placed into the process queue (of a certain 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 dispatch.
Therefore, the Redis database synchronous queue and the process lock can realize the synchronization between the processes, so that the conflict or dirty reading can not be caused when the lines are read and applied between the processes.
The following describes the multi-process outbound control system provided by the invention, and the multi-process outbound control system described below and the multi-process outbound control method described above can be referred to correspondingly.
Fig. 6 is a schematic structural diagram of a multi-process outbound control system according to 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 receiving module 610 is configured to obtain a plurality of outbound instructions corresponding to a plurality of outbound tasks to be executed simultaneously.
The process lock module 620 is configured to obtain, according to the outbound instruction, a lock permission of a process lock for locking a database queue, and start a process for obtaining the lock permission, 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.
The dynamic programming module 630 is configured to obtain the outbound task list that is being executed and not yet executed in the database queue, and select an optimal outbound task allocation scheme to allocate to multi-process execution through a dynamic programming algorithm.
Optionally, the multi-process outbound control system 600 is further configured to perform the following steps:
Before a plurality of outbound instructions corresponding to a plurality of outbound tasks are acquired and executed simultaneously, storing relevant information of all outbound tasks into a database queue; marking the execution state of all outbound tasks in the database queue;
The related information of the outbound task comprises one or more of the number of lines required, the total number of call phones, creation time and execution state, and the execution state of the outbound task comprises the outbound task in current execution, the outbound task which is not executed yet and the outbound task which is executed yet.
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 of not obtaining the lock authority for locking the database queue is blocked;
Otherwise, the process of 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 certain process by using the process lock according to the file version number of the process lock locking database queue;
and when 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 the database queue to execute data updating and allowing a certain process to lock the database queue by using the process lock, wherein the process lock adopts an optimistic lock.
Optionally, the dynamic programming module 630 is further configured to perform the following steps:
The process of the lock authority is obtained, the database queue is read, the outbound task list which is being executed and is not executed in the database queue is obtained, and the database queue adopts a Redis database queue;
And converting the solution of the optimal outbound task allocation scheme into a 01 back packet problem of a dynamic specification algorithm, namely solving the problem that the total number of lines which are executing outbound tasks plus the number of lines which are waiting for executing outbound tasks is not more than the upper limit of the total number of preset lines, wherein the total number of the lines which are currently executing outbound tasks is the largest in the case of the outbound tasks which are not yet 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 number of lines of the first i outbound tasks, v [ i ] represents the number of lines of the outbound tasks to be executed at the moment i, j represents the total number of lines of the outbound tasks to be executed, the maximum value of j is not more than the upper limit of the preset total number of lines, and i represents the first i outbound tasks.
Optionally, the multi-process outbound control system 600 is further configured to perform the following steps:
And after the optimal outbound task allocation scheme is selected through a dynamic programming algorithm, marking the outbound task of the optimal outbound task allocation scheme in the database queue as an executed state, and releasing the locking authority of the process for acquiring the locking authority.
Fig. 7 illustrates a physical schematic diagram of an electronic device, as shown in fig. 7, which may include: processor 710, communication interface (Communications Interface) 720, memory 730, and communication bus 740, wherein processor 710, communication interface 720, memory 730 communicate with each other via communication bus 740. Processor 710 may invoke logic instructions in memory 730 to perform the multi-process outbound control method described above, including:
acquiring a plurality of outbound instructions corresponding to a plurality of outbound tasks to be executed simultaneously;
Acquiring a lock authority of a process lock for locking a database queue according to the outbound instruction, starting a 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 obtaining outbound task lists which are being executed and are not yet executed in the database queue, and selecting an optimal outbound task allocation scheme to be allocated to multi-process execution through a dynamic programming algorithm.
Further, the logic instructions in the memory 730 described above may be implemented in the form of software functional units and may be stored in a computer readable storage medium when sold or used as a stand alone product. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a usb disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or 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 instructions corresponding to a plurality of outbound tasks to be executed simultaneously;
Acquiring a lock authority of a process lock for locking a database queue according to the outbound instruction, starting a 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 obtaining outbound task lists which are being executed and are not yet executed in the database queue, and selecting an optimal outbound task allocation scheme to be allocated to multi-process execution through a dynamic programming algorithm.
In yet another aspect, the present invention further 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 above, the method comprising:
acquiring a plurality of outbound instructions corresponding to a plurality of outbound tasks to be executed simultaneously;
Acquiring a lock authority of a process lock for locking a database queue according to the outbound instruction, starting a 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 obtaining outbound task lists which are being executed and are not yet executed in the database queue, and selecting an optimal outbound task allocation scheme to be allocated to multi-process execution through a dynamic programming algorithm.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the 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 scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims (7)

1. A method for multiprocessing outbound control, the method comprising:
acquiring a plurality of outbound instructions corresponding to a plurality of outbound tasks to be executed simultaneously;
Acquiring a lock authority of a process lock for locking a database queue according to the outbound instruction, starting a 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;
Acquiring outbound task lists which are being executed and are not yet executed in the database queue, and selecting an optimal outbound task allocation scheme to be allocated to multi-process execution through a dynamic programming algorithm;
The step of obtaining the lock authority of the process lock for locking the database queue according to the outbound instruction and starting the process of obtaining the lock authority comprises the following steps:
judging whether the requested access database queue is locked by a process using a process lock; if so, the process of not obtaining the lock authority for locking the database queue is blocked; otherwise, the process of acquiring the lock authority for locking the database queue is started;
The determining whether the requested access database queue is locked by a process using a process lock includes:
judging whether the requested access database queue is locked by a certain process by using the process lock according to the file version number of the process lock locking database queue;
When the file version number used for recording the process 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 certain process to lock the database queue by using the process lock, wherein the process lock adopts an optimistic lock;
the step of obtaining the outbound task list which is not executed in the database queue, selecting the optimal outbound task allocation scheme to be allocated to the multi-process execution through a dynamic programming algorithm, comprising the following steps:
The process of the lock authority is obtained, the database queue is read, the outbound task list which is being executed and is not executed in the database queue is obtained, and the database queue adopts a Redis database queue;
And converting the solution of the optimal outbound task allocation scheme into a 01 back packet problem of a dynamic specification algorithm, namely solving the problem that the total number of lines which are executing outbound tasks plus the number of lines which are waiting for executing outbound tasks is not more than the upper limit of the total number of preset lines, and the total number of lines which are currently executing outbound tasks plus the maximum number of lines which are waiting for executing outbound tasks under the condition of not executing outbound tasks.
2. The multiprocessing outbound control method according to claim 1, wherein before acquiring a plurality of outbound instructions corresponding to a plurality of outbound tasks to be executed simultaneously, the method further comprises:
storing the related information of all outbound tasks into a database queue;
marking the execution state of all outbound tasks in the database queue;
The related information of the outbound task comprises one or more of the number of lines required, the total number of call phones, creation time and execution state, and the execution state of the outbound task comprises the outbound task in current execution, the outbound task which is not executed yet and the outbound task which is executed yet.
3. The multi-process outbound control method of claim 1 wherein the calculation 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 number of lines of the first i outbound tasks, v [ i ] represents the number of lines of the outbound tasks to be executed at the moment i, j represents the total number of lines of the outbound tasks to be executed, the maximum value of j is not more than the upper limit of the preset total number of lines, and i represents the first i outbound tasks.
4. The multi-process outbound control method according to claim 1, wherein after the selection of the optimal outbound task allocation scheme 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 for acquiring the lock authority.
5. 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 a lock authority of a process lock for locking a database queue according to the outbound instruction, starting a 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;
the dynamic planning module is used for acquiring outbound task lists which are being executed and not yet executed in the database queue, and selecting an optimal outbound task allocation scheme to be allocated to multi-process execution through a dynamic planning algorithm;
The process lock module 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 of not obtaining the lock authority for locking the database queue is blocked; otherwise, the process of acquiring the lock authority for locking the database queue is started;
optionally, the process lock module is further configured to perform the following steps:
judging whether the requested access database queue is locked by a certain process by using the process lock according to the file version number of the process lock locking database queue;
When 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 the database queue to execute data updating and allowing a certain process to lock the database queue by using the process lock, wherein the process lock adopts an optimistic lock;
optionally, the dynamic programming module is further configured to perform the following steps:
The process of the lock authority is obtained, the database queue is read, the outbound task list which is being executed and is not executed in the database queue is obtained, and the database queue adopts a Redis database queue;
And converting the solution of the optimal outbound task allocation scheme into a 01 back packet problem of a dynamic specification algorithm, namely solving the problem that the total number of lines which are executing outbound tasks plus the number of lines which are waiting for executing outbound tasks is not more than the upper limit of the total number of preset lines, and the total number of lines which are currently executing outbound tasks plus the maximum number of lines which are waiting for executing outbound tasks under the condition of not executing outbound tasks.
6. 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 processor implements the steps of the multi-process outbound control method according to any one of claims 1 to 4 when the program is executed.
7. 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 4.
CN202110580616.0A 2021-05-26 2021-05-26 Multi-process outbound control method, system, electronic equipment and storage medium Active CN113448701B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110580616.0A CN113448701B (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 CN113448701B (en) 2021-05-26 2021-05-26 Multi-process outbound control method, system, electronic equipment and storage medium

Publications (2)

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

Family

ID=77810447

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110580616.0A Active CN113448701B (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) CN113448701B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105830477A (en) * 2013-08-12 2016-08-03 哥莱菲特软件公司 Operating system integrated domain management
CN109672794A (en) * 2018-12-04 2019-04-23 天津深思维科技有限公司 A kind of outer paging system of intelligent sound

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10387217B2 (en) * 2017-02-15 2019-08-20 Ca, Inc. Distributed processing of mixed serial and concurrent workloads
US10850199B2 (en) * 2018-04-04 2020-12-01 UberGeekGames LLC Scripting engine and implementations
CN110536024B (en) * 2019-07-30 2022-11-04 平安科技(深圳)有限公司 Outbound method, device, medium and computer equipment
US11025780B2 (en) * 2019-08-02 2021-06-01 Fmr Llc Systems and methods for search based call routing

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105830477A (en) * 2013-08-12 2016-08-03 哥莱菲特软件公司 Operating system integrated domain management
CN109672794A (en) * 2018-12-04 2019-04-23 天津深思维科技有限公司 A kind of outer paging system of intelligent sound

Also Published As

Publication number Publication date
CN113448701A (en) 2021-09-28

Similar Documents

Publication Publication Date Title
US7653791B2 (en) Realtime-safe read copy update with per-processor read/write locks
US6678802B2 (en) Method and apparatus for controlling access by a plurality of concurrently operating processes to a resource
US7536582B1 (en) Fault-tolerant match-and-set locking mechanism for multiprocessor systems
US4509119A (en) Method for managing a buffer pool referenced by batch and interactive processes
KR940005819B1 (en) Consistent timestamping for transactions in distributed systems
CN113448701B (en) Multi-process outbound control method, system, electronic equipment and storage medium
JP4963018B2 (en) Scheduling method and scheduling apparatus
US11204813B2 (en) System and method for multidimensional search with a resource pool in a computing environment
US9086911B2 (en) Multiprocessing transaction recovery manager
CN107533474B (en) Transaction processing method and device
WO2013138774A1 (en) Systems and methods for supporting transaction recovery based on a strict ordering of two-phase commit calls
US7353342B1 (en) Shared lease instruction support for transient blocking synchronization
CN112241400A (en) Method for realizing distributed lock based on database
EP3824397B1 (en) Version-based table locking
CN111459963A (en) Core accounting transaction concurrent processing method and device
US10313477B2 (en) System and method for use of a non-blocking process with a resource pool in a computing environment
CN104252386B (en) The locking method and equipment of data renewal
EP3146430A1 (en) System and method for supporting a distributed data structure in a distributed data grid
US6976260B1 (en) Method and apparatus for serializing a message queue in a multiprocessing environment
Thomasian et al. A new distributed optimistic concurrency control method and a comparison of its performance with two-phase locking
CN107220275B (en) Database handles processing method, device and computer equipment
CN110377614B (en) Order processing lock system under distributed environment
CN115951844B (en) File lock management method, equipment and medium of distributed file system
CN117076147B (en) Deadlock detection method, device, equipment and storage medium
CN111814007B (en) Method, device and equipment for processing data of doubly-linked list and machine-readable storage medium

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
GR01 Patent grant
GR01 Patent grant