CN110413386B - Multi-process processing method, device, terminal equipment and computer readable storage medium - Google Patents

Multi-process processing method, device, terminal equipment and computer readable storage medium Download PDF

Info

Publication number
CN110413386B
CN110413386B CN201910565134.0A CN201910565134A CN110413386B CN 110413386 B CN110413386 B CN 110413386B CN 201910565134 A CN201910565134 A CN 201910565134A CN 110413386 B CN110413386 B CN 110413386B
Authority
CN
China
Prior art keywords
sub
executed
main process
task information
main
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
CN201910565134.0A
Other languages
Chinese (zh)
Other versions
CN110413386A (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.)
Shenzhen Futu Network Technology Co Ltd
Original Assignee
Shenzhen Futu 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 Shenzhen Futu Network Technology Co Ltd filed Critical Shenzhen Futu Network Technology Co Ltd
Priority to CN201910565134.0A priority Critical patent/CN110413386B/en
Publication of CN110413386A publication Critical patent/CN110413386A/en
Application granted granted Critical
Publication of CN110413386B publication Critical patent/CN110413386B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores
    • 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
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Computer And Data Communications (AREA)

Abstract

The application provides a multi-process processing method, a device, a terminal device and a computer readable storage medium, wherein the method comprises the following steps: acquiring task information to be executed of a main process; when the task information to be executed meets the set sub-process creation conditions, creating at least one sub-process, wherein the at least one sub-process has a unique sub-process identifier; the main process sends a starting request message to at least one sub-process, wherein the starting request message carries a main process identifier, a sub-process identifier and a sub-task to be executed corresponding to the at least one sub-process; the main process receives a starting response message sent by at least one subprocess and a connection establishment request; the main process sends a response message to at least one sub-process according to the connection establishment request, so that the at least one sub-process loads the corresponding sub-task to be executed according to the received response message. According to the invention, each subtask corresponds to one process, so that the advantages of CPU (Central processing Unit) multi-core can be fully utilized, and the occupation of system resources is solved.

Description

