CN109062686A - Multi-process management method, storage medium, electronic equipment and system - Google Patents

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

Info

Publication number
CN109062686A
CN109062686A CN201810746906.6A CN201810746906A CN109062686A CN 109062686 A CN109062686 A CN 109062686A CN 201810746906 A CN201810746906 A CN 201810746906A CN 109062686 A CN109062686 A CN 109062686A
Authority
CN
China
Prior art keywords
task
assisted
assisted process
function
name pipeline
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.)
Granted
Application number
CN201810746906.6A
Other languages
Chinese (zh)
Other versions
CN109062686B (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.)
Wuhan Douyu Network Technology Co Ltd
Original Assignee
Wuhan Douyu Network 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 Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN201810746906.6A priority Critical patent/CN109062686B/en
Publication of CN109062686A publication Critical patent/CN109062686A/en
Application granted granted Critical
Publication of CN109062686B publication Critical patent/CN109062686B/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/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • 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/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a kind of multi-process management method, storage medium, electronic equipment and systems, it is related to control technology field, this method includes the multiple name pipelines for communicating between host process and assisted process of CreateNamedPipe function creation called in Windows API calls, and each name pipeline corresponds to an assisted process;Host process calls function WriteFile that task data is written in name pipeline, and the task data of write-in is sent to corresponding assisted process;Assisted process calls function ReadFile to read task data from name pipeline;Assisted process task based access control data carry out corresponding task execution, and to task execution after, assisted process call function AtExit complete exiting for itself.Host process guarantees the normal operation of application program under more assisted process operating conditions by naming pipeline to control the execution status of task of assisted process in the present invention.

Description

