CN115129469B - Cross-process communication method, device, equipment and storage medium - Google Patents
Cross-process communication method, device, equipment and storage medium Download PDFInfo
- Publication number
- CN115129469B CN115129469B CN202210719357.XA CN202210719357A CN115129469B CN 115129469 B CN115129469 B CN 115129469B CN 202210719357 A CN202210719357 A CN 202210719357A CN 115129469 B CN115129469 B CN 115129469B
- Authority
- CN
- China
- Prior art keywords
- sub
- target task
- execution result
- inter
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 770
- 238000004891 communication Methods 0.000 title claims abstract description 162
- 230000008569 process Effects 0.000 claims abstract description 201
- 238000004590 computer program Methods 0.000 claims description 18
- 230000004044 response Effects 0.000 claims description 12
- 238000009434 installation Methods 0.000 claims description 10
- 230000006870 function Effects 0.000 description 16
- 238000012545 processing Methods 0.000 description 16
- 238000010586 diagram Methods 0.000 description 8
- 230000003287 optical effect Effects 0.000 description 4
- 230000000694 effects Effects 0.000 description 3
- 230000009471 action Effects 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000013473 artificial intelligence Methods 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 230000010267 cellular communication Effects 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 230000001419 dependent effect Effects 0.000 description 1
- 238000000605 extraction Methods 0.000 description 1
- 230000002452 interceptive effect Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000010801 machine learning Methods 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 230000001953 sensory effect Effects 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/546—Message passing systems or structures, e.g. queues
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/54—Indexing scheme relating to G06F9/54
- G06F2209/547—Messaging middleware
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE 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/00—Energy 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)
- Computer And Data Communications (AREA)
Abstract
Description
技术领域technical field
本公开涉及通信技术领域,尤其涉及一种跨进程通信方法、装置、设备及存储介质。The present disclosure relates to the technical field of communication, and in particular to a cross-process communication method, device, device and storage medium.
背景技术Background technique
进程可以是一个具有独立功能的程序关于某个数据集合的一次运行活动。为了使得不同应用程序之间传播或交换信息,不同应用程序需要通过各自对应的进程进行通信,从而实现跨进程通信。A process can be a running activity of a program with independent functions on a certain data set. In order to propagate or exchange information between different application programs, different application programs need to communicate through their corresponding processes, thereby realizing cross-process communication.
然而,随着用户需求不断更新,终端设备上运行的应用程序的数量也越来越多。因此,针对多个应用程序对应的多个进程,提供一种跨进程通信方式是目前亟需解决的技术问题。However, as user requirements are continuously updated, the number of application programs running on terminal devices is also increasing. Therefore, providing a cross-process communication method for multiple processes corresponding to multiple application programs is an urgent technical problem to be solved at present.
发明内容Contents of the invention
为了解决上述技术问题,本公开提供了一种跨进程通信方法、装置、设备及存储介质。In order to solve the above technical problems, the present disclosure provides a cross-process communication method, device, device and storage medium.
第一方面,本公开提供了一种跨进程通信方法,该方法包括:In a first aspect, the present disclosure provides a cross-process communication method, the method comprising:
利用主进程通过进程间通信方式,接收第一子进程发送的子进程依赖请求;Using the main process to receive the sub-process dependency request sent by the first sub-process through inter-process communication;
利用所述主进程基于所述子进程依赖请求,控制至少一个第二子进程执行所述子进程依赖请求对应的目标任务,得到所述目标任务对应的执行结果;Using the main process to control at least one second sub-process to execute a target task corresponding to the sub-process dependency request based on the sub-process dependency request, and obtain an execution result corresponding to the target task;
利用所述主进程通过所述进程间通信方式,将所述目标任务对应的执行结果反馈至所述第一子进程。Using the main process to feed back the execution result corresponding to the target task to the first sub-process through the inter-process communication manner.
第二方面,本公开提供了一种跨进程通信装置,该装置包括:In a second aspect, the present disclosure provides a device for cross-process communication, which includes:
子进程依赖请求接收模块,用于利用主进程通过进程间通信方式,接收第一子进程发送的子进程依赖请求;The sub-process dependency request receiving module is used for receiving the sub-process dependency request sent by the first sub-process through the inter-process communication mode by the main process;
控制模块,用于利用所述主进程基于所述子进程依赖请求,控制至少一个第二子进程执行所述子进程依赖请求对应的目标任务,得到所述目标任务对应的执行结果;A control module, configured to use the main process to control at least one second sub-process to execute a target task corresponding to the sub-process dependency request based on the sub-process dependency request, and obtain an execution result corresponding to the target task;
执行结果反馈模块,用于利用所述主进程通过所述进程间通信方式,将所述目标任务对应的执行结果反馈至所述第一子进程。The execution result feedback module is configured to use the main process to feed back the execution result corresponding to the target task to the first sub-process through the inter-process communication method.
第三方面,本公开实施例还提供了一种跨进程通信设备,该设备包括:In a third aspect, an embodiment of the present disclosure further provides a cross-process communication device, the device including:
处理器;processor;
存储器,用于存储可执行指令;memory for storing executable instructions;
其中,处理器用于从存储器中读取可执行指令,并执行可执行指令以实现上述第一方面所提供的跨进程通信方法。Wherein, the processor is configured to read executable instructions from the memory, and execute the executable instructions to implement the cross-process communication method provided by the first aspect above.
第四方面,本公开实施例还提供了一种计算机可读存储介质,其上存储有计算机程序,其中,存储介质存储有计算机程序,当计算机程序被处理器执行时,使得处理器实现上述第一方面所提供的跨进程通信方法。In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium on which a computer program is stored, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the processor is enabled to implement the above-mentioned first On the one hand, the cross-process communication method provided.
本公开实施例提供的技术方案与现有技术相比具有如下优点:Compared with the prior art, the technical solutions provided by the embodiments of the present disclosure have the following advantages:
本公开实施例的一种跨进程通信方法、装置、设备及存储介质,能够利用主进程通过进程间通信方式,接收第一子进程发送的子进程依赖请求;然后利用主进程基于子进程依赖请求,控制至少一个第二子进程执行子进程依赖请求对应的目标任务,得到目标任务对应的执行结果;进而利用主进程通过所述进程间通信方式,将目标任务对应的执行结果反馈至所述第一子进程。由此,能够通过主进程对多个子进程之间的跨进程通信进行管理,这样,能够保证子进程与主进程之间的跨进程通信,也能够保证子进程与子进程之间的跨进程通信,也就是保证了各个进程之间能够进行有效的跨进程通信。A cross-process communication method, device, device, and storage medium in the embodiments of the present disclosure can use the main process to receive the sub-process dependency request sent by the first sub-process through inter-process communication; then use the main process to base the sub-process dependency request , controlling at least one second sub-process to execute the target task corresponding to the sub-process dependency request, to obtain the execution result corresponding to the target task; and then using the main process to feed back the execution result corresponding to the target task to the second sub-process through the inter-process communication method a child process. Therefore, the cross-process communication between multiple sub-processes can be managed through the main process, so that the cross-process communication between the sub-process and the main process can be guaranteed, and the cross-process communication between the sub-processes can also be guaranteed , that is, to ensure effective cross-process communication between processes.
附图说明Description of drawings
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本公开的实施例,并与说明书一起用于解释本公开的原理。The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description serve to explain the principles of the disclosure.
为了更清楚地说明本公开实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,对于本领域普通技术人员而言,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, In other words, other drawings can also be obtained from these drawings without paying creative labor.
图1为本公开实施例提供的一种跨进程通信方法的流程示意图;FIG. 1 is a schematic flowchart of a cross-process communication method provided by an embodiment of the present disclosure;
图2为本公开实施例提供的另一种跨进程通信方法的流程示意图;FIG. 2 is a schematic flowchart of another cross-process communication method provided by an embodiment of the present disclosure;
图3为本公开实施例提供的又一种跨进程通信方法的流程示意图;FIG. 3 is a schematic flowchart of another cross-process communication method provided by an embodiment of the present disclosure;
图4为本公开实施例提供的一种跨进程通信方法的逻辑示意图;FIG. 4 is a logical schematic diagram of a cross-process communication method provided by an embodiment of the present disclosure;
图5为本公开实施例提供的一种跨进程通信装置的结构示意图;FIG. 5 is a schematic structural diagram of a cross-process communication device provided by an embodiment of the present disclosure;
图6为本公开实施例提供的一种跨进程通信设备的结构示意图。FIG. 6 is a schematic structural diagram of a cross-process communication device provided by an embodiment of the present disclosure.
具体实施方式Detailed ways
下面将参照附图更详细地描述本公开的实施例。虽然附图中显示了本公开的某些实施例,然而应当理解的是,本公开可以通过各种形式来实现,而且不应该被解释为限于这里阐述的实施例,相反提供这些实施例是为了更加透彻和完整地理解本公开。应当理解的是,本公开的附图及实施例仅用于示例性作用,并非用于限制本公开的保护范围。Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the drawings, it should be understood that the disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein; A more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for exemplary purposes only, and are not intended to limit the protection scope of the present disclosure.
应当理解,本公开的方法实施方式中记载的各个步骤可以按照不同的顺序执行,和/或并行执行。此外,方法实施方式可以包括附加的步骤和/或省略执行示出的步骤。本公开的范围在此方面不受限制。It should be understood that the various steps described in the method implementations of the present disclosure may be executed in different orders, and/or executed in parallel. Additionally, method embodiments may include additional steps and/or omit performing illustrated steps. The scope of the present disclosure is not limited in this respect.
本文使用的术语“包括”及其变形是开放性包括,即“包括但不限于”。术语“基于”是“至少部分地基于”。术语“一个实施例”表示“至少一个实施例”;术语“另一实施例”表示“至少一个另外的实施例”;术语“一些实施例”表示“至少一些实施例”。其他术语的相关定义将在下文描述中给出。需要注意,本公开中提及的“第一”、“第二”等概念仅用于对不同的装置、模块或单元进行区分,并非用于限定这些装置、模块或单元所执行的功能的顺序或者相互依存关系。As used herein, the term "comprise" and its variations are open-ended, ie "including but not limited to". The term "based on" is "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one further embodiment"; the term "some embodiments" means "at least some embodiments." Relevant definitions of other terms will be given in the description below. It should be noted that concepts such as "first" and "second" mentioned in this disclosure are only used to distinguish different devices, modules or units, and are not used to limit the sequence of functions performed by these devices, modules or units or interdependence.
需要注意,本公开中提及的“一个”、“多个”的修饰是示意性而非限制性的,本领域技术人员应当理解,除非在上下文另有明确指出,否则应该理解为“一个或多个”。It should be noted that the modifications of "one" and "multiple" mentioned in the present disclosure are illustrative and not restrictive, and those skilled in the art should understand that unless the context clearly indicates otherwise, it should be understood as "one or more" multiple".
本公开实施方式中的多个装置之间所交互的消息或者信息的名称仅用于说明性的目的,而并不是用于对这些消息或信息的范围进行限制。The names of messages or information exchanged between multiple devices in the embodiments of the present disclosure are used for illustrative purposes only, and are not used to limit the scope of these messages or information.
目前,一般基于超文本传输协议(Hyper Text Transfer Protocol,HTTP)的套接字(socket)的通信方式实现跨进程通信。但是,这种跨进程通信方式性能较低,只能实现两个应用间的通信,无法实现多应用间通信;另外,这种跨进程通信方式仅限于通信,不可以进行底层原生操作。At present, cross-process communication is generally implemented based on the socket (socket) communication mode of the Hyper Text Transfer Protocol (HTTP). However, the performance of this cross-process communication method is low, and it can only realize the communication between two applications, and cannot realize the communication between multiple applications; in addition, this cross-process communication method is limited to communication, and cannot perform underlying native operations.
需要说明的是,由于不同进程可能基于不同语言编写,因此,针对不同语言编写的进程,需要提供一种能够适应于不同语言的跨进程通信方式。It should be noted that since different processes may be written in different languages, it is necessary to provide a cross-process communication method that can adapt to different languages for processes written in different languages.
为了解决上述问题,下面结合图1至图4对本公开实施例提供的跨进程通信方法进行说明。在本公开实施例中,该跨进程通信方法可以由电子设备或服务器执行。其中,电子设备可以包括移动电话、平板电脑、台式计算机、笔记本电脑等具有通信功能的设备。服务器可以是云服务器或者服务器集群等具有存储及计算功能的设备。需要说明的是,以下实施例以电子设备作为执行主体进行示例性的解释。In order to solve the above problem, the cross-process communication method provided by the embodiment of the present disclosure will be described below with reference to FIG. 1 to FIG. 4 . In the embodiment of the present disclosure, the cross-process communication method may be executed by an electronic device or a server. Wherein, the electronic devices may include devices with communication functions such as mobile phones, tablet computers, desktop computers, and notebook computers. The server may be a cloud server or a server cluster or other device with storage and computing functions. It should be noted that, the following embodiments take an electronic device as an execution subject for exemplary explanation.
图1示出了本公开实施例提供的一种跨进程通信方法的流程示意图。Fig. 1 shows a schematic flowchart of a cross-process communication method provided by an embodiment of the present disclosure.
如图1所示,该跨进程通信方法可以包括如下步骤。As shown in FIG. 1, the cross-process communication method may include the following steps.
S110、利用主进程通过进程间通信方式,接收第一子进程发送的子进程依赖请求。S110. Using the main process to receive the sub-process dependency request sent by the first sub-process through inter-process communication.
在本公开实施例中,当电子设备中多个进程需要进行跨进程通信时,如果多进程中的第一子进程需要使用其他子进程的功能,第一子进程可以生成子进程依赖请求,并将子进程依赖请求通过进程间通信方式发送至主进程,则主进程可以获取该子进程依赖请求,且主进程能够基于该请求实现第一子进程与其他子进程之间通信。In the embodiment of the present disclosure, when multiple processes in the electronic device need to perform cross-process communication, if the first sub-process in the multi-process needs to use the functions of other sub-processes, the first sub-process can generate a sub-process dependency request, and The sub-process dependency request is sent to the main process through inter-process communication, then the main process can obtain the sub-process dependency request, and the main process can implement communication between the first sub-process and other sub-processes based on the request.
在本公开实施例中,主进程是指系统中用于执行主任务、生成和管理其它子任务的进程,子进程是指由父进程所创建的进程。In the embodiments of the present disclosure, a main process refers to a process in the system for executing a main task, generating and managing other sub-tasks, and a sub-process refers to a process created by a parent process.
在本公开实施例中,进程间通信(interprocess communication,IPC)是一个进程与另一个进程之间共享消息的一种通信方式。In the embodiments of the present disclosure, interprocess communication (interprocess communication, IPC) is a communication method for sharing messages between one process and another process.
在本公开实施例中,子进程依赖请求是指第一子进程依赖其他子进程执行对应任务的请求信息。In the embodiments of the present disclosure, the sub-process dependency request refers to request information that the first sub-process depends on other sub-processes to perform corresponding tasks.
可选的,第一子进程的数量可以为至少一个。Optionally, the number of the first subprocess may be at least one.
S120、利用主进程基于子进程依赖请求,控制至少一个第二子进程执行子进程依赖请求对应的目标任务,得到目标任务对应的执行结果。S120. Using the main process to control at least one second sub-process to execute the target task corresponding to the sub-process dependency request based on the sub-process dependency request, and obtain an execution result corresponding to the target task.
在本公开实施例中,电子设备利用主进程接收到子进程依赖请求之后,能够从子进程依赖请求中提取进程标识,若该进程标识是至少一个第二子进程的进程标识,则控制至少一个第二子进程执行相应的任务,在至少一个第二子进程执行完相应任务之后,获取至少一个第二子进程反馈的执行结果。In the embodiment of the present disclosure, after receiving the sub-process dependency request by the main process, the electronic device can extract the process ID from the sub-process dependency request, and if the process ID is the process ID of at least one second sub-process, control at least one The second sub-process executes the corresponding task, and after the at least one second sub-process executes the corresponding task, the execution result fed back by the at least one second sub-process is acquired.
在本公开实施例中,目标任务是指为实现特征功能所需执行的待处理任务。In the embodiments of the present disclosure, the target task refers to a task to be executed to realize the feature function.
其中,进程标识能够表征子进程的标识。可选的,进程标识可以包括子进程的身份标识号(Identity Document,ID)、包标识符(Packet Identifier,PID)等标识中的任意一种。Wherein, the process identifier can represent the identifier of the subprocess. Optionally, the process identification may include any one of subprocess identification numbers (Identity Document, ID), package identifiers (Packet Identifier, PID) and other identifications.
在一些实施例中,主进程先将子进程依赖请求发送给至少一个第二子进程,然后由至少一个第二子进程执行目标任务,得到目标任务的执行结果,则主进程获得目标任务的执行结果。In some embodiments, the main process first sends the subprocess dependency request to at least one second subprocess, and then at least one second subprocess executes the target task to obtain the execution result of the target task, and then the main process obtains the execution of the target task result.
在另一些实施例中,主进程先将子进程依赖请求发送给至少一个第二子进程,然后由至少一个第二子进程与主进程共同执行目标任务,则主进程获得目标任务的执行结果。In some other embodiments, the main process first sends the sub-process dependency request to at least one second sub-process, and then the at least one second sub-process and the main process jointly execute the target task, and the main process obtains the execution result of the target task.
S130、利用主进程通过进程间通信方式,将目标任务对应的执行结果反馈至第一子进程。S130, using the main process to feed back the execution result corresponding to the target task to the first sub-process through inter-process communication.
在本公开实施例中,电子设备中的主进程得到目标任务的执行结果之后,可以通过子进程依赖请求对应的通路,即继续通过进程间通信方式,将目标任务的执行结果反馈至第一子进程,从而实现多进程之间进行跨进程通信。In the embodiment of the present disclosure, after the main process in the electronic device obtains the execution result of the target task, it can feed back the execution result of the target task to the first sub-process through the path corresponding to the sub-process dependency request, that is, continue to use inter-process communication. process, so as to realize cross-process communication between multiple processes.
可以理解的是,目标任务的执行结果可以携带第一子进程的进程标识以及至少一个第二子进程的进程标识,因此,可以根据第一子进程的进程标识,获取子进程依赖请求对应的通路,并基于该通路将执行结果反馈给第一子进程,使得第一子进程能够感知到至少一个第二子进程已完成任务处理。It can be understood that the execution result of the target task can carry the process ID of the first sub-process and the process ID of at least one second sub-process, therefore, the path corresponding to the sub-process dependency request can be obtained according to the process ID of the first sub-process , and feed back the execution result to the first sub-process based on the path, so that the first sub-process can perceive that at least one second sub-process has completed task processing.
需要说明的是,由于IPC是一种性能较高的通信方式,因此多个进程之间的跨进程通信也能具有较好的性能。这样,相比于http的跨进程通信方式,基于IPC的跨进程通信方式能够有效保证跨进程通信的性能。It should be noted that since IPC is a communication method with high performance, cross-process communication between multiple processes can also have good performance. In this way, compared with the cross-process communication method of http, the cross-process communication method based on IPC can effectively guarantee the performance of cross-process communication.
本公开实施例提供了一种跨进程通信方法,能够利用主进程通过进程间通信方式,接收第一子进程发送的子进程依赖请求;然后利用主进程基于子进程依赖请求,控制至少一个第二子进程执行子进程依赖请求对应的目标任务,得到目标任务对应的执行结果;进而利用主进程通过所述进程间通信方式,将目标任务对应的执行结果反馈至所述第一子进程。由此,能够通过主进程对多个子进程之间的跨进程通信进行管理,这样,能够保证子进程与主进程之间的跨进程通信,也能够保证子进程与子进程之间的跨进程通信,也就是保证了各个进程之间能够进行有效的跨进程通信。The embodiment of the present disclosure provides a cross-process communication method, which can use the main process to receive the sub-process dependency request sent by the first sub-process through inter-process communication; then use the main process to control at least one second sub-process based on the sub-process dependency request. The sub-process executes the target task corresponding to the sub-process dependency request, and obtains the execution result corresponding to the target task; and then uses the main process to feed back the execution result corresponding to the target task to the first sub-process through the inter-process communication mode. Therefore, the cross-process communication between multiple sub-processes can be managed through the main process, so that the cross-process communication between the sub-process and the main process can be guaranteed, and the cross-process communication between the sub-processes can also be guaranteed , that is, to ensure effective cross-process communication between processes.
在本公开实施例中,可选的,主进程基于第一语言编写,第一子进程和至少一个第二子进程基于第二语言编写,并且,第一语言和第二语言不相同;第一子进程是Electron主进程,至少一个第二子进程是U3D子进程。In this embodiment of the present disclosure, optionally, the main process is written based on a first language, the first sub-process and at least one second sub-process are written based on a second language, and the first language and the second language are different; the first The child process is the main Electron process, and at least one second child process is a U3D child process.
可选的,第一语言可以是Electron,第二语言可以是U3D(Unity)。其中,Electron是使用JavaScript,HTML和CSS构建跨平台的桌面应用程序框架,U3D是基于C#语言开发的实时3D互动内容创作和运营平台。Optionally, the first language may be Electron, and the second language may be U3D (Unity). Among them, Electron uses JavaScript, HTML and CSS to build a cross-platform desktop application framework, and U3D is a real-time 3D interactive content creation and operation platform developed based on C# language.
需要说明的是,由于IPC能够实现跨语言通信,因此,尽管多进程中的主进程和子进程基于不同语言编写,通过IPC通信方式,也能够保证各个进程之间进行有效的跨进程通信,从而提供了一种跨语言通信的规范。It should be noted that since IPC can realize cross-language communication, even though the main process and sub-processes in the multi-process are written in different languages, the IPC communication method can also ensure effective cross-process communication between processes, thus providing A specification for interlingual communication.
在本公开另一种实施方式中,可以由至少一个第二子进程和主进程共同执行目标任务,或者,由至少一个第二子进程执行目标任务。In another implementation manner of the present disclosure, at least one second subprocess and the main process may jointly execute the target task, or at least one second subprocess may execute the target task.
图2示出了本公开实施例提供的另一种跨进程通信方法的流程示意图。Fig. 2 shows a schematic flowchart of another cross-process communication method provided by an embodiment of the present disclosure.
如图2所示,该跨进程通信方法可以包括如下步骤。As shown in FIG. 2, the cross-process communication method may include the following steps.
S210、从子进程依赖请求中提取第一子进程的子进程标识。S210. Extract the sub-process identifier of the first sub-process from the sub-process dependency request.
在本公开实施例中,电子设备中的主进程检测到子进程依赖请求时,为了提高跨进程通信的安全性,可以从该请求中提取第一子进程的子进程标识,并确定第一子进程的子进程标识是否是已经存储的标识。In the embodiment of the present disclosure, when the main process in the electronic device detects a sub-process dependency request, in order to improve the security of cross-process communication, it can extract the sub-process identifier of the first sub-process from the request, and determine the first sub-process Whether the child process ID of the process is a stored ID.
在本公开实施例中,第一子进程的子进程标识能够表征第一子进程的身份信息。In the embodiment of the present disclosure, the sub-process identifier of the first sub-process can represent the identity information of the first sub-process.
可选的,进程标识可以包括子进程的身份标识号(Identity Document,ID)、包标识符(Packet Identifier,PID)等标识中的任意一种。Optionally, the process identification may include any one of subprocess identification numbers (Identity Document, ID), package identifiers (Packet Identifier, PID) and other identifications.
S220、若从预先存储的子进程标识中查找到第一子进程的子进程标识,则通过进程间通信方式,接收第一子进程发送的子进程依赖请求。S220. If the sub-process ID of the first sub-process is found from the pre-stored sub-process IDs, receive a sub-process dependency request sent by the first sub-process through inter-process communication.
在本公开实施例中,电子设备中的主进程获取到第一子进程的子进程标识之后,可以将第一子进程的子进程标识与预先存储的子进程标识一一对比,若从预先存储的子进程标识中查找到第一子进程的子进程标识,则说明第一子进程的子进程标识是已经存储的标识,则可以直接接收子进程依赖请求。In the embodiment of the present disclosure, after the main process in the electronic device obtains the sub-process ID of the first sub-process, it can compare the sub-process ID of the first sub-process with the pre-stored sub-process ID one by one. If the sub-process identification of the first sub-process is found in the sub-process identification of the sub-process, it means that the sub-process identification of the first sub-process is an already stored identification, and the sub-process dependency request can be directly received.
具体的,在各个子进程启动之后,各子进程可以将各自对应的标识发送至主进程,使得主进程可以存储各子进程对应的子进程标识。Specifically, after each sub-process is started, each sub-process can send its corresponding identifier to the main process, so that the main process can store the sub-process identifier corresponding to each sub-process.
可以理解的是,若从预先存储的子进程标识中未查找到第一子进程的子进程标识,则说明第一子进程的子进程标识是未存储的标识,则可以拒绝接收子进程依赖请求。It can be understood that if the sub-process ID of the first sub-process is not found from the pre-stored sub-process IDs, it means that the sub-process ID of the first sub-process is an unstored ID, and the sub-process dependency request can be rejected .
由此,在本公开实施例中,通过将子进程依赖请求中的第一子进程的子进程标识与预先存储的子进程标识进行对比,选择性的接收或者拒绝子进程依赖请求,能够提高跨进程通信的安全性。Therefore, in the embodiment of the present disclosure, by comparing the sub-process ID of the first sub-process in the sub-process dependency request with the pre-stored sub-process ID, selectively accepting or rejecting the sub-process dependency request can improve cross- Security of process communication.
S230、通过进程间通信方式,将子进程依赖请求发送至至少一个第二子进程,其中,至少一个第二子进程用于基于子进程依赖请求生成主进程依赖请求。S230. Send the sub-process dependency request to at least one second sub-process through inter-process communication, wherein the at least one second sub-process is used to generate the main process dependency request based on the sub-process dependency request.
在本公开实施例中,电子设备中的主进程将子进程依赖请求发送至至少一个第二子进程之后,如果至少一个第二子进程需要依赖主进程执行部分功能,则至少一个第二子进程可以根据子进程依赖请求生成主进程依赖请求。In the embodiment of the present disclosure, after the main process in the electronic device sends the sub-process dependency request to at least one second sub-process, if at least one second sub-process needs to rely on the main process to perform some functions, at least one second sub-process A main process dependency request may be generated from a subprocess dependency request.
在本公开实施例中,主进程依赖请求是指至少一个第二子进程依赖主进程执行对应任务的请求信息。具体的,主进程依赖请求可以携带所依赖的主进程的任务模块。In the embodiments of the present disclosure, the main process dependency request refers to request information that at least one second sub-process relies on the main process to perform a corresponding task. Specifically, the main process dependency request may carry the dependent task module of the main process.
S240、响应于至少一个第二子进程反馈的主进程依赖请求,确定目标任务对应的主进程执行结果。S240. In response to the main process dependency request fed back by the at least one second sub-process, determine an execution result of the main process corresponding to the target task.
在本公开实施例中,电子设备中的主进程接收到主进程依赖请求,可以调取相应的功能模块进程任务处理,得到目标任务对应的主进程执行结果。In the embodiment of the present disclosure, the main process in the electronic device receives the main process dependency request, and may call the corresponding function module process task processing, and obtain the main process execution result corresponding to the target task.
在本公开实施例中,主进程执行结果可以是主进程得到的中间结果。In this embodiment of the present disclosure, the execution result of the main process may be an intermediate result obtained by the main process.
S250、通过进程间通信方式,将目标任务对应的主进程执行结果反馈至至少一个第二子进程,其中,至少一个第二子进程用于基于主进程执行结果继续执行目标任务,得到目标任务对应的执行结果。S250. Feedback the execution result of the main process corresponding to the target task to at least one second sub-process through inter-process communication, wherein at least one second sub-process is used to continue executing the target task based on the execution result of the main process, and obtain the corresponding execution result.
在本公开实施例中,电子设备中的主进程将主进程执行结果反馈至至少一个第二子进程之后,至少一个第二子进程能够将主进程执行结果作为目标任务的触发条件,使得基于该触发条件继续进行任务处理,得到目标任务对应的执行结果,即得到最终执行结果。In the embodiment of the present disclosure, after the main process in the electronic device feeds back the execution result of the main process to at least one second sub-process, at least one second sub-process can take the execution result of the main process as the trigger condition of the target task, so that based on the The trigger condition continues task processing, and the execution result corresponding to the target task is obtained, that is, the final execution result is obtained.
S260、通过进程间通信方式,接收至少一个第二子进程反馈的目标任务对应的执行结果。S260. Receive an execution result corresponding to the target task fed back by at least one second sub-process through inter-process communication.
在本公开实施例中,电子设备中的主进程可以通过主进程执行结果的反馈通路,并利用进程间通信方式,接收执行结果。In the embodiment of the present disclosure, the main process in the electronic device may receive the execution result through the feedback channel of the execution result of the main process and by using inter-process communication.
S270、通过进程间通信方式,接收至少一个第二子进程反馈的目标任务对应的执行结果,其中,至少一个第二子进程用于基于执行子进程依赖请求对应的目标任务。S270. Receive an execution result corresponding to the target task fed back by at least one second sub-process through inter-process communication, wherein the at least one second sub-process is used to execute the sub-process dependency request corresponding to the target task.
在本公开实施例中,电子设备中的主进程将子进程依赖请求发送至至少一个第二子进程之后,如果至少一个第二子进程不需要依赖主进程执行部分功能,则至少一个第二子进程可以直接进行任务处理,得到目标任务的处理结果,然后,主进程可以将目标任务的执行结果反馈至主进程。In the embodiment of the present disclosure, after the main process in the electronic device sends the sub-process dependency request to at least one second sub-process, if at least one second sub-process does not need to rely on the main process to perform some functions, then at least one second sub-process The process can directly process the task to obtain the processing result of the target task, and then the main process can feed back the execution result of the target task to the main process.
由此,在本公开实施例中,至少一个第二子进程可以根据自身的任务执行情况单独进行任务处理,或者由主进程协助进行任务处理,这样,能够适用于多种应用场景下的任务处理过程,提高了任务处理过程的灵活性。Therefore, in the embodiments of the present disclosure, at least one second sub-process can perform task processing independently according to its own task execution situation, or the main process can assist in task processing, so that it can be applied to task processing in various application scenarios The process improves the flexibility of the task processing process.
S280、利用主进程通过进程间通信方式,将目标任务对应的执行结果反馈至第一子进程。S280. Use the main process to feed back the execution result corresponding to the target task to the first sub-process through inter-process communication.
其中,S280与S130的具体实现方式相似,在此不做赘述。Wherein, the specific implementation manners of S280 and S130 are similar, and details are not described here.
在本公开又一种实施方式中,主进程在接收子进程依赖请求之前,需要启动各个子进程,且获取并存储各个子进程对应的子进程标识;主进程在得到目标任务对应的执行结果之后,可以将至少一个第二子进程关闭。In yet another embodiment of the present disclosure, before the main process receives the sub-process dependency request, it needs to start each sub-process, and obtain and store the sub-process identification corresponding to each sub-process; after the main process obtains the execution result corresponding to the target task , at least one second child process can be closed.
图3示出了本公开实施例提供的又一种跨进程通信方法的流程示意图。Fig. 3 shows a schematic flowchart of another cross-process communication method provided by an embodiment of the present disclosure.
如图3所示,该跨进程通信方法可以包括如下步骤。As shown in FIG. 3, the cross-process communication method may include the following steps.
S310、基于第一子进程的安装路径,启动第一子进程,以及获取并存储第一子进程对应的子进程标识。S310. Based on the installation path of the first sub-process, start the first sub-process, and obtain and store a sub-process identifier corresponding to the first sub-process.
在本公开实施例中,在进行跨进程通信之前,主进程可以通过IPC获取第一子进程的安装路径,并基于该安装路径,启动第一子进程;在第一子进程启动之后,主进程可以通过IPC获取第一子进程对应的子进程标识,并存储第一子进程对应的子进程标识。In the embodiment of the present disclosure, before performing cross-process communication, the main process can obtain the installation path of the first sub-process through IPC, and start the first sub-process based on the installation path; after the first sub-process is started, the main process The sub-process identifier corresponding to the first sub-process may be obtained through IPC, and the sub-process identifier corresponding to the first sub-process is stored.
为了便于理解第一子进程对应的子进程标识的获取过程,图4示出了本公开实施例提供的一种跨进程通信方法的逻辑示意图。In order to facilitate understanding of the process of obtaining the sub-process identifier corresponding to the first sub-process, FIG. 4 shows a schematic diagram of a cross-process communication method provided by an embodiment of the present disclosure.
如图4所示,第一子进程A安装完毕之后,首先,主进程可以通过IPC获取第一子进程A的安装路径,然后,主进程可以通过IPC获取第一子进程A对应的子进程标识,并存储第一子进程A对应的子进程标识。As shown in Figure 4, after the first sub-process A is installed, first, the main process can obtain the installation path of the first sub-process A through IPC, and then, the main process can obtain the sub-process identifier corresponding to the first sub-process A through IPC , and store the subprocess identifier corresponding to the first subprocess A.
S320、通过进程间通信方式接收第一子进程发送的进程辅助请求。S320. Receive the process assistance request sent by the first sub-process through inter-process communication.
S330、响应于进程辅助请求,启动至少一个第二子进程,以及获取并存储至少一个第二子进程对应的子进程标识。S330. In response to the process assistance request, start at least one second sub-process, and acquire and store a sub-process identifier corresponding to the at least one second sub-process.
具体的,当第一子进程需要使用至少一个第二子进程的功能时,可以生成进程辅助请求,则电子设备中的主进程可以通过IPC接收进程辅助请求,然后,响应于该请求,则通过IPC获取至少一个第二子进程的安装路径,并基于该安装路径,启动至少一个第二子进程;在至少一个第二子进程启动之后,主进程可以通过IPC获取第二子进程对应的子进程标识,并存储至少一个第二子进程对应的子进程标识。Specifically, when the first sub-process needs to use the function of at least one second sub-process, a process assistance request can be generated, then the main process in the electronic device can receive the process assistance request through IPC, and then, in response to the request, pass IPC obtains the installation path of at least one second subprocess, and starts at least one second subprocess based on the installation path; after at least one second subprocess is started, the main process can obtain the subprocess corresponding to the second subprocess through IPC ID, and store at least one sub-process ID corresponding to the second sub-process.
继续参见图4,第二子进程B和第二子进程C安装完毕之后,首先,主进程可以通过IPC获取第二子进程B和第二子进程C分别对应的安装路径,然后,主进程获取进程辅助请求,并响应于该进程辅助请求,通过IPC获取第二子进程B和第二子进程C分别对应的子进程标识,并存储第二子进程B和第二子进程C分别对应的子进程标识。Continue to refer to Figure 4, after the second sub-process B and the second sub-process C are installed, first, the main process can obtain the installation paths corresponding to the second sub-process B and the second sub-process C through IPC, and then, the main process obtains A process assistance request, and in response to the process assistance request, obtain the sub-process identifiers corresponding to the second sub-process B and the second sub-process C through IPC, and store the sub-process identifiers corresponding to the second sub-process B and the second sub-process C respectively Process ID.
S340、利用主进程通过进程间通信方式,接收第一子进程发送的子进程依赖请求。S340. Use the main process to receive the sub-process dependency request sent by the first sub-process through inter-process communication.
S350、利用主进程基于子进程依赖请求,控制至少一个第二子进程执行子进程依赖请求对应的目标任务,得到目标任务对应的执行结果。S350. Using the main process to control at least one second sub-process to execute the target task corresponding to the sub-process dependency request based on the sub-process dependency request, and obtain an execution result corresponding to the target task.
其中,S340~S350与S110~S120的具体实现方式相似,在此不做赘述。Wherein, the specific implementation manners of S340-S350 are similar to those of S110-S120, and will not be repeated here.
S360、通过进程间通信方式,接收至少一个第二子进程发送的子进程关闭请求。S360. Receive a sub-process shutdown request sent by at least one second sub-process through inter-process communication.
在本公开实施例中,在至少一个第二子进程执行完目标任务之后,电子设备中的至少一个第二子进程需要生成子进程关闭请求,则主进程能够通过IPC,接收至少一个第二子进程发送的子进程关闭请求。In the embodiment of the present disclosure, after at least one second sub-process executes the target task, at least one second sub-process in the electronic device needs to generate a sub-process shutdown request, and the main process can receive at least one second sub-process through IPC. A child process shutdown request sent by a process.
在本公开实施例中,子进程关闭请求是指请求主进程关闭子进程的信息。In the embodiment of the present disclosure, the sub-process closing request refers to information requesting the main process to close the sub-process.
具体的,子进程关闭请求可以携带至少一个第二子进程的进程标识。Specifically, the subprocess shutdown request may carry at least one process identifier of the second subprocess.
S370、响应于子进程关闭请求,将已开启的至少一个第二子进程关闭。S370. In response to the request to close the sub-process, close at least one second sub-process that has been started.
在本公开实施例中,电子设备中的主进程可以从子进程关闭请求中提取至少一个第二子进程的进程标识,并将已开启的至少一个第二子进程关闭。In an embodiment of the present disclosure, the main process in the electronic device may extract the process identifier of at least one second sub-process from the sub-process closing request, and close the at least one started second sub-process.
S380、在至少一个第二子进程已关闭的情况下,通过进程间通信方式,将目标任务对应的执行结果发送至第一子进程。S380. When at least one second sub-process is closed, send the execution result corresponding to the target task to the first sub-process through inter-process communication.
在本公开实施例中,电子设备中的主进程在关闭至少一个第二子进程之后,可以将至少一个第二子进程的关闭结果通知给第一子进程,使得第一子进程确定目标任务已经执行完毕,与此同时,将目标任务的执行结果反馈至第一子进程。In an embodiment of the present disclosure, after closing at least one second sub-process, the main process in the electronic device may notify the first sub-process of the closing result of the at least one second sub-process, so that the first sub-process determines that the target task has After the execution is completed, at the same time, the execution result of the target task is fed back to the first sub-process.
进一步的,在关闭至少一个第二子进程之后,可以删除至少一个第二子进程的子进程标识,使得至少一个第二子进程执行目标任务之后,进入休眠状态,在下次使用至少一个第二子进程时,可以重新获取至少一个第二子进程对应的进程标识。Further, after closing at least one second sub-process, the sub-process identifier of at least one second sub-process can be deleted, so that at least one second sub-process enters a dormant state after executing the target task, and uses at least one second sub-process next time process, the process identification corresponding to at least one second sub-process may be acquired again.
由此,在本公开实施例中,可以通过主进程控制第一子进程和至少一个第二子进程开启和关闭,从而实现在跨进程通信的过程中,同时实现底层原生操作的效果。Therefore, in the embodiment of the present disclosure, the main process can control the opening and closing of the first sub-process and at least one second sub-process, so as to achieve the effect of the underlying native operation during the process of cross-process communication.
本公开实施例还提供了一种用于实现上述的跨进程通信方法的跨进程通信装置,下面结合图5进行说明。在本公开实施例中,该跨进程通信装置可以为电子设备或服务器。其中,电子设备可以包括移动电话、平板电脑、台式计算机、笔记本电脑等具有通信功能的设备。服务器可以是云服务器或者服务器集群等具有存储及计算功能的设备。An embodiment of the present disclosure also provides a cross-process communication device for implementing the above-mentioned cross-process communication method, which will be described below with reference to FIG. 5 . In the embodiment of the present disclosure, the cross-process communication device may be an electronic device or a server. Wherein, the electronic devices may include devices with communication functions such as mobile phones, tablet computers, desktop computers, and notebook computers. The server may be a cloud server or a server cluster or other device with storage and computing functions.
图5示出了本公开实施例提供的一种跨进程通信装置的结构示意图。Fig. 5 shows a schematic structural diagram of a cross-process communication device provided by an embodiment of the present disclosure.
如图5所示,跨进程通信装置500可以包括:As shown in FIG. 5, the cross-process communication device 500 may include:
子进程依赖请求接收模块510,用于利用主进程通过进程间通信方式,接收第一子进程发送的子进程依赖请求;The sub-process dependency request receiving module 510 is configured to use the main process to receive the sub-process dependency request sent by the first sub-process through inter-process communication;
控制模块520,用于利用主进程基于子进程依赖请求,控制至少一个第二子进程执行子进程依赖请求对应的目标任务,得到目标任务对应的执行结果;The control module 520 is configured to use the main process to control at least one second sub-process to execute the target task corresponding to the sub-process dependency request based on the sub-process dependency request, and obtain an execution result corresponding to the target task;
执行结果反馈模块530,用于利用主进程通过进程间通信方式,将目标任务对应的执行结果反馈至第一子进程。The execution result feedback module 530 is configured to use the main process to feed back the execution result corresponding to the target task to the first sub-process through inter-process communication.
本公开实施例提供了一种跨进程通信装置,能够利用主进程通过进程间通信方式,接收第一子进程发送的子进程依赖请求;然后利用主进程基于子进程依赖请求,控制至少一个第二子进程执行子进程依赖请求对应的目标任务,得到目标任务对应的执行结果;进而利用主进程通过进程间通信方式,将目标任务对应的执行结果反馈至第一子进程。由此,能够通过主进程对多个子进程之间的跨进程通信进行管理,这样,能够保证子进程与主进程之间的跨进程通信,也能够保证子进程与子进程之间的跨进程通信,也就是保证了各个进程之间能够进行有效的跨进程通信。The embodiment of the present disclosure provides a cross-process communication device, which can use the main process to receive the sub-process dependency request sent by the first sub-process through inter-process communication; then use the main process to control at least one second sub-process based on the sub-process dependency request. The sub-process executes the target task corresponding to the sub-process dependency request, and obtains the execution result corresponding to the target task; and then uses the main process to feed back the execution result corresponding to the target task to the first sub-process through inter-process communication. Therefore, the cross-process communication between multiple sub-processes can be managed through the main process, so that the cross-process communication between the sub-process and the main process can be guaranteed, and the cross-process communication between the sub-processes can also be guaranteed , that is, to ensure effective cross-process communication between processes.
在一些可选的实施例中,主进程基于第一语言编写,第一子进程和第二子进程基于第二语言编写,并且,第一语言和第二语言不相同;In some optional embodiments, the main process is written based on the first language, the first sub-process and the second sub-process are written based on the second language, and the first language and the second language are different;
第一子进程是Electron主进程,至少一个第二子进程是U3D子进程。The first child process is the Electron main process, and at least one second child process is a U3D child process.
在一些可选的实施例中,子进程依赖请求接收模块510,可以包括:In some optional embodiments, the child process depends on the request receiving module 510, which may include:
子进程标识提取单元,用于从子进程依赖请求中提取第一子进程的子进程标识;a sub-process identification extraction unit, configured to extract the sub-process identification of the first sub-process from the sub-process dependency request;
子进程依赖请求接收单元,用于若从预先存储的子进程标识中查找到第一子进程的子进程标识,则通过进程间通信方式,接收第一子进程发送的子进程依赖请求。The sub-process dependency request receiving unit is configured to receive the sub-process dependency request sent by the first sub-process through inter-process communication if the sub-process ID of the first sub-process is found from the pre-stored sub-process IDs.
在一些可选的实施例中,控制模块520,可以包括:In some optional embodiments, the control module 520 may include:
子进程依赖请求发送单元,用于通过进程间通信方式,将子进程依赖请求发送至至少一个第二子进程,其中,至少一个第二子进程用于基于子进程依赖请求生成主进程依赖请求;The sub-process dependency request sending unit is configured to send the sub-process dependency request to at least one second sub-process through inter-process communication, wherein at least one second sub-process is used to generate the main process dependency request based on the sub-process dependency request;
主进程执行结果确定单元,用于响应于至少一个第二子进程反馈的主进程依赖请求,确定目标任务对应的主进程执行结果;The main process execution result determination unit is configured to determine the main process execution result corresponding to the target task in response to the main process dependency request fed back by at least one second sub-process;
主进程执行结果反馈单元,用于通过进程间通信方式,将目标任务对应的主进程执行结果反馈至至少一个第二子进程,其中,至少一个第二子进程用于基于主进程执行结果继续执行目标任务,得到目标任务对应的执行结果;The main process execution result feedback unit is used to feed back the main process execution result corresponding to the target task to at least one second sub-process through inter-process communication, wherein at least one second sub-process is used to continue execution based on the main process execution result Target task, get the execution result corresponding to the target task;
第一接收单元,用于通过进程间通信方式,接收第二子进程反馈的目标任务对应的执行结果。The first receiving unit is configured to receive the execution result corresponding to the target task fed back by the second sub-process through inter-process communication.
在一些可选的实施例中,控制模块520,包括:In some optional embodiments, the control module 520 includes:
子进程依赖请求发送单元,将子进程依赖请求发送至至少一个第二子进程,其中,至少一个第二子进程用于基于执行子进程依赖请求对应的目标任务;The sub-process dependency request sending unit sends the sub-process dependency request to at least one second sub-process, wherein at least one second sub-process is used to execute the target task corresponding to the sub-process dependency request;
第二接收单元,用于通过进程间通信方式,接收至少一个第二子进程反馈的目标任务对应的执行结果,其中,第二子进程用于基于执行子进程依赖请求对应的目标任务。The second receiving unit is configured to receive the execution result corresponding to the target task fed back by at least one second sub-process through inter-process communication, wherein the second sub-process is configured to request the corresponding target task based on the execution sub-process dependency.
在一些可选的实施例中,该装置还包括:In some optional embodiments, the device also includes:
第一子进程启动模块,用于基于第一子进程的安装路径,启动第一子进程,以及获取并存储第一子进程对应的子进程标识。The first sub-process starting module is configured to start the first sub-process based on the installation path of the first sub-process, and obtain and store a sub-process identifier corresponding to the first sub-process.
在一些可选的实施例中,该装置还包括:In some optional embodiments, the device also includes:
第二子进程启动模块,用于通过进程间通信方式接收第一子进程发送的进程辅助请求;The second sub-process startup module is configured to receive the process assistance request sent by the first sub-process through inter-process communication;
响应于进程辅助请求,启动至少一个第二子进程,以及获取并存储至少一个第二子进程对应的子进程标识。In response to the process assistance request, start at least one second sub-process, and obtain and store a sub-process identifier corresponding to the at least one second sub-process.
在一些可选的实施例中,该装置还包括:In some optional embodiments, the device also includes:
子进程关闭请求接收模块,用于通过进程间通信方式,接收至少一个第二子进程发送的子进程关闭请求;A sub-process closing request receiving module, configured to receive a sub-process closing request sent by at least one second sub-process through inter-process communication;
第二子进程关闭模块,用于响应于子进程关闭请求,将已开启的至少一个第二子进程关闭;The second sub-process closing module is configured to close at least one second sub-process that has been opened in response to the sub-process closing request;
相应的,执行结果反馈模块530具体用于,在至少一个第二子进程已关闭的情况下,通过进程间通信方式,将目标任务对应的执行结果发送至至少一个第一子进程。Correspondingly, the execution result feedback module 530 is specifically configured to, when at least one second sub-process is closed, send the execution result corresponding to the target task to at least one first sub-process through inter-process communication.
需要说明的是,图5所示的跨进程通信装置500可以执行图1至图4所示的方法实施例中的各个步骤,并且实现图1至图4所示的方法实施例中的各个过程和效果,在此不做赘述。It should be noted that the cross-process communication device 500 shown in FIG. 5 can execute each step in the method embodiment shown in FIG. 1 to FIG. 4 , and realize each process in the method embodiment shown in FIG. 1 to FIG. 4 and effects, which will not be described here.
本公开示例性实施例还提供一种电子设备,包括:至少一个处理器;以及与至少一个处理器通信连接的存储器。存储器存储有能够被至少一个处理器执行的计算机程序,计算机程序在被至少一个处理器执行时用于使电子设备执行根据本公开实施例的方法。Exemplary embodiments of the present disclosure also provide an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor. The memory stores a computer program executable by at least one processor, and when executed by the at least one processor, the computer program is used to cause the electronic device to perform the method according to the embodiments of the present disclosure.
本公开示例性实施例还提供一种存储有计算机程序的非瞬时计算机可读存储介质,其中,计算机程序在被计算机的处理器执行时用于使计算机执行根据本公开实施例的方法。Exemplary embodiments of the present disclosure also provide a non-transitory computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor of a computer, is used to cause the computer to execute the method according to the embodiments of the present disclosure.
本公开示例性实施例还提供一种计算机程序产品,包括计算机程序,其中,计算机程序在被计算机的处理器执行时用于使计算机执行根据本公开实施例的方法。Exemplary embodiments of the present disclosure also provide a computer program product, including a computer program, wherein the computer program, when executed by a processor of a computer, is used to cause the computer to execute the method according to the embodiments of the present disclosure.
参考图6,现将描述可以作为本公开的服务器或客户端的跨进程通信设备600的结构框图,其是可以应用于本公开的各方面的硬件设备的示例,该跨进程通信设备600可以是上述电子设备。电子设备旨在表示各种形式的数字电子的计算机设备,诸如,膝上型计算机、台式计算机、工作台、个人数字助理、服务器、刀片式服务器、大型计算机、和其它适合的计算机。电子设备还可以表示各种形式的移动装置,诸如,个人数字处理、蜂窝电话、智能电话、可穿戴设备和其它类似的计算装置。本文所示的部件、它们的连接和关系、以及它们的功能仅仅作为示例,并且不意在限制本文中描述的和/或者要求的本公开的实现。Referring to FIG. 6, a structural block diagram of a
如图6所示,跨进程通信设备600包括计算单元601,其可以根据存储在只读存储器(ROM)602中的计算机程序或者从存储单元608加载到随机访问存储器(RAM)603中的计算机程序,来执行各种适当的动作和处理。在RAM603中,还可存储跨进程通信设备600操作所需的各种程序和数据。计算单元601、ROM602以及RAM603通过总线604彼此相连。输入/输出(I/O)接口605也连接至总线604。As shown in FIG. 6 , the
跨进程通信设备600中的多个部件连接至I/O接口605,包括:输入单元606、输出单元607、存储单元608以及通信单元609。输入单元606可以是能向跨进程通信设备600输入信息的任何类型的设备,输入单元606可以接收输入的数字或字符信息,以及产生与电子设备的用户设置和/或功能控制有关的键信号输入。输出单元607可以是能呈现信息的任何类型的设备,并且可以包括但不限于显示器、扬声器、视频/音频输出终端、振动器和/或打印机。存储单元604可以包括但不限于磁盘、光盘。通信单元609允许跨进程通信设备600通过诸如因特网的计算机网络和/或各种电信网络与其他设备交换信息/数据,并且可以包括但不限于调制解调器、网卡、红外通信设备、无线通信收发机和/或芯片组,例如蓝牙TM设备、WiFi设备、WiMax设备、蜂窝通信设备和/或类似物。Multiple components in the
计算单元601可以是各种具有处理和计算能力的通用和/或专用处理组件。计算单元601的一些示例包括但不限于中央处理单元(CPU)、图形处理单元(GPU)、各种专用的人工智能(AI)计算芯片、各种运行机器学习模型算法的计算单元、数字信号处理器(DSP)、以及任何适当的处理器、控制器、微控制器等。计算单元601执行上文所描述的各个方法和处理。例如,在一些实施例中,跨进程通信方法可被实现为计算机软件程序,其被有形地包含于机器可读介质,例如存储单元608。在一些实施例中,计算机程序的部分或者全部可以经由ROM602和/或通信单元609而被载入和/或安装到跨进程通信设备600上。在一些实施例中,计算单元601可以通过其他任何适当的方式(例如,借助于固件)而被配置为执行跨进程通信方法。The
用于实施本公开的方法的程序代码可以采用一个或多个编程语言的任何组合来编写。这些程序代码可以提供给通用计算机、专用计算机或其他可编程数据处理装置的处理器或控制器,使得程序代码当由处理器或控制器执行时使流程图和/或框图中所规定的功能/操作被实施。程序代码可以完全在机器上执行、部分地在机器上执行,作为独立软件包部分地在机器上执行且部分地在远程机器上执行或完全在远程机器或服务器上执行。Program codes for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special purpose computer, or other programmable data processing devices, so that the program codes, when executed by the processor or controller, make the functions/functions specified in the flow diagrams and/or block diagrams Action is implemented. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.
在本公开的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media would include one or more wire-based electrical connections, portable computer discs, hard drives, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, compact disk read only memory (CD-ROM), optical storage, magnetic storage, or any suitable combination of the foregoing.
如本公开使用的,术语“机器可读介质”和“计算机可读介质”指的是用于将机器指令和/或数据提供给可编程处理器的任何计算机程序产品、设备、和/或装置(例如,磁盘、光盘、存储器、可编程逻辑装置(PLD)),包括,接收作为机器可读信号的机器指令的机器可读介质。术语“机器可读信号”指的是用于将机器指令和/或数据提供给可编程处理器的任何信号。As used in this disclosure, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and/or means for providing machine instructions and/or data to a programmable processor (eg, magnetic disk, optical disk, memory, programmable logic device (PLD)), including machine-readable media that receive machine instructions as machine-readable signals. The term "machine-readable signal" refers to any signal used to provide machine instructions and/or data to a programmable processor.
为了提供与用户的交互,可以在计算机上实施此处描述的系统和技术,该计算机具有:用于向用户显示信息的显示装置(例如,CRT(阴极射线管)或者LCD(液晶显示器)监视器);以及键盘和指向装置(例如,鼠标或者轨迹球),用户可以通过该键盘和该指向装置来将输入提供给计算机。其它种类的装置还可以用于提供与用户的交互;例如,提供给用户的反馈可以是任何形式的传感反馈(例如,视觉反馈、听觉反馈、或者触觉反馈);并且可以用任何形式(包括声输入、语音输入或者、触觉输入)来接收来自用户的输入。To provide for interaction with the user, the systems and techniques described herein can be implemented on a computer having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user. ); and a keyboard and pointing device (eg, a mouse or a trackball) through which a user can provide input to the computer. Other kinds of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and can be in any form (including Acoustic input, speech input or, tactile input) to receive input from the user.
可以将此处描述的系统和技术实施在包括后台部件的计算系统(例如,作为数据服务器)、或者包括中间件部件的计算系统(例如,应用服务器)、或者包括前端部件的计算系统(例如,具有图形用户界面或者网络浏览器的用户计算机,用户可以通过该图形用户界面或者该网络浏览器来与此处描述的系统和技术的实施方式交互)、或者包括这种后台部件、中间件部件、或者前端部件的任何组合的计算系统中。可以通过任何形式或者介质的数字数据通信(例如,通信网络)来将系统的部件相互连接。通信网络的示例包括:局域网(LAN)、广域网(WAN)和互联网。The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., as a a user computer having a graphical user interface or web browser through which a user can interact with embodiments of the systems and techniques described herein), or including such backend components, middleware components, Or any combination of front-end components in a computing system. The components of the system can be interconnected by any form or medium of digital data communication, eg, a communication network. Examples of communication networks include: Local Area Network (LAN), Wide Area Network (WAN) and the Internet.
计算机系统可以包括客户端和服务器。客户端和服务器一般远离彼此并且通常通过通信网络进行交互。通过在相应的计算机上运行并且彼此具有客户端-服务器关系的计算机程序来产生客户端和服务器的关系。A computer system may include clients and servers. Clients and servers are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by computer programs running on the respective computers and having a client-server relationship to each other.
需要说明的是,在本文中,诸如“第一”和“第二”等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that in this article, relative terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply these No such actual relationship or order exists between entities or operations. Furthermore, the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article, or apparatus comprising a set of elements includes not only those elements, but also includes elements not expressly listed. other elements of or also include elements inherent in such a process, method, article, or device. Without further limitations, an element defined by the phrase "comprising a ..." does not preclude the presence of additional identical elements in the process, method, article, or apparatus that includes the element.
以上仅是本公开的具体实施方式,使本领域技术人员能够理解或实现本公开。对这些实施例的多种修改对本领域的技术人员来说将是显而易见的,本文中所定义的一般原理可以在不脱离本公开的精神或范围的情况下,在其它实施例中实现。因此,本公开将不会被限制于本文的这些实施例,而是要符合与本文所公开的原理和新颖特点相一致的最宽的范围。The above are only specific implementation manners of the present disclosure, so that those skilled in the art can understand or implement the present disclosure. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to these embodiments herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210719357.XA CN115129469B (en) | 2022-06-23 | 2022-06-23 | Cross-process communication method, device, equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210719357.XA CN115129469B (en) | 2022-06-23 | 2022-06-23 | Cross-process communication method, device, equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115129469A CN115129469A (en) | 2022-09-30 |
CN115129469B true CN115129469B (en) | 2023-04-21 |
Family
ID=83379134
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210719357.XA Active CN115129469B (en) | 2022-06-23 | 2022-06-23 | Cross-process communication method, device, equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115129469B (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110413386A (en) * | 2019-06-27 | 2019-11-05 | 深圳市富途网络科技有限公司 | Multiprocessing method, apparatus, terminal device and computer readable storage medium |
EP3819764A2 (en) * | 2020-09-29 | 2021-05-12 | Beijing Baidu Netcom Science And Technology Co. Ltd. | Service information processing method, apparatus, device and computer storage medium |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107179982B (en) * | 2016-03-09 | 2021-05-04 | 创新先进技术有限公司 | Cross-process debugging method and device |
US9733999B1 (en) * | 2016-03-24 | 2017-08-15 | Wells Fargo Bank, N.A. | Dynamic optimization of application workflows |
CN111176801B (en) * | 2019-07-17 | 2024-04-12 | 腾讯科技(深圳)有限公司 | A multi-process management method, device, equipment and storage medium |
US20210042167A1 (en) * | 2019-08-07 | 2021-02-11 | Microsoft Technology Licensing, Llc | Dynamic Package Dependency(ies) |
CN111381903B (en) * | 2020-03-18 | 2023-05-26 | 支付宝(杭州)信息技术有限公司 | Program running method, device, equipment and medium |
-
2022
- 2022-06-23 CN CN202210719357.XA patent/CN115129469B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110413386A (en) * | 2019-06-27 | 2019-11-05 | 深圳市富途网络科技有限公司 | Multiprocessing method, apparatus, terminal device and computer readable storage medium |
EP3819764A2 (en) * | 2020-09-29 | 2021-05-12 | Beijing Baidu Netcom Science And Technology Co. Ltd. | Service information processing method, apparatus, device and computer storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN115129469A (en) | 2022-09-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2019000871A1 (en) | Method and device for providing voice service, and server | |
CN114116092B (en) | Cloud desktop system processing method, cloud desktop system control method and related equipment | |
CN113488048B (en) | Information interaction method and device | |
CN114586007B (en) | Automatic assistant architecture for maintaining privacy of application content | |
CN114090118B (en) | Method, device, equipment and storage medium for starting applet | |
CN113132400B (en) | Business processing method, device, computer system and storage medium | |
CN115129469B (en) | Cross-process communication method, device, equipment and storage medium | |
CN116561013B (en) | Test methods, devices, electronic equipment and media based on the target service framework | |
WO2024167722A1 (en) | Programatically invokable conversational chatbot | |
CN114095758B (en) | Cloud image intercepting method and related device | |
CN117194068A (en) | Cross-process data transmission method, system, equipment and storage medium | |
CN115982489A (en) | Page rendering method, device, device and computer-readable storage medium | |
CN114218313B (en) | Data management method, device, electronic device, storage medium and product | |
WO2023169193A1 (en) | Method and device for generating smart contract | |
US20190121649A1 (en) | User interface metadata from an application program interface | |
CN115410580A (en) | Speech recognition method, device, equipment and medium for command and dispatch system | |
CN114386577A (en) | Method, apparatus and storage medium for executing deep learning models | |
CN113761039B (en) | A method and device for processing information | |
CN112068814A (en) | Method, device, system and medium for generating executable file | |
CN113778600B (en) | Resolution setting method, device, equipment, storage medium and program product | |
CN113485856B (en) | Page processing method and device, electronic equipment, medium and product | |
CN116233051B (en) | A page sharing method, device, equipment and storage medium for mini program | |
CN113032040B (en) | Method, apparatus, device, medium, and article for processing tasks | |
US20240168775A1 (en) | System and method for automatically monitoring application performance | |
US20240078716A1 (en) | Intelligent generation of thumbnail images for messaging applications |
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 |