Multi-process processing method, device, terminal equipment and computer readable storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a multi-process processing method, a device, a terminal device, and a computer readable storage medium.
Background
With the rapid development of computer technology, the mainstream configuration of CPU cores of terminal equipment such as computers generally adopts a four-core processor, and the four-core processor has strong data processing capability, so that performance guarantee is provided for multi-thread software of the terminal equipment to simultaneously run multiple tasks, and further the safe and stable running of a system of the terminal equipment is guaranteed.
The stock user downloads and installs the stock software on the terminal device, and checks the stock quotation or the stock trade by opening a panel window of the stock software. As the existing stock software is mostly operated by single thread, when a stock user opens a plurality of panel windows of the stock software, the interface rendering of each panel window is executed in one thread, and as the number of the panel windows opened by the stock user increases, the number of tasks to be executed by each thread increases, so that the resource occupancy rate of a single CPU core increases, and the performance of the stock software is further reduced.
The above description of the process of finding a problem is merely for aiding in understanding the technical solution of the present invention, and does not represent an admission that the above is prior art.
Disclosure of Invention
To solve the above technical problems or at least partially solve the above technical problems, the present application provides a multi-process processing method, apparatus, terminal device, and computer readable storage medium.
In view of this, in a first aspect, the present application provides a multi-process processing method, applied to a terminal, the method including the steps of:
acquiring task information to be executed of a main process;
judging whether the task information to be executed meets a set sub-process creation condition;
when the task information to be executed meets the set sub-process creation conditions, creating at least one sub-process, wherein the at least one sub-process has a unique sub-process identifier; the at least one sub-process is one or more of a plurality of sub-processes;
the main process sends a starting request message to the at least one sub-process, wherein the starting request message carries a main process identifier, the sub-process identifier and a sub-task to be executed corresponding to the at least one sub-process;
the main process receives a starting response message sent by the at least one sub-process and a connection establishment request;
and the main process sends a response message corresponding to the connection establishment request to the at least one sub-process according to the connection establishment request, so that the at least one sub-process loads the corresponding sub-task to be executed according to the received response message.
With reference to the first aspect, in a first possible implementation manner of the first aspect, the task information to be executed includes a number of tasks to be executed, and the determining whether the task information to be executed meets a set sub-process creation condition includes:
judging whether the number of the tasks to be executed is larger than a set threshold value of the tasks to be executed;
and when the number of the tasks to be executed is larger than the set threshold value of the tasks to be executed, determining that the task information to be executed meets the set sub-process creation condition.
With reference to the first aspect, in a second possible implementation manner of the first aspect, before the sending, by the main process, the start request message to the at least one sub-process, the method further includes:
establishing a communication pipeline between the main process and the at least one subprocess according to the main process identification of the main process and the subprocess identification of the at least one subprocess;
and carrying out communication data distribution between the main process and at least one corresponding sub-process by utilizing each communication pipeline, wherein the communication data comprises byte stream data.
With reference to the first aspect, in a third possible implementation manner of the first aspect, the method further includes:
and naming the established communication pipelines according to a preset naming rule.
With reference to the first aspect, in a fourth possible implementation manner of the first aspect, the method further includes:
encrypting the communication data by using a secret key;
the public key of the secret key generates first identification information for the main process, and the main process sends the public key to the at least one sub-process through a shared memory; the public key and the set private key are generated into the secret key by using an MD5 message digest algorithm.
With reference to the first aspect, in a fifth possible implementation manner of the first aspect, the communication data includes public data and/or configuration data stored on a shared memory, and the method further includes:
locking the shared memory by using a mutual exclusion lock;
judging whether the main process and the at least one subprocess simultaneously execute access operation to the public data and/or the configuration data;
if yes, further judging whether the main process or the at least one sub-process has the mutual exclusion lock;
if yes, the main process or the at least one subprocess is utilized to directly access the public data and/or the configuration data, and the mutual exclusion lock is released after the access operation is completed.
In a second aspect, the present application provides a multiprocessing apparatus, the apparatus comprising:
the task information acquisition unit is configured to acquire task information to be executed of the main process;
the judging unit is configured to judge whether the task information to be executed meets a set sub-process creating condition;
a sub-process creation unit configured to create at least one sub-process when the task information to be executed satisfies a set sub-process creation condition, the at least one sub-process having a unique sub-process identifier; the at least one sub-process is one or more of a plurality of sub-processes;
a request message sending unit, configured to send a start request message to the at least one sub-process by using the main process, where the start request message carries a main process identifier, the sub-process identifier, and a sub-task to be executed corresponding to the at least one sub-process;
the receiving unit is configured to receive a starting response message and a connection establishment request sent by the at least one sub-process by the main process;
and the response message sending unit is configured to send a response message corresponding to the connection establishment request to the at least one sub-process according to the connection establishment request, so that the at least one sub-process loads a corresponding sub-task to be executed according to the received response message.
With reference to the second aspect, in a first possible implementation manner of the second aspect, the apparatus further includes:
a communication pipeline establishing unit configured to establish a communication pipeline between the main process and the at least one sub-process according to the main process identifier of the main process and the sub-process identifier of the at least one sub-process;
and the data distribution unit is configured to distribute communication data between the main process and at least one corresponding sub-process by utilizing each communication pipeline, wherein the communication data comprises byte stream data.
In a third aspect, an embodiment of the present invention further provides a mobile terminal, including:
at least one processor, memory, at least one network interface, and a user interface;
the at least one processor, the memory, the at least one network interface, and the user interface are coupled together by a bus system;
the processor is configured to perform the steps of the method according to the first aspect by calling a program or instructions stored in the memory.
In a fourth aspect, an embodiment of the present invention further proposes a computer readable storage medium, on which a multi-process processing program is stored, which when executed by a processor implements the steps of the method according to the first aspect.
Compared with the prior art, the technical scheme provided by the embodiment of the application has the following advantages:
the embodiment of the application provides a multi-process processing method, a device, a terminal device and a computer readable storage medium, which are applied to a terminal, wherein the method comprises the following steps: acquiring task information to be executed of a main process; judging whether the task information to be executed meets a set sub-process creation condition; when the task information to be executed meets the set sub-process creation conditions, creating at least one sub-process, wherein the at least one sub-process has a unique sub-process identifier; the at least one sub-process is one or more of a plurality of sub-processes; the main process sends a starting request message to the at least one sub-process, wherein the starting request message carries a main process identifier, the sub-process identifier and a sub-task to be executed corresponding to the at least one sub-process; the main process receives a starting response message sent by the at least one sub-process and a connection establishment request; and the main process sends a response message corresponding to the connection establishment request to the at least one sub-process according to the connection establishment request, so that the at least one sub-process loads the corresponding sub-task to be executed according to the received response message. The invention can optimize performance aiming at scenes that a plurality of panel windows are opened on a plurality of screens by stock users, each subtask corresponds to one process, namely, each independent panel window corresponds to one process, the advantages of CPU multi-core can be fully utilized, and meanwhile, the occupation of other system resources such as memory, handles and the like is also shared.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
In order to more clearly illustrate the embodiments of the invention or the technical solutions of the prior art, the drawings which are used in the description of the embodiments or the prior art will be briefly described, and it will be obvious to a person skilled in the art that other drawings can be obtained from these drawings without inventive effort.
FIG. 1 is a flow chart of a multi-process processing method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a multi-process processing apparatus according to an embodiment of the present invention;
fig. 3 is a block diagram of a mobile terminal according to an embodiment of the present invention.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
In the following description, suffixes such as "module", "component", or "unit" for representing elements are used only for facilitating the description of the present invention, and have no specific meaning per se. Thus, "module," "component," or "unit" may be used in combination.
The terminal may be implemented in various forms. For example, the terminals described in the present invention may include mobile terminals such as cell phones, tablet computers, notebook computers, palm computers, personal digital assistants (Personal Digital Assistant, PDA), portable media players (Portable Media Player, PMP), and fixed terminals such as digital TV, desktop computers, and the like.
The following description will be given taking a mobile terminal as an example, and those skilled in the art will understand that the configuration according to the embodiment of the present invention can be applied to a fixed type terminal in addition to elements particularly used for a moving purpose.
Referring to fig. 1, fig. 1 is a multi-process processing method provided in an embodiment of the present invention, which is applied to a terminal, and includes the following steps S101 to S106:
s101, acquiring task information to be executed of a main process.
The task information to be executed in the embodiment of the application is panel window information needing to be operated by the main process, and the task information to be executed includes the number of tasks to be executed, namely the number of panel windows needing to be operated by the main process.
S102, judging whether the task information to be executed meets the set sub-process creation condition.
In this embodiment of the present application, the task information to be executed includes the number of tasks to be executed, and determining whether the task information to be executed meets a set sub-process creation condition includes: judging whether the number of the tasks to be executed is larger than a set threshold value of the tasks to be executed; and when the number of the tasks to be executed is larger than the set threshold value of the tasks to be executed, determining that the information of the tasks to be executed meets the set sub-process creation condition.
S103, when the task information to be executed meets the set sub-process creation conditions, creating at least one sub-process, wherein the at least one sub-process has a unique sub-process identifier; the at least one sub-process is one or more of a plurality of sub-processes.
When the main process is used for independently opening the panel window, a sub-process is newly established to load the panel window, if a plurality of panel windows need to be operated, each panel window which is independently opened from the main process is newly established to load the panel window, business logic and data of each sub-process are relatively independent, and the main process and the sub-process are only different in display panel window, so that the multi-process transformation cost is greatly reduced.
Meanwhile, when a sub-process is newly built, a sub-process identifier (i.e. an ID of the sub-process) of the sub-process is recorded, and the sub-process identifier is used for the communication between the main process and the corresponding sub-process. Only the main process needs to establish network connection with the server, other sub-processes send and receive communication data through the main process, the communication data can be synchronized at a network layer, and the following two conditions are included according to different types of the communication data:
in the first case, when the communication data sent by the server is push protocol data, because the push protocol data does not relate to request operation, and all the sub-processes need to receive the push protocol data in real time, the main process directly distributes the received push protocol data to all the sub-processes after receiving the push protocol data.
For example, the sub-process includes sub-process 1, sub-process 2 and sub-process 3, and the main process distributes the received push protocol data to sub-process 1, sub-process 2 and sub-process 3 in real time.
In the second case, when the communication data is request response protocol data, since the packet of the request response protocol data is generally associated with the request response protocol data, and other sub-processes do not have the request response protocol data of the sub-process initiating the request, the packet of the protocol data is sent to the corresponding sub-process only for processing after the main process receives the packet of the protocol data.
For example, the sub-process includes a sub-process 1, a sub-process 2, and a sub-process 3, and when the sub-process 1 requests K-wire data of a certain stock, the execution flow is: the subprocess 1 sets a unique request serial number x for the protocol data of the request K line data and sends the protocol data to the main process; after the main process receives the protocol data of the sub-process 1, the main process sends the protocol data to a server, generates a sequence number y of a network request, and records the corresponding relation between y and (the sub-process 1, the request sequence number x); when the main process receives the back packet of the server, the corresponding relation (the sub-process 1 and the request sequence number x) recorded before is obtained through the network request sequence number y of the back packet, and the back packet and the request sequence number x are sent to the sub-process 1; when the sub-process 1 receives the callback packet and the request sequence number x, the callback packet can be analyzed and the callback packet can be called back to the service layer for processing; in this process, the other sub-processes do not receive the above-mentioned return packet sent by the main process.
S104, the main process sends a starting request message to at least one sub-process, wherein the starting request message carries a main process identifier, a sub-process identifier and a sub-task to be executed corresponding to the at least one sub-process.
In this embodiment, before the main process sends the request message to the at least one sub-process, the method further includes: establishing a communication pipeline between the main process and at least one subprocess according to the main process identifier of the main process and the subprocess identifier of the at least one subprocess; and carrying out communication data distribution between the main process and at least one corresponding sub-process by utilizing each communication pipeline, wherein the communication data comprises byte stream data.
In the embodiment of the application, naming is performed on each established communication pipeline according to a preset naming rule. The preset naming rule is the naming of the corresponding communication pipeline between the main process and the sub-process generated according to the main process identification and each sub-process identification.
In the embodiment of the application, the communication data is encrypted by using the secret key; the public key of the secret key is used for generating first identification information for a main process, and the main process sends the public key to at least one sub-process through a shared memory; the public key and the set private key are used to generate a secret key using the MD5 message digest algorithm.
In an embodiment of the present application, the communication data includes public data and/or configuration data stored in a shared memory, and the method further includes: locking the shared memory by using the mutual exclusion lock; judging whether the main process and at least one subprocess simultaneously execute access operation to public data and/or configuration data; if yes, further judging whether the main process or at least one sub-process has a mutual exclusion lock; if yes, the main process or at least one sub-process is utilized to directly access the public data and/or the configuration data, and the mutual exclusion lock is released after the access operation is completed.
In the embodiment of the application, the shared memory allows multiple processes to access the same memory block, namely, the main process and the sub-process can read and write the common data and/or the configuration data at the same time, and in order to avoid access conflict, the application performs mutex locking processing aiming at read and write operation.
S105, the main process receives a starting response message sent by at least one sub-process and a connection establishment request.
After receiving the startup response message sent by the subprocess, the main process indicates that the subprocess opens the subprocess, at the moment, the panel window interface of the subprocess is temporarily hidden, the panel window interface can be displayed only by establishing connection between the subprocess and the main process, and after the subprocess opens, a connection establishment request is sent to the main process.
S106, the main process sends a response message corresponding to the connection establishment request to at least one sub-process according to the connection establishment request, so that the at least one sub-process loads the corresponding sub-task to be executed according to the received response message.
When the subprocess is opened, a subtask to be executed, which is sent to the subprocess, carries a panel window layout key which needs to be opened by the subprocess, the subprocess temporarily hides the panel window interface after being started, obtains the name of a communication pipeline which is used for distributing communication data with the main process through a main process identifier and a preset naming rule in a received starting request message, establishes the communication pipeline with the main process, names the communication pipeline according to the obtained name, sends a connection establishment request to the main process through the communication pipeline, sends initialization data which are acquired by the main process to the subprocess when the main process receives the connection establishment request sent by the subprocess, wherein the initialization data comprise but are not limited to account information and stock market information, considers that the connection establishment with the main process is successful after the subprocess receives the initialization data returned by the main process, opens a corresponding panel window according to the panel window layout key received during the starting, and displays the panel window interface.
According to the method and the device, performance optimization can be performed on scenes that a plurality of panel windows are opened on a plurality of screens by stock users, each subtask corresponds to one process, namely, each independent panel window corresponds to one process, the advantages of CPU multi-core can be fully utilized, meanwhile, occupation of other system resources such as memory and handles is shared, and performance of stock software is improved.
Referring to fig. 2, an embodiment of the present application further provides a multiprocessing apparatus, including:
a task information acquisition unit 11 configured to acquire task information to be executed of a main process;
a judging unit 12 configured to judge whether the task information to be executed satisfies a set sub-process creation condition;
a sub-process creation unit 13 configured to create at least one sub-process when the task information to be executed satisfies a set sub-process creation condition, the at least one sub-process having a unique sub-process identification; the at least one sub-process is one or more of a plurality of sub-processes;
a request message sending unit 14, configured to send a start request message to the at least one sub-process by using the main process, where the start request message carries a main process identifier, the sub-process identifier, and a sub-task to be executed corresponding to the at least one sub-process;
a receiving unit 15, configured to receive, by the main process, a startup response message and a connection establishment request sent by the at least one sub-process;
and a response message sending unit 16, configured to send, by the main process according to the connection establishment request, a response message corresponding to the connection establishment request to the at least one sub-process, so that the at least one sub-process loads a corresponding sub-task to be executed according to the received response message.
In another embodiment of the present application, the apparatus further comprises:
a communication pipe establishing unit (not shown in the figure) configured to establish a communication pipe between the main process and the at least one sub-process according to a main process identifier of the main process and a sub-process identifier of the at least one sub-process;
a data distribution unit (not shown in the figure) configured to perform communication data distribution between the main process and the corresponding at least one sub-process using each of the communication pipes, the communication data including byte stream data.
The embodiments of the present application further provide a computer readable storage medium, where a multi-process processing program is stored, where the multi-process processing program, when executed by a processor, implements steps of a multi-process processing method as shown in each method embodiment, for example, includes:
acquiring task information to be executed of a main process;
judging whether the task information to be executed meets a set sub-process creation condition;
when the task information to be executed meets the set sub-process creation conditions, creating at least one sub-process, wherein the at least one sub-process has a unique sub-process identifier; the at least one sub-process is one or more of a plurality of sub-processes;
the main process sends a starting request message to the at least one sub-process, wherein the starting request message carries a main process identifier, the sub-process identifier and a sub-task to be executed corresponding to the at least one sub-process;
the main process receives a starting response message sent by the at least one sub-process and a connection establishment request;
and the main process sends a response message corresponding to the connection establishment request to the at least one sub-process according to the connection establishment request, so that the at least one sub-process loads the corresponding sub-task to be executed according to the received response message.
Fig. 3 is a schematic structural diagram of a mobile terminal according to another embodiment of the present invention. The mobile terminal 300 shown in fig. 3 includes: at least one processor 301, a memory 302, at least one network interface 304, and other user interfaces 303. The various components in the mobile terminal 300 are coupled together by a bus system 305. It is understood that the bus system 305 is used to enable connected communications between these components. The bus system 305 includes a power bus, a control bus, and a status signal bus in addition to the data bus. But for clarity of illustration the various buses are labeled as bus system 305 in fig. 3.
The user interface 303 may include, among other things, a display, a keyboard, or a pointing device (e.g., a mouse, a trackball, a touch pad, or a touch screen, etc.).
It will be appreciated that the memory 302 in embodiments of the invention can be either volatile memory or nonvolatile memory, or can include both volatile and nonvolatile memory. The non-volatile memory may be a Read-only memory (ROM), a programmable Read-only memory (ProgrammableROM, PROM), an erasable programmable Read-only memory (ErasablePROM, EPROM), an electrically erasable programmable Read-only memory (ElectricallyEPROM, EEPROM), or a flash memory, among others. The volatile memory may be a random access memory (RandomAccessMemory, RAM) that acts as an external cache. By way of example, and not limitation, many forms of RAM are available, such as Static RAM (SRAM), dynamic random access memory (DynamicRAM, DRAM), synchronous dynamic random access memory (SynchronousDRAM, SDRAM), double data rate synchronous dynamic random access memory (ddr SDRAM), enhanced Synchronous Dynamic Random Access Memory (ESDRAM), synchronous link dynamic random access memory (SynchlinkDRAM, SLDRAM), and direct memory bus random access memory (DirectRambusRAM, DRRAM). The memory 302 described herein is intended to comprise, without being limited to, these and any other suitable types of memory.
In some implementations, the memory 302 stores the following elements, executable units or data structures, or a subset thereof, or an extended set thereof: an operating system 3021 and application programs 3022.
The operating system 3021 includes various system programs, such as a framework layer, a core library layer, a driver layer, and the like, for implementing various basic services and processing hardware-based tasks. The application 3022 includes various application programs such as a media player (MediaPlayer), a Browser (Browser), and the like for realizing various application services. The program for implementing the method of the embodiment of the present invention may be included in the application program 3022.
In the embodiment of the present invention, the processor 301 is configured to execute the method steps provided by the method embodiments by calling a program or an instruction stored in the memory 302, specifically, a program or an instruction stored in the application program 3022, for example, including:
acquiring task information to be executed of a main process;
judging whether the task information to be executed meets a set sub-process creation condition;
when the task information to be executed meets the set sub-process creation conditions, creating at least one sub-process, wherein the at least one sub-process has a unique sub-process identifier; the at least one sub-process is one or more of a plurality of sub-processes;
the main process sends a starting request message to the at least one sub-process, wherein the starting request message carries a main process identifier, the sub-process identifier and a sub-task to be executed corresponding to the at least one sub-process;
the main process receives a starting response message sent by the at least one sub-process and a connection establishment request;
and the main process sends a response message corresponding to the connection establishment request to the at least one sub-process according to the connection establishment request, so that the at least one sub-process loads the corresponding sub-task to be executed according to the received response message.
The method disclosed in the above embodiment of the present invention may be applied to the processor 301 or implemented by the processor 301. The processor 301 may be an integrated circuit chip with signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuitry of hardware in the processor 301 or instructions in the form of software. The processor 301 may be a general purpose processor, a digital signal processor (DigitalSignalProcessor, DSP), an application specific integrated circuit (application specific IntegratedCircuit, ASIC), an off-the-shelf programmable gate array (FieldProgrammableGateArray, FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component. The disclosed methods, steps, and logic blocks in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present invention may be embodied directly in the execution of a hardware decoding processor, or in the execution of a combination of hardware and software elements in a decoding processor. The software elements may be located in a random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, registers, etc. as well known in the art. The storage medium is located in a memory 302 and the processor 301 reads the information in the memory 302 and in combination with its hardware performs the steps of the above method.
It is to be understood that the embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For a hardware implementation, the processing units may be implemented within one or more application specific integrated circuits (ApplicationSpecificIntegratedCircuits, ASIC), digital signal processors (DigitalSignalProcessing, DSP), digital signal processing devices (dspev), programmable logic devices (ProgrammableLogicDevice, PLD), field programmable gate arrays (Field-ProgrammableGateArray, FPGA), general purpose processors, controllers, micro-controllers, microprocessors, other electronic units configured to perform the functions described herein, or a combination thereof.
For a software implementation, the techniques described herein may be implemented by means of units that perform the functions described herein. The software codes may be stored in a memory and executed by a processor. The memory may be implemented within the processor or external to the processor.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) comprising instructions for causing a terminal (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the method according to the embodiments of the present invention.
The embodiments of the present invention have been described above with reference to the accompanying drawings, but the present invention is not limited to the above-described embodiments, which are merely illustrative and not restrictive, and many forms may be made by those having ordinary skill in the art without departing from the spirit of the present invention and the scope of the claims, which are to be protected by the present invention.

Claims (10)

1. A multi-process processing method, applied to a terminal, comprising the steps of:
acquiring task information to be executed of a main process, wherein the task information to be executed is panel window information required to be operated by the main process;
judging whether the task information to be executed meets a set sub-process creation condition;
when the task information to be executed meets the set sub-process creation conditions, creating at least one sub-process, wherein the at least one sub-process has a unique sub-process identifier; the at least one sub-process is one or more of a plurality of sub-processes, and the sub-process identification is used for the communication between the main process and the corresponding sub-process;
the main process sends a starting request message to the at least one sub-process, wherein the starting request message carries a main process identifier, the sub-process identifier and a sub-task to be executed corresponding to the at least one sub-process;
the main process receives a starting response message sent by the at least one sub-process and a connection establishment request;
and the main process sends a response message corresponding to the connection establishment request to the at least one sub-process according to the connection establishment request, so that the at least one sub-process loads the corresponding sub-task to be executed according to the received response message.
2. The method according to claim 1, wherein the task information to be executed includes a number of tasks to be executed, and the determining whether the task information to be executed satisfies a set sub-process creation condition includes:
judging whether the number of the tasks to be executed is larger than a set threshold value of the tasks to be executed;
and when the number of the tasks to be executed is larger than the set threshold value of the tasks to be executed, determining that the task information to be executed meets the set sub-process creation condition.
3. The method of claim 1, wherein before the main process sends the start request message to the at least one sub-process, further comprising:
establishing a communication pipeline between the main process and the at least one subprocess according to the main process identification of the main process and the subprocess identification of the at least one subprocess;
and carrying out communication data distribution between the main process and at least one corresponding sub-process by utilizing each communication pipeline, wherein the communication data comprises byte stream data.
4. A method according to claim 3, characterized in that the method further comprises:
and naming the established communication pipelines according to a preset naming rule.
5. A method according to claim 3, characterized in that the method further comprises:
encrypting the communication data by using a secret key;
the public key of the secret key generates first identification information for the main process, and the main process sends the public key to the at least one sub-process through a shared memory; the public key and the set private key are generated into the secret key by using an MD5 message digest algorithm.
6. A method according to claim 3, wherein the communication data comprises public data and/or configuration data stored on a shared memory, the method further comprising:
locking the shared memory by using a mutual exclusion lock;
judging whether the main process and the at least one subprocess simultaneously execute access operation to the public data and/or the configuration data;
if yes, further judging whether the main process or the at least one sub-process has the mutual exclusion lock;
if yes, the main process or the at least one subprocess is utilized to directly access the public data and/or the configuration data, and the mutual exclusion lock is released after the access operation is completed.
7. A multiprocessing apparatus, the apparatus comprising:
the task information acquisition unit is configured to acquire task information to be executed of the main process, wherein the task information to be executed is panel window information which needs to be operated by the main process;
the judging unit is configured to judge whether the task information to be executed meets a set sub-process creating condition;
a sub-process creation unit configured to create at least one sub-process when the task information to be executed satisfies a set sub-process creation condition, the at least one sub-process having a unique sub-process identifier; the at least one sub-process is one or more of a plurality of sub-processes, and the sub-process identification is used for the communication between the main process and the corresponding sub-process;
a request message sending unit, configured to send a start request message to the at least one sub-process by using the main process, where the start request message carries a main process identifier, the sub-process identifier, and a sub-task to be executed corresponding to the at least one sub-process;
the receiving unit is configured to receive a starting response message and a connection establishment request sent by the at least one sub-process by the main process;
and the response message sending unit is configured to send a response message corresponding to the connection establishment request to the at least one sub-process according to the connection establishment request, so that the at least one sub-process loads a corresponding sub-task to be executed according to the received response message.
8. The apparatus of claim 7, wherein the apparatus further comprises:
a communication pipeline establishing unit configured to establish a communication pipeline between the main process and the at least one sub-process according to the main process identifier of the main process and the sub-process identifier of the at least one sub-process;
and the data distribution unit is configured to distribute communication data between the main process and at least one corresponding sub-process by utilizing each communication pipeline, wherein the communication data comprises byte stream data.
9. A terminal device, characterized in that the terminal device comprises: at least one processor, memory, at least one network interface, and a user interface;
the at least one processor, the memory, the at least one network interface, and the user interface are coupled together by a bus system;
the processor is configured to execute the steps of the multiprocessing method according to any one of claims 1 to 6 by calling a program or instructions stored in the memory.
10. A computer readable storage medium, wherein a multi-process processing program is stored on the computer readable storage medium, which when executed by a processor, implements the steps of the multi-process processing method according to any one of claims 1 to 6.
CN201910565134.0A 2019-06-27 2019-06-27 Multi-process processing method, device, terminal equipment and computer readable storage medium Active CN110413386B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910565134.0A CN110413386B (en) 2019-06-27 2019-06-27 Multi-process processing method, device, terminal equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910565134.0A CN110413386B (en) 2019-06-27 2019-06-27 Multi-process processing method, device, terminal equipment and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN110413386A CN110413386A (en) 2019-11-05
CN110413386B true CN110413386B (en) 2023-06-30

Family

ID=68358374

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910565134.0A Active CN110413386B (en) 2019-06-27 2019-06-27 Multi-process processing method, device, terminal equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN110413386B (en)

Families Citing this family (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111124685A (en) * 2019-12-26 2020-05-08 神州数码医疗科技股份有限公司 Big data processing method and device, electronic equipment and storage medium
CN111638952B (en) * 2020-05-09 2024-08-06 北京达佳互联信息技术有限公司 Memory dump method and device and electronic equipment
CN111625326B (en) * 2020-05-13 2023-06-27 北京字节跳动网络技术有限公司 Task pipeline execution method and device and electronic equipment
CN113760561B (en) * 2020-06-17 2024-10-18 北京沃东天骏信息技术有限公司 Data processing method and device
CN111752435B (en) * 2020-06-24 2021-07-16 北京小鸟科技股份有限公司 Multimedia and multi-file multimedia real-time rendering method, system and device
CN111831353B (en) * 2020-07-09 2024-02-20 平行云科技(北京)有限公司 Operation library based on OpenXR standard, data interaction method, device and medium
CN111711562A (en) * 2020-07-16 2020-09-25 网易(杭州)网络有限公司 Message processing method and device, computer storage medium and electronic equipment
CN112286656B (en) * 2020-10-21 2023-08-29 百度在线网络技术(北京)有限公司 Applet simulation method, apparatus, electronic device, and computer-readable storage medium
CN112714350A (en) * 2020-12-21 2021-04-27 北京飞讯数码科技有限公司 Message processing method, device, equipment and storage medium
CN112737760B (en) * 2020-12-22 2023-01-10 航天信息股份有限公司 Method and system for duplex data communication based on pipeline communication technology
CN112561371B (en) * 2020-12-23 2024-03-01 上海乐享似锦科技股份有限公司 Scheduling determination method and device, electronic equipment and storage medium
CN112783674A (en) * 2021-01-29 2021-05-11 北京金山云网络技术有限公司 Configuration management method, device, equipment and medium
CN113326139B (en) * 2021-06-28 2024-07-16 上海商汤科技开发有限公司 Task processing method, device, equipment and storage medium
CN114356446B (en) * 2021-12-27 2023-08-22 湖北天融信网络安全技术有限公司 Processing method, device, equipment and storage medium for inter-process event
CN114296965A (en) * 2021-12-29 2022-04-08 北京市商汤科技开发有限公司 Feature retrieval method, feature retrieval device, electronic equipment and computer storage medium
CN115129469B (en) * 2022-06-23 2023-04-21 北京新唐思创教育科技有限公司 Cross-process communication method, device, equipment and storage medium
CN115934361B (en) * 2023-02-01 2023-06-23 天翼云科技有限公司 Optimization method of local domain name system server and related equipment

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103631664A (en) * 2013-12-09 2014-03-12 北京奇虎科技有限公司 Inter-process communication method and device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8990812B2 (en) * 2008-07-07 2015-03-24 Infosys Limited Task decomposition with throttled message processing in a heterogeneous environment
CN103645939B (en) * 2013-11-29 2018-03-27 北京奇虎科技有限公司 A kind of method and system of picture crawl
US10289446B1 (en) * 2015-09-15 2019-05-14 Amazon Technologies, Inc. Preserving web browser child processes by substituting a parent process with a stub process

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103631664A (en) * 2013-12-09 2014-03-12 北京奇虎科技有限公司 Inter-process communication method and device

Also Published As

Publication number Publication date
CN110413386A (en) 2019-11-05

Similar Documents

Publication Publication Date Title
CN110413386B (en) Multi-process processing method, device, terminal equipment and computer readable storage medium
US10614212B1 (en) Secure software containers
CN110389936B (en) Method, equipment and computer storage medium for starting small program
US20110289499A1 (en) Techniques to automatically update software applications
CN110377369B (en) Method, device and computer storage medium for running small program
WO2021013242A1 (en) Method for starting mini program, device and computer storage medium
CN111782304B (en) Paging loading data logic control method, device, computer equipment and medium
CN111079125A (en) Method and device for calling third-party library dynamic lifting authority by application program
CN113873004B (en) Task execution method and device and distributed computing system
WO2021088671A1 (en) Method for calling terminal capability, device, and computer storage medium
WO2022156087A1 (en) Data blood relationship establishing method and apparatus, computer device, and storage medium
CN115567594A (en) Microservice request processing method, microservice request processing device, computer equipment and storage medium
CN113132400B (en) Business processing method, device, computer system and storage medium
CN116069493A (en) Data processing method, device, equipment and readable storage medium
US20180006809A1 (en) Data security in a cloud network
US20060195586A1 (en) Sessions and terminals configured for binding in an extensible manner
CN114707179B (en) Resource authorization method and device of cluster system, medium and electronic equipment
CN115277857A (en) Method and device for interface verification, electronic equipment and storage medium
CN111562968B (en) Method, device, equipment and medium for realizing management of ICS (Internet connection sharing) to Kata container
CN110249305A (en) Shell operation browser extension when browser crash or hang-up
JP2008269113A (en) Application execution environment construction system, device and method used for it, and program therefor
CN104898929A (en) Method and system for realizing application mobility in management information system
CN113032039B (en) Plug-in transformation method and device for application, electronic equipment and storage medium
US20240223509A1 (en) System and method for ensuring continuity of proxy-based service
US20240356860A1 (en) System and method for ensuring continuity of proxy-based service

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