Multi-process management method, storage medium, electronic equipment and system
Technical field
The present invention relates to control technology fields, and in particular to a kind of multi-process management method, storage medium, electronic equipment and System.
Background technique
Currently, for the application program of some service types, especially for the application program with independent task, usually The architecture design that multi-process can be used can make the unstable of a process not will lead to entirely using the design of multi-process Program error, i.e. the application program for a service type, when a process because running quickly when beating a precipitate retreat out, other processes can also be after Continuous to be serviced, multi-process has stronger robustness, guarantees the normal operation of application program with this.
In actual operational process, such as a host process can be created for receiving task, then pass through host process Multiple assisted process (subprocess) are created to complete different task, i.e., for each received task of institute, are all assisted by one Process completes, i.e., different task creations different assisted process is completed, for example, search file task, written document task, Picture handles task dispatching.Can not be ensured in actual motion each assisted process can stable operation, due to simultaneously operation it is auxiliary Help process excessive, the task of some assisted process produces error in data when may go to half, and cause application program to be run quickly and bursts, The task that some assisted process execute, which may generate deadlock, causes application program stuck, and host process is for auxiliary in the prior art There is no good Managed Solutions for process.
Summary of the invention
In view of the deficiencies in the prior art, the purpose of the present invention is to provide a kind of multi-process management method, it is main into Journey is guaranteed under more assisted process operating conditions by naming pipeline to control the execution status of task of assisted process using journey The normal operation of sequence.
To achieve the above objectives, the technical solution adopted by the present invention is that, comprising:
Call the CreateNamedPipe function creation in Windows API calls is multiple to be used for host process and auxiliary The name pipeline of interprocess communication, and the corresponding assisted process of each name pipeline;
Host process calls function WriteFile that task data is written in name pipeline, and the task data of write-in is sent out To corresponding assisted process;
Assisted process calls function ReadFile to read task data from name pipeline;
Assisted process task based access control data carry out corresponding task execution, and to task execution after, assisted process tune Exiting for itself is completed with function AtExit, and is sent by name pipeline for indicating that task has been finished and assisted process The data having dropped out are to host process.
Based on the above technical solution,
Each assisted process is corresponding to execute a task;
The name pipeline also needs incoming name parameter when creating;
Name parameter in incoming name pipeline corresponds to the title of the pending task of assisted process for the name pipeline.
Based on the above technical solution, after the completion of name pipeline creation, for host process:
Function ConnectNamedPipe is called to wait the corresponding assisted process connection of the name pipeline;
The connection with host process is completed by name pipeline to assisted process, assisted process is received and is sent by name pipeline For indicating the data of successful connection to host process;
The data for calling function ReadFile to send assisted process are read out;
It calls function WriteFile that task data is written in name pipeline, and the task data of write-in is sent to correspondence Assisted process.
Based on the above technical solution, after the completion of name pipeline creation, for assisted process:
It calls function CreateFile connection to name pipeline, completes the connection between host process;
Send for indicating the data of successful connection to host process, then call function WaitNamedPipe wait it is main into Journey it is corresponding;
Function ReadFile is called to read the task data that host process is written from name pipeline.
Based on the above technical solution, it is preset with task completion time in the host process, when host process is being named Task data is written in pipeline, and after the task data of write-in is sent to assisted process, if in the task completion time being preset with It is interior, host process do not receive assisted process transmission for indicating task has been finished and assisted process has dropped out data, then Host process calling function TerminateProcess terminates the operation of the assisted process.
Based on the above technical solution, this method further include: write the abnormality processing letter for monitoring assisted process Number, and registration of the abnormality processing function in Windows system is completed, it is abnormal when assisted process, which executes task, occurs abnormal It handles function and informs that host process, host process call function TerminateProcess to terminate the assisted process by sending log Operation.
Based on the above technical solution, after assisted process is terminated operation, host process re-creates assisted process To re-execute executing before being terminated assisted process for task.
The present invention also provides a kind of storage mediums, are stored thereon with computer program, the computer program is by processor It is performed the steps of when execution
Call the CreateNamedPipe function creation in Windows API calls is multiple to be used for host process and auxiliary The name pipeline of interprocess communication, and the corresponding assisted process of each name pipeline;
Host process calls function WriteFile that task data is written in name pipeline, and the task data of write-in is sent out To corresponding assisted process;
Assisted process calls function ReadFile to read task data from name pipeline;
Assisted process task based access control data carry out corresponding task execution, and to task execution after, assisted process tune Exiting for itself is completed with function AtExit, and is sent by name pipeline for indicating that task has been finished and assisted process The data having dropped out are to host process.
The present invention also provides a kind of electronic equipment comprising:
Creating unit is used to call the CreateNamedPipe function creation in Windows API calls multiple Name pipeline for being communicated between host process and assisted process, and the corresponding assisted process of each name pipeline;
Writing unit is used to that host process to be driven to call function WriteFile that task data is written in name pipeline, and The task data of write-in is sent to corresponding assisted process;
Reading unit is used to drive assisted process that function ReadFile is called to read task data from name pipeline;
Execution and notification unit, the execution for being used to that assisted process task based access control data to be driven to carry out corresponding task, and to After task execution, assisted process calls function AtExit to complete exiting for itself, and is sent by name pipeline and be used for table Show task has been finished and assisted process has dropped out data to host process.
The present invention also provides a kind of multi-process management systems, comprising:
Creation module is used to call the CreateNamedPipe function creation in Windows API calls multiple Name pipeline for being communicated between host process and assisted process, and the corresponding assisted process of each name pipeline;
Writing module is used to that host process to be driven to call function WriteFile that task data is written in name pipeline, and The task data of write-in is sent to corresponding assisted process;
Read module is used to drive assisted process that function ReadFile is called to read task data from name pipeline;
Execution and notification module, the execution for being used to that assisted process task based access control data to be driven to carry out corresponding task, and to After task execution, assisted process calls function AtExit to complete exiting for itself, and is sent by name pipeline and be used for table Show task has been finished and assisted process has dropped out data to host process.
Compared with the prior art, the advantages of the present invention are as follows: it is used to communicate between host process and assisted process by creation Pipeline is named, then task data is written in the name pipeline of creation in host process, and task data is auxiliary by naming pipeline to be sent to Help process, assisted process task based access control data carry out the execution of corresponding task, and to task execution after, assisted process is called Function AtExit completes exiting for itself, and by name pipeline send for indicate task be finished and assisted process The data exited are communicated between assisted process and host process by the name pipeline created to host process, while host process is logical It crosses name pipeline to grasp the execution status of task of assisted process, guarantees application program under more assisted process operating conditions It operates normally.
Detailed description of the invention
Fig. 1 is a kind of flow chart of multi-process management method in the embodiment of the present invention;
Fig. 2 is the structural schematic diagram of a kind of electronic equipment in the embodiment of the present invention.
Specific embodiment
Invention is further described in detail with reference to the accompanying drawings and embodiments.Those skilled in the art Ying Ming White, the embodiment of the present invention can provide as method, system or computer program product.Therefore, complete hardware can be used in the present invention The form of embodiment, complete software embodiment or embodiment combining software and hardware aspects.Moreover, the present invention can be used One or more wherein includes that (including but not limited to disk is deposited for the computer-usable storage medium of computer usable program code Reservoir, CD-ROM, optical memory etc.) on the form of computer program product implemented.
Shown in Figure 1, the embodiment of the present invention provides a kind of multi-process management method, for running in Windows system The host process of application program assisted process (subprocess) is managed, certainly, multi-process manager in the embodiment of the present invention Method thinking equally can also apply on linux system.The multi-process management method of the embodiment of the present invention specifically includes following step It is rapid:
S1: it calls in Windows system API (Application Programming Interface) function The multiple name pipelines for being communicated between host process and assisted process of CreateNamedPipe function creation, and each name is managed Road corresponds to an assisted process.In Windows system, CreateNamedPipe function is used to be named the creation of pipeline. Pipeline is named, name pipeline is called, it can be between the different processes of same computer or in the different meters across a network Between the different processes of calculation machine, supports reliable, one-way or bi-directional data communication, belong to a kind of inter-process communication mechanisms, this Inventive embodiments complete the communication in application program between host process and assisted process by name pipeline, and name pipeline can shield The network protocol details of bottom is covered, therefore more convenient to use and quick.
Application program needs to be implemented multiple tasks in the process of running, such as search file task, written document task, picture Task dispatching is handled, each task is accordingly executed by an assisted process, i.e., each assisted process is corresponding to execute a task, All execution that may have multiple assisted process simultaneously in the task of progress, therefore multiple name pipelines are created, each assisted process makes It is communicated between a name pipeline and host process.
Incoming name parameter is also needed when name pipeline creation, i.e., is passed to name parameter into function CreateNamedPipe, Name parameter in incoming name pipeline corresponds to the title of the pending task of assisted process for the name pipeline, due to each The title of business is different, and the title that can guarantee to create each name pipeline in this way is uniquely, will not to manage with other names Road is born the same name, be further ensured that name pipeline, between task and assisted process corresponding relationship uniqueness.
S2: host process calls function WriteFile to be written task data in name pipeline, and by the task data of write-in Be sent to corresponding assisted process, due to name pipeline and assisted process be it is corresponding, be between task and assisted process it is corresponding, Therefore the task data that host process is written in name pipeline can be by naming pipeline to be sent to corresponding assisted process, number of tasks According to the task pending for assisted process, such as write-in file, reading file.Function WriteFile is normal in Windows system The write-in data function seen, is usually used in writing data into file, which is also commonly used for communication equipment, pipeline, socket And the processing of mailslot.
For host process, after the completion of name pipeline creation, the operation specifically executed is as follows:
A: function ConnectNamedPipe is called to wait the corresponding assisted process connection of the name pipeline, when name pipeline After the completion of creation, assisted process can be connect by the name pipeline of creation with host process, and before proceeding, host process calls function The connection of ConnectNamedPipe waiting assisted process.Function ConnectNamedPipe is in Windows system for referring to Process waits after showing server, until client computer or other processes are the same as name pipeline connection.
B: completing the connection with host process by name pipeline to assisted process, receives assisted process and passes through name pipeline hair It send for indicating the data of successful connection to host process.I.e. after assisted process connection name pipeline, assisted process can send data Inform host process.
C: the data for calling function ReadFile to send assisted process are read out.Host process calls function ReadFile The data sent to assisted process are read out, and learn that assisted process has connected name pipeline success.Function ReadFile is used for It indicates by reading data into a file, that is, indicates the reading for carrying out data.
D: calling function WriteFile to be written task data in name pipeline, and the task data of write-in is sent to pair The assisted process answered.The task of the execution as needed for different assisted process is different, therefore for different assisted process, it is main The task data that process is written is different.Function WriteFile is the common write-in data function in Windows system, It writes data into a file.
For assisted process, after the completion of name pipeline creation, the operation specifically executed is as follows:
A: calling function CreateFile connection to name pipeline, completes the connection between host process.When name pipeline creation After the completion, assisted process calls function CreateFile to complete assisted process and names the connection of pipeline, i.e. completion assisted process Connection between host process.Function CreateFile be Windows system in a multi-functional function, can be used for open or Object is created, and return to addressable handle.
B: completing the connection with host process by name pipeline to assisted process, receives assisted process and passes through name pipeline hair It send for indicating the data of successful connection to host process.Inform that connection has been completed in host process, assisted process.Host process obtains After notice, task is issued to assisted process.
C: the data for calling function ReadFile to send assisted process are read out.
S3: assisted process calls function ReadFile to read task data from name pipeline.Host process obtain assisting into After the notice that journey has connected, task data can be issued to assisted process by name pipeline, assisted process calls function at this time ReadFile is read out the data that assisted process issues, and knows task definition.
S4: assisted process task based access control data carry out corresponding task execution, and to task execution after, assisted process Call function AtExit to complete exiting for itself, and by name pipeline send for indicate task be finished and assist into The data that journey has dropped out are to host process.Function AtExit is the api function of Windows system, for terminating function or process Operation, the prototype of the function are int atexit (void (* func) (void)), and wherein parameter func indicates that process or program are moved back The function completed is needed when out, and the execution of completion task is referred in the embodiment of the present invention.
To the login mechanism that each assisted process process of having write exits, when assisted process task execution finishes, then adjust Assisted process is completed with function AtExit to exit, and send data inform host process task be finished and assisted process It exits.
By writing the function of an interprocess communication come the transmission for assisted process to the notification data of host process, accuse Know that host process task has been finished and assisted process has dropped out.Many methods of system offer can be used in communication between process It carries out, such as the shared drive between network socket, process.The name pipeline that creates before use of the embodiment of the present invention carries out Communication between assisted process and host process, assisted process informs that host process task execution finishes and assisted process has been moved back at this time Out, code is executed accordingly are as follows:
WriteFile("process exit");
}
Atexit(IpcExit);
Registration procedure of function Atexit before calling exits function IpcExit, and it is logical that process exits function IpcExit It crosses name pipeline and informs host process.
In a kind of real-time mode, task completion time is preset in host process, when host process is written in name pipeline Task data, and after the task data of write-in is sent to assisted process, if host process is not in the task completion time being preset with Receive assisted process transmission for indicating task has been finished and assisted process has dropped out data, then host process calls letter Number TerminateProcess terminates the operation of the assisted process.Function TerminateProcess is in C++ programming language A kind of function, for terminating specified process or all threads.
The approximate time that task completion can be estimated out in advance for each task, when estimating out for task is completed Between be to be preset in task completion time in host process, when task data is written in name pipeline in host process, host process at this time The establishment moment of meeting store tasks, the data that then host process periodically sends received assisted process facilitate, if In the task completion time being preset with, host process do not receive assisted process transmission for indicating that task has been finished and has assisted The time that the data that process has dropped out, i.e. assisted process execute task has been more than preset task completion time, illustrates the auxiliary Process may have occurred stuck situation, fail the execution for being normally carried out task, so when call function TerminateProcess terminates the operation of the assisted process, prevents a large amount of stuck sequence lasts from existing and causes system resource Waste, guarantees the normal operation of application program.
The prototype of function TerminateProcess is as follows:
BOOL TerminateProcess(
HANDLE hProcess;// by the handle for the process that is moved to end
UINT uExitCode;// specified process exits code
);
Wherein, process handle handle is then the handle that host process is saved when creating assisted process.It is assisted when monitoring When the stuck situation of process, function TerminateProcess is called to close the process, effectively prevent a large amount of stuck processes consumptions System resource to the greatest extent.
In one embodiment, the abnormality processing function for monitoring assisted process is write, and completes abnormality processing letter Registration of the number in Windows system, when assisted process, which executes task, occurs abnormal, abnormality processing function is by sending log Inform host process, host process calling function TerminateProcess terminates the operation of the assisted process.It is abnormal for except it is 0 abnormal, Invalid handle is abnormal, internal storage access is abnormal etc..For assisted process, different tasks is executed, is difficult to ensure its execution All tasks can normally execute, so for the design of application program, be then required to compatible assisted process The situation for mistake occur can capture this mistake when an error occurs, to timely notify the host process task execution Failure.
An exception handling logic is write first, is implemented as follows:
LONG__stdcall
MyUnhandledExceptionFilter(PEXCEPTION_POINTERS
pExceptionInfo)
An abnormality processing function is write, which is MyUnhandledExceptionFilter, Middle parameter pExceptionInfo is such as any exception at this time for transmitting the relevant information of some exceptions.In abnormality processing letter In number, needs the name pipeline created before calling to notify host process, host process is made to know that exception occurs in assisted process.
After writing abnormality processing function, the function of registration abnormity processing function is then write.Windows system also provides Corresponding api function completes abnormal registration: registration abnormity processing function first, so that the process when application program executes When generating abnormal, the exception handling logic write can be just performed.System provides corresponding api function and carrys out registration abnormity processing Function is implemented as follows:
SetUnhandledExceptionFilter(MyUnhandledExceptionFilter);
Wherein API calls SetUnhandledExceptionFilter indicates to be used to register an abnormality processing letter Number, parameter MyUnhandledExceptionFilter is the above-mentioned abnormality processing function write.
After the completion of abnormality processing function registration, i.e., exception handling logic is had registered in Windows system, when using journey Sequence produces exception when executing, then system can go to execute the abnormality processing function registered MyUnhandledExceptionFilter, and handle in the function abnormal.
After assisted process is terminated operation, host process re-creates assisted process and is terminated assisted process to re-execute Executing before for task guarantees continuing to execute for task, the normal operation of application program.
The multi-process management method of the embodiment of the present invention, by creating the name for communicating between host process and assisted process Pipeline, then host process creation name pipeline be written task data, task data by name pipeline be sent to assist into Journey, assisted process task based access control data carry out corresponding task execution, and to task execution after, assisted process call function AtExit completes exiting for itself, and is sent by name pipeline for indicating that task has been finished and assisted process has dropped out Data communicated by the name pipeline created between assisted process and host process to host process, while host process passes through life Name pipeline grasps the execution status of task of assisted process, guarantees the normal of application program under more assisted process operating conditions Operation.
The embodiment of the present invention also provides a kind of storage medium, is stored thereon with computer program, the computer program quilt Processor performs the steps of when executing
Call the CreateNamedPipe function creation in Windows API calls is multiple to be used for host process and auxiliary The name pipeline of interprocess communication, and the corresponding assisted process of each name pipeline;
Host process calls function WriteFile that task data is written in name pipeline, and the task data of write-in is sent out To corresponding assisted process;
Assisted process calls function ReadFile to read task data from name pipeline;
Assisted process task based access control data carry out corresponding task execution, and to task execution after, assisted process tune Exiting for itself is completed with function AtExit, and is sent by name pipeline for indicating that task has been finished and assisted process The data having dropped out are to host process.
Shown in Figure 2, the embodiment of the present invention also provides a kind of electronic equipment, including creating unit 501, writing unit 502, reading unit 503 and execution and notification unit 504.
Creating unit 501 is for calling the CreateNamedPipe function creation in Windows API calls multiple Name pipeline for being communicated between host process and assisted process, and the corresponding assisted process of each name pipeline;Writing unit 502 for driving host process that function WriteFile is called to be written task data in name pipeline, and by the task data of write-in It is sent to corresponding assisted process;Reading unit 503 is for driving assisted process that function ReadFile is called to read from name pipeline Take task data;It executes and notification unit 504 is for driving assisted process task based access control data to carry out the execution of corresponding task, and After task execution, assisted process calls function AtExit to complete exiting for itself, and is used for by name pipeline transmission The data that expression task has been finished and assisted process has dropped out are to host process.
The embodiment of the present invention also provides multi-process management system, including creation module, writing module, read module and execution And notification module.
Creation module is for calling the CreateNamedPipe function creation in Windows API calls is multiple to be used for The name pipeline communicated between host process and assisted process, and the corresponding assisted process of each name pipeline;
Writing module is used to that host process to be driven to call function WriteFile that task data is written in name pipeline, and will The task data of write-in is sent to corresponding assisted process;
Read module is for driving assisted process that function ReadFile is called to read task data from name pipeline;
It executes and notification module is for driving assisted process task based access control data to carry out the execution of corresponding task, and to task After being finished, assisted process calls function AtExit to complete exiting for itself, and is sent by name pipeline for indicating to appoint Business has been finished and data that assisted process has dropped out are to host process.
The multi-process management system of the embodiment of the present invention, by creating the name for communicating between host process and assisted process Pipeline, then host process creation name pipeline be written task data, task data by name pipeline be sent to assist into Journey, assisted process task based access control data carry out corresponding task execution, and to task execution after, assisted process call function AtExit completes exiting for itself, and is sent by name pipeline for indicating that task has been finished and assisted process has dropped out Data communicated by the name pipeline created between assisted process and host process to host process, while host process passes through life Name pipeline grasps the execution status of task of assisted process, guarantees the normal of application program under more assisted process operating conditions Operation.
The present invention is not limited to the above-described embodiments, for those skilled in the art, is not departing from Under the premise of the principle of the invention, several improvements and modifications can also be made, these improvements and modifications are also considered as protection of the invention Within the scope of.The content being not described in detail in this specification belongs to the prior art well known to professional and technical personnel in the field.

Claims (10)

1. a kind of multi-process management method, which comprises the following steps:
Call the CreateNamedPipe function creation in Windows API calls is multiple to be used for host process and assisted process Between the name pipeline that communicates, and the corresponding assisted process of each name pipeline;
Host process calls function WriteFile to be written task data in name pipeline, and the task data of write-in is sent to pair The assisted process answered;
Assisted process calls function ReadFile to read task data from name pipeline;
Assisted process task based access control data carry out corresponding task execution, and to task execution after, assisted process call letter Number AtExit completes exiting for itself, and is sent by name pipeline for indicating that task has been finished and assisted process has been moved back Data out are to host process.
2. a kind of multi-process management method as described in claim 1, it is characterised in that:
Each assisted process is corresponding to execute a task;
The name pipeline also needs incoming name parameter when creating;
Name parameter in incoming name pipeline corresponds to the title of the pending task of assisted process for the name pipeline.
3. a kind of multi-process management method as described in claim 1, which is characterized in that right after the completion of name pipeline creation In host process:
Function ConnectNamedPipe is called to wait the corresponding assisted process connection of the name pipeline;
The connection with host process is completed by name pipeline to assisted process, assisted process is received and is used for by name pipeline transmission Indicate the data of successful connection to host process;
The data for calling function ReadFile to send assisted process are read out;
It calls function WriteFile that task data is written in name pipeline, and the task data of write-in is sent to corresponding auxiliary Help process.
4. a kind of multi-process management method as claimed in claim 3, which is characterized in that right after the completion of name pipeline creation In assisted process:
It calls function CreateFile connection to name pipeline, completes the connection between host process;
The data for indicating successful connection are sent to host process, then function WaitNamedPipe are called to wait host process Accordingly;
Function ReadFile is called to read the task data that host process is written from name pipeline.
5. a kind of multi-process management method as described in claim 1, it is characterised in that: it is complete to be preset with task in the host process At the time, when task data is written in name pipeline in host process, and after the task data of write-in is sent to assisted process, if In the task completion time being preset with, host process do not receive assisted process transmission for indicating that task has been finished and has assisted The data that process has dropped out, then host process calling function TerminateProcess terminates the operation of the assisted process.
6. a kind of multi-process management method as described in claim 1, which is characterized in that this method further include: write for supervising The abnormality processing function of assisted process is controlled, and completes registration of the abnormality processing function in Windows system, when assisted process is held When row task occurs abnormal, abnormality processing function informs that host process, host process call function by sending log TerminateProcess terminates the operation of the assisted process.
7. such as a kind of multi-process management method described in claim 5 or 6, it is characterised in that: when assisted process is terminated operation Afterwards, host process re-creates assisted process to re-execute executing before being terminated assisted process for task.
8. a kind of storage medium, is stored thereon with computer program, which is characterized in that the computer program is executed by processor When perform the steps of
Call the CreateNamedPipe function creation in Windows API calls is multiple to be used for host process and assisted process Between the name pipeline that communicates, and the corresponding assisted process of each name pipeline;
Host process calls function WriteFile to be written task data in name pipeline, and the task data of write-in is sent to pair The assisted process answered;
Assisted process calls function ReadFile to read task data from name pipeline;
Assisted process task based access control data carry out corresponding task execution, and to task execution after, assisted process call letter Number AtExit completes exiting for itself, and is sent by name pipeline for indicating that task has been finished and assisted process has been moved back Data out are to host process.
9. a kind of electronic equipment, characterized in that it comprises:
Creating unit is used to call the CreateNamedPipe function creation in Windows API calls is multiple to be used for The name pipeline communicated between host process and assisted process, and the corresponding assisted process of each name pipeline;
Writing unit is used to that host process to be driven to call function WriteFile that task data is written in name pipeline, and will write The task data entered is sent to corresponding assisted process;
Reading unit is used to drive assisted process that function ReadFile is called to read task data from name pipeline;
Execution and notification unit, the execution for being used to that assisted process task based access control data to be driven to carry out corresponding task, and to task After being finished, assisted process calls function AtExit to complete exiting for itself, and is sent by name pipeline for indicating to appoint Business has been finished and data that assisted process has dropped out are to host process.
10. a kind of multi-process management system characterized by comprising
Creation module is used to call the CreateNamedPipe function creation in Windows API calls is multiple to be used for The name pipeline communicated between host process and assisted process, and the corresponding assisted process of each name pipeline;
Writing module is used to that host process to be driven to call function WriteFile that task data is written in name pipeline, and will write The task data entered is sent to corresponding assisted process;
Read module is used to drive assisted process that function ReadFile is called to read task data from name pipeline;
Execution and notification module, the execution for being used to that assisted process task based access control data to be driven to carry out corresponding task, and to task After being finished, assisted process calls function AtExit to complete exiting for itself, and is sent by name pipeline for indicating to appoint Business has been finished and data that assisted process has dropped out are to host process.
CN201810746906.6A 2018-07-09 2018-07-09 Multi-process management method, storage medium, electronic device and system Active CN109062686B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810746906.6A CN109062686B (en) 2018-07-09 2018-07-09 Multi-process management method, storage medium, electronic device and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810746906.6A CN109062686B (en) 2018-07-09 2018-07-09 Multi-process management method, storage medium, electronic device and system

Publications (2)

Publication Number Publication Date
CN109062686A true CN109062686A (en) 2018-12-21
CN109062686B CN109062686B (en) 2021-04-23

Family

ID=64819739

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810746906.6A Active CN109062686B (en) 2018-07-09 2018-07-09 Multi-process management method, storage medium, electronic device and system

Country Status (1)

Country Link
CN (1) CN109062686B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111147126A (en) * 2019-12-26 2020-05-12 中国人民解放军空军勤务学院 Beidou satellite short message communication data unpacking transmission method
CN113326139A (en) * 2021-06-28 2021-08-31 上海商汤科技开发有限公司 Task processing method, device, equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102355429A (en) * 2011-08-12 2012-02-15 北京思创银联科技股份有限公司 Pipeline-based inter-process message communication method
CN102801961A (en) * 2012-08-21 2012-11-28 北京捷成世纪科技股份有限公司 Multiprocess-based audio/video data processing method and system
CN107526645A (en) * 2017-09-06 2017-12-29 武汉斗鱼网络科技有限公司 A kind of communication optimization method and system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102355429A (en) * 2011-08-12 2012-02-15 北京思创银联科技股份有限公司 Pipeline-based inter-process message communication method
CN102801961A (en) * 2012-08-21 2012-11-28 北京捷成世纪科技股份有限公司 Multiprocess-based audio/video data processing method and system
CN107526645A (en) * 2017-09-06 2017-12-29 武汉斗鱼网络科技有限公司 A kind of communication optimization method and system

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111147126A (en) * 2019-12-26 2020-05-12 中国人民解放军空军勤务学院 Beidou satellite short message communication data unpacking transmission method
CN111147126B (en) * 2019-12-26 2021-11-23 中国人民解放军空军勤务学院 Beidou satellite short message communication data unpacking transmission method
CN113326139A (en) * 2021-06-28 2021-08-31 上海商汤科技开发有限公司 Task processing method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN109062686B (en) 2021-04-23

Similar Documents

Publication Publication Date Title
US8306996B2 (en) Processing model-based commands for distributed applications
CN110806933B (en) Batch task processing method, device, equipment and storage medium
CN107526645B (en) A kind of communication optimization method and system
CN1573697A (en) Apparatus and method for maintaining resource integrity in a software environment
CN112181619B (en) Batch service scheduling method, device, equipment and medium
CN109101342B (en) Distributed job coordination control method and device, computer equipment and storage medium
CN103620561A (en) N-way runtime interoperative debugging
CN109062686A (en) Multi-process management method, storage medium, electronic equipment and system
CN109783199A (en) A kind of virtual machine migration method and device
US7865883B1 (en) Parallel and asynchronous debugger and debugging method for multi-threaded programs
CN113658351B (en) Method and device for producing product, electronic equipment and storage medium
CN116643854A (en) Service arrangement method and device, flow controller and task processor
CN109960571B (en) Multi-module scheduling method, device and system
US8291419B2 (en) Fault tolerant system for execution of parallel jobs
CN109086380A (en) The method and system of compression storage are carried out to historical data
US11023839B2 (en) Workflow integration
US20030212736A1 (en) System and method for activating and pausing a component
US11966566B2 (en) Mapping interactive UI elements to RPA object repositories for RPA development
CN112068871B (en) Electronic device and application management method
US10990357B2 (en) Application build automation
CN109814950B (en) Service scheduling method, device, equipment and computer readable storage medium
CN118069744A (en) Data synchronization method, storage medium and device
CN118409712A (en) RAID card management system, method, equipment, product and medium
US6345312B1 (en) Selectively dummying a data pipe transparent to a writer application
CN117076559A (en) Big data offline processing method and system based on multiple computing engines

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