CN104216862B - Communication means, device between a kind of consumer process and system service - Google Patents

Communication means, device between a kind of consumer process and system service Download PDF

Info

Publication number
CN104216862B
CN104216862B CN201310207082.2A CN201310207082A CN104216862B CN 104216862 B CN104216862 B CN 104216862B CN 201310207082 A CN201310207082 A CN 201310207082A CN 104216862 B CN104216862 B CN 104216862B
Authority
CN
China
Prior art keywords
kernel
system service
module
agent
consumer process
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
CN201310207082.2A
Other languages
Chinese (zh)
Other versions
CN104216862A (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.)
Nanjing silex Information Technology Co.,Ltd.
Original Assignee
Huawei Technologies 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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201310207082.2A priority Critical patent/CN104216862B/en
Publication of CN104216862A publication Critical patent/CN104216862A/en
Application granted granted Critical
Publication of CN104216862B publication Critical patent/CN104216862B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)
  • Computer And Data Communications (AREA)

Abstract

The present invention is applied to field of computer technology there is provided the communication means between a kind of consumer process and system service, device, and methods described includes:Consumer process sends first to first agent's module by the first kernel and asked, and the first data that consumer process needs system service to handle are carried in the first request;First agent's module is received after the first request, and the first data carried during first is asked by the first kernel are written to the first memory headroom corresponding with the shared drive address information preserved;System service reads the first data by way of the second kernel is with poll from the first memory headroom, and is handled, the first data after being handled, and the first data after processing are written into the first memory headroom;The first data after processing are sent to consumer process by first agent's module by way of the first kernel is with poll from the first data after the first memory headroom reading process, and by the first kernel.The present invention, greatly reduces the expense of context switching.

Description

Communication means, device between a kind of consumer process and system service
Technical field
The invention belongs to the communication party between field of computer technology, more particularly to a kind of consumer process and system service Method, device.
Background technology
At present, processor has been enter into the multi-core/many-core epoch, however, current operating system is only with symmetric multiprocessor (Symmetric Multi-Processing, SMP)Mode uses multi-core/many-core processor, can not make full use of multinuclear/crowd The parallel processing capability of core processor.It is demonstrated experimentally that when more than 16 cores of processor, existing Linux performance no longer linearly increases Length is reduced on the contrary.Therefore, it is necessary to design a kind of new operating system.
Mach(Microkernel Operating System)Structure, is hair the late 1980s What exhibition was got up.A prominent thought in modern operating system design is that more compositions and function in operating system are put into more High level(And user model)In go operation, and leave a small kernel as far as possible, complete operating system with it most basic Core Feature, this technology is referred to as Microkernel.The design object of micro-kernel is by the realization of system service and system Basic operation rule separate, many system services are put into the process of separation, such as file system, device drives by micro-kernel Program, and process is serviced by message transmission calling system.These very modular User space services are used to complete operation system Advanced operation in system, such design makes the design of meat and potatoes in kernel simpler.One serviced component Error can't cause the collapse of whole system, and kernel needs what is done, this component only restarted, without influenceing it Its part.
Operating system based on micro-kernel has following feature:
1) sufficiently small kernel
In Mach, kernel refer to it is well-designed, modern times most basic OS Core Feature can be realized Part.Micro-kernel is not a complete OS, and simply meat and potatoes in operating system, and it is generally used for:
Realize the processing being closely related with hardware;
Realize some more basic functions;
It is responsible for the communication between client and server.
They simply provide an important foundation to build general purpose O S, so can ensure that and operating system nucleus is made Very little.So, can be simultaneously in each central processing unit on many-core platform(Central Processing Unit, CPU) One kernel kernel example of upper operation, each CPU is not interfere with each other when entering kernel state, it is to avoid multiple CPU fight for kernel lock production Raw performance consumption.
2) it is based on Client/Server
Meat and potatoes in operating system is put into kernel, and most functions of operating system are all placed on micro- Realized in one group of server outside kernel.These system services are all realized as process, operate in User space.Cause It is isolation for the address space between User space process, it is usually the case that can not directly be communicated between different processes.One Need to call between denier difference process, such as calling between consumer process and system service, system service is provided by micro-kernel Message passing mechanism realize information exchange.So, in user, this is a kind of pattern of similar client/server, User sends request to kernel, and interior nuclear control corresponding system service, which is given, to be serviced.
Existing micro-kernel typically only provides basic hardware operation interface, and it is by all operating system (Operating System, OS) function that must provide provided by the form of system service, and different system services operate in User space;System System service is isolated each other, and exception occur even if some system service does not affect other modules yet;System service and it is Pass through interprocess communication between system service(Inter Process Communication, IPC)Mode work.
Existing Mach is all based on CLIENT/SERVER MODEL, and consumer process please by being sent to OS Message informing OS is asked to need to use a kind of system service, OS is received after request message according to the corresponding system of the situation of itself scheduling System service completes primary system service.Usual user writes the application program of oneself, the storehouse letter that some systems can be used to provide Number, these storehouses provide the interface of packaged system service mostly, the need for user is only needed to according to oneself, fill in the ginseng of correlation Number, it is possible to sensuously directly invoked some system services, functional steps said before are completed by OS.Fig. 1 is shown The process serviced on monokaryon platform using primary system.
On many-core platform, due to there are multiple kernel examples simultaneously, it is real that each CPU runs an independent kernel Example, each kernel examples are each other without interference with other side, while each process of User space can be arbitrarily by each Kernel examples are run.In this case it is also contemplated that at this moment each process may not send message on same kernel Need to use intercore communication.Internuclear transmission message needs to open a proxy module on each kernel(monitor), own Message is first pooled to agency, and message is sent to opposite end monitor by the position of proxy lookups target core from local monitor, then Opposite end target process is sent to by opposite end monitor.So, usual user using primary system service process as shown in Fig. 2 Following steps can be attributed to:
1) consumer process assembles a message, and transmits the message to kernel;
2) kernel sends a message to local monitor;
3) local monitor searches the position of target core, and message is sent into opposite end monitor;
4) opposite end monitor is received after message, and message is sent into system service;
5) system service works;
6) after system service completion work, implementing result is sent to opposite end monitor;
7) implementing result is sent to local monitor by opposite end monitor;
8) local monitor is received after implementing result, issues consumer process.
From said process, it can be seen that the service degraded performance of existing Mach.Grasped with grand kernel Compared as system, complete same primary system service, the expense of micro-kernel more than grand kernel several times it is even more many.
Grand kernel operating system(By taking Linux as an example)The system service that all OS are provided is all with written in code in kernel mould In block, the process required for completing primary system service is that user program is absorbed in kernel, is then serviced by kernel execution system, complete Cheng Houcong kernel states return to User space.Expense is only 2 context switchings.And Mach, as shown in Fig. 2 completing It is typically 8 context switchings and 2 intercore communications once to call required expense.If system service needs mutually to call, Grand kernel can complete directly invoking for difference in functionality module in kernel, and microkernel designs are accomplished by using message communicating Mode, makes CPU be toggled between the different system service in User space, the expense that intercore communication and context switching are brought Very big, performance issue is just more serious.
The content of the invention
The embodiments of the invention provide the communication means between a kind of consumer process and system service, device, it is intended to solves When prior art makes the CPU be communicated between the consumer process in User space and system service, intercore communication and context switching The expense brought is very big, the problem of performance issue is just more serious.
First aspect is there is provided the communication means between a kind of consumer process and system service, applied to multi-core platform, described Multi-core platform includes at least one first physical core and at least one second physical core, and operation has the on first physical core Operation has first agent's module and one or more consumer process, second physical core on one kernel, first kernel Upper operation has operation on the second kernel, second kernel to have second agent's module and system service, first agent's mould The shared drive address information that the system service is shared with the consumer process is preserved on block, methods described includes:
The consumer process sends first to first agent's module by the first kernel and asked, in first request Carrying the consumer process needs the first data of the system service processing;
First agent's module is received after the first request, is carried during by first kernel, described first is asked First data be written to corresponding first memory headroom of the shared drive address information with preserving;
The system service reads described the by way of second kernel is with poll from first memory headroom One data, and handled, the first data after being handled, and the first data after the processing are written to described first Memory headroom;
First agent's module reads institute by way of first kernel is with poll from first memory headroom State the first data after processing, and the first data after the processing be sent into the user by first kernel Journey.
In the first possible implementation, with reference in a first aspect, passing through described first in first agent's module Kernel reads the first data after the processing in the way of poll from first memory headroom, and passes through first kernel The first data after the processing are sent to after the consumer process, in addition to:
The shared drive address information is sent to the user by first agent's module by first kernel Process;
The consumer process sets up the connection with the system service according to the shared drive address information, and
Link information used when connection is set up between the consumer process and the system service is preserved, it is described
Link information includes the service identifiers of the system service, the shared drive address information.
In second of possible implementation, according to the first possible implementation, pass through in the consumer process First kernel is sent to first agent's module before the first request, in addition to:
Judge connection whether is had built up between the consumer process and the system service;
If it is not, then perform the consumer process by the first kernel to first agent's module send first request with And the subsequent step after the step, realize the communication between the consumer process and the system service, and set up both it Between connection;
If it is, the consumer process is according to the link information, write-in needs the first of the system service processing Data are to corresponding first memory headroom of shared drive address information with being preserved in the link information;
The system service reads first data from first memory headroom, and is handled, and obtains after processing The first data, and the first data after the processing are written to first memory headroom;
The consumer process reads the first data after the processing from first memory headroom.
In the third possible implementation, according to the first possible implementation, in first agent's module Preserving the system service shared drive address information shared with the consumer process includes:
The system service is by second kernel to operating system application shared drive;
The system service notifies the system service request to arrive by second kernel to second agent's module Shared drive address information;
Second agent's module broadcasts the shared drive address information to first agent's module;
First agent's module preserves the shared drive address information.
In the 4th kind of possible implementation, according to the first possible implementation, the consumer process is according to institute Stating the connection of the foundation of shared drive address information and the system service includes:
Corresponding first memory headroom of the shared drive address information is mapped to the system and taken by the system service The virtual address space of business;
Corresponding first memory headroom of the shared drive address information is mapped to described by first agent's module The virtual address space of one proxy module;
Corresponding first memory headroom of the shared drive address information is mapped to described use by the consumer process The virtual address space of family process.
In the 5th kind of possible implementation, with reference in a first aspect, first agent's module, the consumer process, Second agent's module and the system service are User space program.
Second aspect is there is provided the communicator between a kind of consumer process and system service, and described device is flat including multinuclear Platform, the multi-core platform is included at least one first physical core and at least one second physical core, first physical core Operation has on the first kernel, first kernel operation have first agent's module and an one or more consumer process, and described the Operation has on the second kernel, second kernel operation have second agent's module and a system service on two physical cores, and described the The shared drive address information that the system service is shared with the consumer process is preserved on one proxy module, described device is also Including memory, the consumer process, first agent's module, second agent's module and the system service are stored In the memory:
First kernel, the first agent's module stored for reading in memory, and to the first agent Module sends first and asked, and the consumer process is carried in first request needs the first number of the system service processing According to;
First kernel is additionally operable to, and first data carried during described first is asked are written to the institute with preserving State corresponding first memory headroom of shared drive address information;
Second kernel, for reading first data from first memory headroom in the way of poll, goes forward side by side Row processing, the first data after being handled, and the first data after the processing are written to first memory headroom;
First kernel is additionally operable to, from first after first memory headroom reading processing in the way of poll Data, and the first data after the processing are sent to by the consumer process by first kernel.
, will be described common with reference in a first aspect, first kernel is additionally operable in the first possible implementation Enjoy memory address information and be sent to the consumer process, performed and built according to the shared drive address information by the consumer process The vertical connection with the system service, and preserve company used when connection is set up between the consumer process and the system service Information is connect, the link information includes the service identifiers of the system service, the method for the shared drive address information.
In second of possible implementation, according to the first possible implementation, first kernel is additionally operable to, Judge connection whether is had built up between the consumer process and the system service, if it is not, then first setting up and the system Connection between service, and used link information when setting up connection between the two is preserved, if it is, reading in memory The consumer process of storage, is performed according to the link information, write-in is needed at the system service by the consumer process Method of first data of reason to corresponding first memory headroom of shared drive address information with being preserved in the link information;
Second kernel is additionally operable to read the system service that stores in memory, by the system service perform from First memory headroom reads first data, and is handled, the first data after being handled, and by the processing The method that the first data afterwards are written to first memory headroom;
First kernel is additionally operable to, and is read the consumer process stored in memory, is performed by the consumer process The method that the first data after the processing are read from first memory headroom.
In the third possible implementation, according to the first possible implementation, second kernel is additionally operable to, First the shared drive that the system service request is arrived is notified to operating system application shared drive, then to second agent's module Address information is performed the side that the shared drive address information is broadcasted to first agent's module from second agent's module Method;
First kernel is additionally operable to read the first agent's module stored in memory, by first agent's mould Block performs the method for preserving the shared drive address information.
In the 4th kind of possible implementation, according to the first possible implementation, second kernel is additionally operable to, The system service stored in memory is read, is performed by the system service by the shared drive address information corresponding first The method that memory headroom maps to the virtual address space of the system service;
First kernel is additionally operable to, and the first agent's module stored in memory is read, by the first agent Module performs corresponding first memory headroom of the shared drive address information mapping to the virtual of first agent's module Address space;
First kernel is additionally operable to, and is read the consumer process stored in memory, is performed by the consumer process Corresponding first memory headroom of the shared drive address information is mapped to the side of the virtual address space of the consumer process Method.
In the 5th kind of possible implementation, with reference to second aspect, first agent's module, the consumer process, Second agent's module and the system service are User space program.
In the embodiment of the present invention, consumer process sends first to first agent's module by the first kernel and asked, and first please The first data that the consumer process needs system service to handle are carried in asking;First agent's module receives the first request Afterwards, the first data carried during first is asked by the first kernel are written to corresponding with the shared drive address information preserved First memory headroom;System service reads the first data by way of the second kernel is with poll from the first memory headroom, goes forward side by side Row processing, the first data after being handled, and the first data after processing are written to the first memory headroom;First agent's mould Block is incited somebody to action by way of the first kernel is with poll from the first data after the first memory headroom reading process, and by the first kernel The first data after processing are sent to consumer process.Prior art user process is once communicated with system service needs 8 The overhead that secondary context switches+2 intercore communications is reduced to 4 contexts+2 intercore communications of switching, greatly reduces The expense of context switching.
Brief description of the drawings
Fig. 1 is the process schematic serviced on the monokaryon platform that the present invention is provided using primary system;
Fig. 2 is the process schematic that the Mach that the present invention is provided completes primary system service call;
Fig. 3 is the implementation process of the method for the calling system service that one embodiment of the invention is provided;
Fig. 4 is the realization stream of the communication means between the consumer process that further embodiment of this invention is provided and system service Journey;
Fig. 5 is the realization stream of the communication means between the consumer process that further embodiment of this invention is provided and system service Journey;
Fig. 6 is that the linear address of internal memory provided in an embodiment of the present invention divides schematic diagram;
Fig. 7 is the division schematic diagram of shared physical memory provided in an embodiment of the present invention;
Fig. 8 is the structured flowchart of the communicator between the consumer process that one embodiment of the invention is provided and system service;
Fig. 9 is the structural frames of the communicator between the consumer process that further embodiment of this invention is provided and system service Figure.
Embodiment
In order to make the purpose , technical scheme and advantage of the present invention be clearer, it is right below in conjunction with drawings and Examples The present invention is further elaborated.It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, and It is not used in the restriction present invention.
In embodiments of the present invention, consumer process sends first to first agent's module by the first kernel and asked, and first The first data that the consumer process needs system service to handle are carried in request;First agent's module receives the first request Afterwards, the first data carried during first is asked by the first kernel are written to corresponding with the shared drive address information preserved First memory headroom;System service reads the first data by way of the second kernel is with poll from the first memory headroom, goes forward side by side Row processing, the first data after being handled, and the first data after processing are written to the first memory headroom;First agent's mould Block is incited somebody to action by way of the first kernel is with poll from the first data after the first memory headroom reading process, and by the first kernel The first data after processing are sent to consumer process.
The realization of the present invention is described in detail below in conjunction with specific embodiment:
Fig. 3 shows the realization stream of the communication means between the consumer process of one embodiment of the invention offer and system service Journey, this method can apply to multi-core platform, wherein, the multi-core platform include at least one first physical core and at least one On second physical core, the first physical core operation have on the first kernel, the first kernel operation have first agent's module and one or Operation has operation on the second kernel, the second kernel to have second agent's module and system on multiple consumer process, the second physical core Service, and the shared drive address information that system service is shared with consumer process is preserved in first agent's module, wherein, first Proxy module, consumer process, second agent's module and system service are User space program.For convenience of description, only show Part related to the present embodiment, details are as follows:
Step S301, consumer process send first to first agent's module by the first kernel and asked, and are taken in the first request The first data that system service is handled are needed with consumer process.
In embodiments of the present invention, it is necessary to by the kernel of the preset number in operating system before os starting Mark off and be used as system service kernel, specific system service is run on these system service kernels.Under normal circumstances, this On a little system service kernels, system service is obtained can be without release after CPU, it is possible to reduce unnecessary context switching;Remove Non- to be necessary, system service can give CPU controls system service kernel, and system service kernel can run core functions Or be scheduled, run some other necessary processes, such as, in the present embodiment, second will run on the second physical core Kernel is as a system service kernel, and operation has system specified service on the second kernel.
Also need to set up a monitor on these system service kernels, such as, operation has second on the second kernel Proxy module, because system service is all to carry out registration in an operating system, monitor is internuclear in each except setting up Communication is outer, can set up and connect with each system service.In the present embodiment, monitor and system service is allowed directly to set up use The communication of family state.So monitor just can directly invoke system service by using the communication of family state, reduce and be switched to target system The process of system service.In addition, when system service is migrated, i.e., system service is from a kernel migration to another kernel When, system service need to migrate to the corresponding monitor of kernel register oneself.
Also need to change the memory management module of operating system, the linear address of internal memory is divided into three parts, kernel Space Kernel Space, user's space User Space and shared address space.Shared address space has fixed skew Offset and size, so sharing address space just has fixed physical location.Then, shared address space is divided into pre- If the shared physical memory Shared Space of number, as shown in fig. 6, each shared physical memory makes for different system services With, describe for convenience, by the system service request in the present embodiment to be referred to as the first internal memory empty in shared physical memory space Between.
Each shared physical memory is divided into head and message body two parts, as shown in fig. 7, wherein, head, which is used to set, marks Will position, is used for containing used used, mark ID, label tags and two bitmap images bitmap, used bitmap used bitmap Consumer process request free memory space, preparation bitmap ready bitmap are used for service processes and read message blocks, message body quilt It is divided into the message blocks of fixed size one by one, such as message blocks Msg block1, message blocks Msg block2, these message blocks Corresponded with the flag bit in the bitmap on head, such as, Msg block1 are corresponding with first flag bit in bitmap, Msg block2 are corresponding with second flag bit in bitmap.
After os starting, the monitor on each kernel starts first, is initially set up between all monitor Full connection;Secondly, system service starts, and the system service after startup can send initiation message to local monitor, locally Monitor sends initiation message to all other monitor, the system that then all monitor just can be with the startup Connection is set up in service.In addition, a shared physical memory can be obtained after system service process initiation to operating system application, and Some flag bits in the shared physical memory are changed, some system service that belongs to declared in this shared physical memory makes With, and the shared physical memory mappings to the virtual address space of oneself;It can broadcast the message simultaneously, tell each kernel On the shared physical memories that take of monitor oneself, monitor also the shared physical memory mappings to oneself virtually Location space, both sides can just operate this block to share physical memory simultaneously and communicate.
Step S302, first agent's module are received after the first request, are carried during by the first kernel, first is asked First data are written to the first memory headroom corresponding with the shared drive address information preserved.
In embodiments of the present invention, the first kernel inquires about the totally first memory headroom corresponding with the shared drive address information It is whether idle, if idle, the first data are write in first memory headroom, after write-in is finished, set ready Corresponding flag bit in bitmap, shows that the first data are write in which message blocks in the first memory headroom.
Step S303, system service read the first data by way of the second kernel is with poll from the first memory headroom, And handled, the first data after being handled, and the first data after processing are written to first memory headroom.
In embodiments of the present invention, the second kernel poll ready bitmap, once find the phase in ready bitmap Answer flag bit to be set, then the first data are read from first memory headroom, and provide corresponding service.System service is provided After service terminates, the flag bit in corresponding ready bitmap and used bitmap is wiped.
Step S304, first agent's module are by way of the first kernel is with poll after the first memory headroom reading process The first data, and the first data after processing are sent to by consumer process by the first kernel.
, wherein it is desired to which explanation, shared drive address information includes the system service communicated with consumer process The address for the first memory headroom applied.
It can cause to preserve system service and sharing that consumer process is shared in first agent's module by following steps Memory address information:
Step 1, system service are by the second kernel to operating system application shared drive.
Wherein, can also be by other method application shared drives, just can be with to one piece of shared drive as long as can apply, It is not specifically limited herein.
The shared drive that step 2, system service are arrived by the second kernel to the notice system service request of second agent's module Address information.
Step 3, second agent's module broadcast the shared drive address information to first agent's module.
Wherein, second agent's module can broadcast the shared drive address to all proxy modules by way of broadcast and believe Breath, first agent's module with broadcast listening, can get the address of the first memory headroom used in system service.Certainly, This can also be total to by two proxy modules by operating system by operating system by the communication mode between the processes such as pipeline, mailbox Memory address information transfer is enjoyed to first agent's module, specifically using which kind of mode, this is not restricted.
Step 4, first agent's module preserve the shared drive address information.
The present embodiment, between consumer process and system service, switching+2 intercore communications by 4 contexts can complete Once communicate, greatly reduce the expense of context switching.
Fig. 4 shows the realization of the communication means between the consumer process of further embodiment of this invention offer and system service Flow, this method can apply to multi-core platform, wherein, the multi-core platform includes at least one first physical core and at least one Operation has operation on the first kernel, the first kernel to have first agent's module and one on individual second physical core, the first physical core Or multiple consumer process, operation has operation on the second kernel, the second kernel to have second agent's module and be on the second physical core System service, and the shared drive address information that system service is shared with consumer process is preserved in first agent's module, wherein, the One proxy module, consumer process, second agent's module and system service are User space program.For convenience of description, only show Part related to the present embodiment is gone out, details are as follows:
Step S401, consumer process send first to first agent's module by the first kernel and asked, and are taken in the first request The first data that system service is handled are needed with consumer process.
Step S402, first agent's module are received after the first request, are carried during by the first kernel, first is asked First data are written to the first memory headroom corresponding with the shared drive address information preserved.
Step S403, system service read the first data by way of the second kernel is with poll from the first memory headroom, And handled, the first data after being handled, and the first data after processing are written to first memory headroom.
Step S404, first agent's module are by way of the first kernel is with poll after the first memory headroom reading process The first data, and the first data after processing are sent to by consumer process by the first kernel.
Shared drive address information is sent to consumer process by step S405, first agent's module by the first kernel.
Step S406, consumer process set up the connection with system service according to shared drive address information, and preserve user Link information used during foundation connection between process and system service, service identifiers of the link information including system service, Shared drive address information.
Wherein, consumer process is set up the process being connected with system service according to shared drive address information and specifically included:
Step 11, system service map to shared drive address information corresponding first memory headroom the void of system service Intend address space.
Corresponding first memory headroom of shared drive address information is mapped to first agent by step 12, first agent's module The virtual address space of module.
Step 13, consumer process map to shared drive address information corresponding first memory headroom the void of consumer process Intend address space.
The present embodiment, is completed between consumer process and system service after once communicating, and first agent's module is by first Shared drive address information is sent to consumer process by core, and consumer process is set up and system service according to shared drive address information Connection, and preserve link information used when connection is set up between consumer process and system service, subsequently, consumer process and be System service can be by operating corresponding first memory headroom of the shared drive address information to realize communication.
Fig. 5 shows the realization of the communication means between the consumer process of further embodiment of this invention offer and system service Flow, this method can apply to multi-core platform, wherein, the multi-core platform includes at least one first physical core and at least one Operation has operation on the first kernel, the first kernel to have first agent's module and one on individual second physical core, the first physical core Or multiple consumer process, operation has operation on the second kernel, the second kernel to have second agent's module and be on the second physical core System service, and the shared drive address information that system service is shared with consumer process is preserved in first agent's module, wherein, the One proxy module, consumer process, second agent's module and system service are User space program.For convenience of description, only show Part related to the present embodiment is gone out, details are as follows:
Step S501, judge connection whether is had built up between consumer process and system service, if it is not, then performing successively Step S502 is to S507, if it is, performing step S508 to S510 successively.
Step S502, consumer process send first to first agent's module by the first kernel and asked, and are taken in the first request The first data that system service is handled are needed with consumer process.
Step S503, first agent's module are received after the first request, are carried during by the first kernel, first is asked First data are written to the first memory headroom corresponding with the shared drive address information preserved.
Step S504, system service read the first data by way of the second kernel is with poll from the first memory headroom, And handled, the first data after being handled, and the first data after processing are written to first memory headroom.
Step S505, first agent's module are by way of the first kernel is with poll after the first memory headroom reading process The first data, and the first data after processing are sent to by consumer process by the first kernel.
Shared drive address information is sent to consumer process by step S506, first agent's module by the first kernel.
Step S507, consumer process set up the connection with system service according to shared drive address information, and preserve user Link information used during foundation connection between process and system service, service identifiers of the link information including system service, Shared drive address information.
Step S508, consumer process are according to link information, and write-in needs the first data that system service is handled to being connected Corresponding first memory headroom of shared drive address information preserved in information.
Step S509, system service read the first data from the first memory headroom, and are handled, and the after being handled One data, and the first data after processing are written to the first memory headroom.
Step S510, consumer process are from the first data after the first memory headroom reading process.
The present embodiment, before being communicated between consumer process and system service, first judges whether both set up connection, If having built up connection, according to what is preserved in link information used when connection is set up between consumer process and system service Shared drive address information, operates corresponding first memory headroom of the shared drive address information to realize communication, once communicates Process only needs to 2 intercore communications, greatly reduces the expense of context switching.
Fig. 8 shows the concrete structure of the communicator between consumer process provided in an embodiment of the present invention and system service Block diagram, for convenience of description, illustrate only the part related to the embodiment of the present invention.Described device 8 includes multi-core platform, described Multi-core platform includes at least one first physical core and at least one second physical core, and operation has the on first physical core Operation has first agent's module 81 and one or more consumer process 82, second thing on one kernel, first kernel Operation has on the second kernel, second kernel operation have second agent's module 83 and a system service 84 on reason core, and described the The shared drive address information that the system service 84 is shared with the consumer process 82 is preserved on one proxy module 81, its In, first agent's module 81, the consumer process 82, second agent's module 83 and the system service 84 are User space program.The consumer process 82 includes:
First request transmitting unit 821, is asked, institute for sending first to first agent's module by the first kernel State and the first data that the consumer process needs the system service to handle are carried in the first request;
First agent's module 81 includes:
The one the first data write units 811, for receiving after the first request, by first kernel by described It is empty that first data carried in one request are written to the first internal memory corresponding with the shared drive address information preserved Between;
The system service 84 includes:
The one the first data processing units 841, for second kernel with poll by way of out of described first Deposit space and read first data, and handled, the first data after being handled, and first after the processing is counted According to being written to first memory headroom;
First agent's module 81 also includes:
The one the first data-reading units 812, for first kernel with poll by way of out of described first Deposit space and read the first data after the processing, and be sent to the first data after the processing by first kernel The consumer process.
Further, first agent's module 81 also includes:
Shared drive address information transmitting element, for being sent out the shared drive address information by first kernel Give the consumer process;
The consumer process 82 also includes:
Connection establishment unit, for setting up the connection with the system service according to the shared drive address information, and Link information used when connection is set up between the consumer process and the system service is preserved, the link information includes institute State the service identifiers of system service, the shared drive address information.
Further, the consumer process 82 also includes:
Connection judgment unit, for judging whether have built up connection between the system service, if it is not, then first building Connection between vertical and described system service, and preserve used link information when setting up connection between the two;
The two the first data write units, for if it is, according to the link information, write-in needs the system clothes Be engaged in processing the first data to corresponding first memory headroom of shared drive address information with being preserved in the link information;
The system service 84 also includes:
The two the first data processing units, for reading first data from first memory headroom, and are located Reason, the first data after being handled, and the first data after the processing are written to first memory headroom;
The consumer process 82 also includes:
The two the first data-reading units, for reading the first data after the processing from first memory headroom.
Further, the system service 84 also includes:
Shared drive application unit 842, for by second kernel to operating system application shared drive;
Address information notification unit 843, for notifying the system to second agent's module by second kernel The shared drive address information that system service request is arrived;
Second agent's module 83 includes:
Broadcasting address information unit 831, for broadcasting the shared drive address information to first agent's module;
First agent's module 81 includes:
Address information storage unit 813, for preserving the shared drive address information.
Further, the system service 83 also includes:
First map unit, for corresponding first memory headroom of the shared drive address information to be mapped into the system The virtual address space of system service;
First agent's module 81 also includes:
Second mapping block, for corresponding first memory headroom of the shared drive address information to be mapped into described The virtual address space of one proxy module;
The connection establishment unit of the consumer process 82 includes:
3rd mapping block, for corresponding first memory headroom of the shared drive address information to be mapped into the use The virtual address space of family process.
Device provided in an embodiment of the present invention can be applied in foregoing corresponding embodiment of the method, and details are referring to above-mentioned side The description of method embodiment, will not be repeated here.
Fig. 9 shows the concrete structure of the communicator between consumer process provided in an embodiment of the present invention and system service Block diagram, for convenience of description, illustrate only the part related to the embodiment of the present invention.Described device 9 includes multi-core platform, described Multi-core platform includes at least one first physical core and at least one second physical core, and operation has the on first physical core Operation has first agent's module and one or more consumer process, second thing on one kernel 91, first kernel 91 Operation has on the second kernel 92, second kernel 92 operation have second agent's module and a system service on reason core, and described the The shared shared drive address information of consumer process described in the system service is preserved on one proxy module, wherein, the first generation It is User space program to manage module, consumer process, second agent's module and system service, is stored in memory 93.
Wherein, the first kernel 91, the first agent's module stored for reading in memory 93, and to the first agent Module sends first and asked, and the consumer process is carried in first request needs the first number of the system service processing According to;
First kernel 91 is additionally operable to, and first data carried during described first is asked are written to and preservation Corresponding first memory headroom of the shared drive address information;
Second kernel 92, for reading first data from first memory headroom in the way of poll, and is carried out Processing, the first data after being handled, and the first data after the processing are written to first memory headroom;
First kernel 91 is additionally operable to, and reads the first number after the processing from first memory headroom in the way of poll According to, and the first data after the processing are sent to by the consumer process by first kernel.
Further, the first kernel 91 is additionally operable to, and the shared drive address information is sent into the consumer process, by The consumer process performs the connection according to shared drive address information foundation and the system service, and preserves the use Link information used during connection is set up between family process and the system service, the link information includes the system service Service identifiers, the method for the shared drive address information.
Further, whether the first kernel 91 is additionally operable to, judge between the consumer process and the system service Connection is set up, if it is not, then the first connection between foundation and the system service, and made when preserving foundation connection between the two Link information, if it is, reading the consumer process stored in memory, is performed according to institute by the consumer process Link information is stated, write-in needs the first data that the system service is handled to the shared drive with being preserved in the link information The method of corresponding first memory headroom of address information;
Second kernel 92 is additionally operable to, and is read the system service stored in memory 93, is performed by the system service First data are read from first memory headroom, and are handled, the first data after being handled, and by the place The method that the first data after reason are written to first memory headroom;
First kernel 91 is additionally operable to, and is read the consumer process stored in memory 93, is performed by the consumer process The method that the first data after the processing are read from first memory headroom.
Further, the second kernel 92 is additionally operable to, first to operating system application shared drive, then to second agent's mould Block notify the system service request to shared drive address information performed from second agent's module to the first generation Manage the method that module broadcasts the shared drive address information;
First kernel 91 is additionally operable to, and the first agent's module stored in memory 93 is read, by the first agent Module performs the method for preserving the shared drive address information.
Further, the second kernel 92 is additionally operable to, and the system service stored in memory 93 is read, by the system service Perform the virtual address space that corresponding first memory headroom of the shared drive address information is mapped to the system service Method;
First kernel 91 is additionally operable to, and the first agent's module stored in memory 93 is read, by the first agent Module performs corresponding first memory headroom of the shared drive address information mapping to the virtual of first agent's module Address space;
First kernel 91 is additionally operable to, and is read the consumer process stored in memory 93, is performed by the consumer process Corresponding first memory headroom of the shared drive address information is mapped to the side of the virtual address space of the consumer process Method.
Device provided in an embodiment of the present invention can be applied in foregoing corresponding embodiment of the method, and details are referring to above-mentioned side The description of method embodiment, will not be repeated here.
It is worth noting that, in said apparatus embodiment, included unit is simply drawn according to function logic Point, but above-mentioned division is not limited to, as long as corresponding function can be realized;In addition, each functional unit is specific Title is also only to facilitate mutually distinguish, the protection domain being not intended to limit the invention.
In addition, one of ordinary skill in the art will appreciate that realizing all or part of step in the various embodiments described above method It can be by program to instruct the hardware of correlation to complete, corresponding program can be stored in embodied on computer readable storage Jie In matter, described storage medium, such as ROM/RAM, disk or CD.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the invention, all essences in the present invention Any modifications, equivalent substitutions and improvements made within refreshing and principle etc., should be included in the scope of the protection.

Claims (10)

1. the communication means between a kind of consumer process and system service, it is characterised in that applied to multi-core platform, the multinuclear Platform, which includes running at least one first physical core and at least one second physical core, first physical core, to be had in first Operation has and transported on first agent's module and one or more consumer process, second physical core on core, first kernel Row has operation on the second kernel, second kernel to have in second agent's module and system service, first agent's module The shared drive address information that the system service is shared with the consumer process is preserved, methods described includes:
The consumer process sends first to first agent's module by the first kernel and asked, and is carried in first request There is the consumer process to need the first data of the system service processing;
First agent's module is received after the first request, the institute carried during described first is asked by first kernel State the first data and be written to the first memory headroom corresponding with the shared drive address information preserved;
The system service reads first number by way of second kernel is with poll from first memory headroom According to, and handled, the first data after being handled, and the first data after the processing are written to first internal memory Space;
First agent's module is read from described by way of first kernel is with poll from first memory headroom The first data after reason, and the first data after the processing are sent to by the consumer process by first kernel;
Read in first agent's module by way of first kernel is with poll from first memory headroom described The first data after processing, and by first kernel by the first data after the processing be sent to the consumer process it Afterwards, in addition to:
The shared drive address information is sent to the consumer process by first agent's module by first kernel;
The consumer process sets up the connection with the system service according to the shared drive address information, and preserves the use Link information used during connection is set up between family process and the system service, the link information includes the system service Service identifiers, the shared drive address information.
2. the method as described in claim 1, it is characterised in that in the consumer process by the first kernel to the first generation Reason module is sent before the first request, in addition to:
Judge connection whether is had built up between the consumer process and the system service;
The first request is sent to first agent's module by the first kernel and is somebody's turn to do if it is not, then performing the consumer process Subsequent step after step, realizes the communication between the consumer process and the system service, and set up between the two Connection;
If it is, the consumer process is according to the link information, write-in needs the first data of the system service processing To corresponding first memory headroom of shared drive address information with being preserved in the link information;
The system service reads first data from first memory headroom, and is handled, and the after being handled One data, and the first data after the processing are written to first memory headroom;
The consumer process reads the first data after the processing from first memory headroom.
3. the method as described in claim 1, it is characterised in that preserved in first agent's module the system service with The shared shared drive address information of the consumer process includes:
The system service is by second kernel to operating system application shared drive;
The system service by second kernel to second agent's module notify the system service request to be total to Enjoy memory address information;
Second agent's module broadcasts the shared drive address information to first agent's module;
First agent's module preserves the shared drive address information.
4. the method as described in claim 1, it is characterised in that the consumer process is built according to the shared drive address information The vertical connection with the system service includes:
Corresponding first memory headroom of the shared drive address information is mapped to the system service by the system service Virtual address space;
Corresponding first memory headroom of the shared drive address information is mapped to the first generation by first agent's module Manage the virtual address space of module;
Corresponding first memory headroom of the shared drive address information is mapped to the consumer process by the consumer process Virtual address space.
5. the method as described in claim 1, it is characterised in that first agent's module, the consumer process, described second Proxy module and the system service are User space program.
6. the communicator between a kind of consumer process and system service, it is characterised in that described device includes multi-core platform, institute Multi-core platform is stated including at least one first physical core and at least one second physical core, being run on first physical core has Operation has first agent's module and one or more consumer process, second physics on first kernel, first kernel Operation has operation on the second kernel, second kernel to have second agent's module and system service, the first agent on core The shared drive address information that the system service is shared with the consumer process is preserved in module, described device also includes depositing Reservoir, the consumer process, first agent's module, second agent's module and the system service are stored in described In memory:
First kernel, the first agent's module stored for reading in memory, and to first agent's module Send first to ask, the consumer process is carried in first request needs the first data of the system service processing;
First kernel is additionally operable to, and first data carried during described first is asked are written to described common with preservation Enjoy corresponding first memory headroom of memory address information;
Second kernel, for reading first data from first memory headroom in the way of poll, and is located Reason, the first data after being handled, and the first data after the processing are written to first memory headroom;
First kernel is additionally operable to, and reads the first number after the processing from first memory headroom in the way of poll According to, and the first data after the processing are sent to by the consumer process by first kernel;
First kernel is additionally operable to, and the shared drive address information is sent into the consumer process, is used by described Family process performs the connection according to shared drive address information foundation and the system service, and preserves the consumer process Link information used when being connected is set up between the system service, the link information includes the service of the system service Mark, the method for the shared drive address information.
7. device as claimed in claim 6, it is characterised in that first kernel is additionally operable to, judge the consumer process and Whether connection is had built up between the system service, if it is not, then the connection first set up between the system service, and protect Used link information when setting up connection between the two is deposited, if it is, the consumer process stored in memory is read, Performed by the consumer process according to the link information, write-in need the first data of the system service processing to it is described The method of corresponding first memory headroom of shared drive address information preserved in link information;
Second kernel is additionally operable to read the system service stored in memory, is performed by the system service from described First memory headroom reads first data, and is handled, the first data after being handled, and by after the processing The method that first data are written to first memory headroom;
First kernel is additionally operable to, and reads the consumer process stored in memory, is performed by the consumer process from institute State the method that the first memory headroom reads the first data after the processing.
8. device as claimed in claim 6, it is characterised in that second kernel is additionally operable to, first common to operating system application Internal memory is enjoyed, then notifies the shared drive address information that the system service request is arrived by described second to second agent's module Proxy module performs the method that the shared drive address information is broadcasted to first agent's module;
First kernel is additionally operable to read the first agent's module stored in memory, is held by first agent's module The method that row preserves the shared drive address information.
9. device as claimed in claim 6, it is characterised in that second kernel is additionally operable to, reads what is stored in memory System service, is mapped to corresponding first memory headroom of the shared drive address information by system service execution described The method of the virtual address space of system service;
First kernel is additionally operable to, and the first agent's module stored in memory is read, by first agent's module Perform the virtual address that corresponding first memory headroom of the shared drive address information is mapped to first agent's module Space;
First kernel is additionally operable to, and reads the consumer process stored in memory, is performed by the consumer process by institute State the method that corresponding first memory headroom of shared drive address information maps to the virtual address space of the consumer process.
10. device as claimed in claim 6, it is characterised in that first agent's module, the consumer process, described Two proxy modules and the system service are User space program.
CN201310207082.2A 2013-05-29 2013-05-29 Communication means, device between a kind of consumer process and system service Active CN104216862B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310207082.2A CN104216862B (en) 2013-05-29 2013-05-29 Communication means, device between a kind of consumer process and system service

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310207082.2A CN104216862B (en) 2013-05-29 2013-05-29 Communication means, device between a kind of consumer process and system service

Publications (2)

Publication Number Publication Date
CN104216862A CN104216862A (en) 2014-12-17
CN104216862B true CN104216862B (en) 2017-08-04

Family

ID=52098369

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310207082.2A Active CN104216862B (en) 2013-05-29 2013-05-29 Communication means, device between a kind of consumer process and system service

Country Status (1)

Country Link
CN (1) CN104216862B (en)

Families Citing this family (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105786612B (en) * 2014-12-23 2019-05-24 杭州华为数字技术有限公司 A kind of method for managing resource and device
CN105487933A (en) * 2015-11-24 2016-04-13 无锡江南计算技术研究所 Inter-kernel asynchronous message queue and shared memory based inter-domain communication method
CN107046508B (en) * 2016-02-05 2020-01-31 华为技术有限公司 Message receiving method and network equipment
US10599494B2 (en) 2016-05-27 2020-03-24 Huawei Technologies Co., Ltd. Method and system of performing inter-process communication between OS-level containers in user space
CN107077377B (en) * 2016-12-29 2020-08-04 深圳前海达闼云端智能科技有限公司 Equipment virtualization method, device and system, electronic equipment and computer program product
WO2019035660A1 (en) * 2017-08-16 2019-02-21 Samsung Electronics Co., Ltd. Method and apparatus for managing scheduling of services during boot-up
CN107563224B (en) * 2017-09-04 2020-07-28 浪潮集团有限公司 Multi-user physical isolation method and device
CN107766162A (en) * 2017-10-30 2018-03-06 北京明华联盟科技有限公司 The execution method, apparatus and terminal device of a kind of operational order
CN110402568B (en) * 2018-02-24 2020-10-09 华为技术有限公司 Communication method and device
CN109189584B (en) * 2018-07-05 2021-02-19 北京三快在线科技有限公司 Communication method and device between application programs, electronic equipment and storage medium
CN111316244A (en) * 2018-12-28 2020-06-19 深圳市大疆创新科技有限公司 Method and system for communication among multiple processes
CN110502312A (en) * 2019-08-15 2019-11-26 东软集团股份有限公司 A kind of method for reading data, date storage method and device
CN113867828A (en) * 2020-06-30 2021-12-31 华为技术有限公司 Method and device for running process
CN114090273A (en) * 2020-07-30 2022-02-25 华为技术有限公司 Method and device for interprocess communication and computer storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004086926A (en) * 1997-04-25 2004-03-18 Hewlett Packard Co <Hp> Method for accessing microkernel and agent of processing unit
CN101149728A (en) * 2007-10-29 2008-03-26 中国科学院计算技术研究所 Multiple core processing system and its management method
CN101216780A (en) * 2007-01-05 2008-07-09 中兴通讯股份有限公司 Method and apparatus for accomplishing multi-instance and thread communication under SMP system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004086926A (en) * 1997-04-25 2004-03-18 Hewlett Packard Co <Hp> Method for accessing microkernel and agent of processing unit
CN101216780A (en) * 2007-01-05 2008-07-09 中兴通讯股份有限公司 Method and apparatus for accomplishing multi-instance and thread communication under SMP system
CN101149728A (en) * 2007-10-29 2008-03-26 中国科学院计算技术研究所 Multiple core processing system and its management method

Also Published As

Publication number Publication date
CN104216862A (en) 2014-12-17

Similar Documents

Publication Publication Date Title
CN104216862B (en) Communication means, device between a kind of consumer process and system service
JP5726316B2 (en) Lockless, zero-copy messaging scheme for telecommunications network applications
US10476697B2 (en) Network-on-chip, data transmission method, and first switching node
CN110113420A (en) Distributed Message Queue management system based on NVM
CN103607428B (en) A kind of method and apparatus for accessing shared drive
CN109376197B (en) Data synchronization method, server and computer storage medium
CN104796337A (en) Method and device for forwarding message
CN112910685B (en) Method and device for realizing unified management of container network
CN103095546A (en) Method, device and data center network for processing messages
CN112783667B (en) Memory sharing system and method based on virtual environment
US10826812B2 (en) Multiple quorum witness
WO2013181939A1 (en) Virtualized management method for hardware resources of communication device and relevant apparatus
EP3138003A1 (en) System and method for supporting a bypass-domain model and a proxy model and updating service information for across-domain messaging in a transactional middleware machine environment
CN104424122B (en) A kind of electronic equipment and memory division methods
CN104123265A (en) Method and system for communication among multiple kernels
CN113204407B (en) Memory supermanagement method and device
CN104937565B (en) Address realm transmission from first node to section point
CN108702370A (en) Multithread for network technology interweaves
CN109062681A (en) A kind of execution method, system, device and the storage medium of periodic cycle task
CN104102550A (en) Method for communicating among multiple host machine processes
CN103581277A (en) Distributing method and system of data center virtualization network address and directory server
CN103282888A (en) Data processing method, graphics processing unit (gpu) and first node device
CN107608806A (en) The system and method for quick access transport data between a kind of virtual machine
CN102291298B (en) Efficient computer network communication method oriented to long message
US20200241943A1 (en) Message passing in a data processing system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20201023

Address after: 3 / F, building a, science and technology entrepreneurship R & D incubation complex building (Building 5), Nanjing Baixia hi tech Development Zone, No. 5, Yongzhi Road, Qinhuai District, Nanjing, Jiangsu Province

Patentee after: Nanjing silex Information Technology Co.,Ltd.

Address before: Room 625, nuopao Plaza, 269 Qianjin 1st Road, Xin'an street, Bao'an District, Shenzhen City, Guangdong Province

Patentee before: SHENZHEN SHANGGE INTELLECTUAL PROPERTY SERVICE Co.,Ltd.

Effective date of registration: 20201023

Address after: Room 625, nuopao Plaza, 269 Qianjin 1st Road, Xin'an street, Bao'an District, Shenzhen City, Guangdong Province

Patentee after: SHENZHEN SHANGGE INTELLECTUAL PROPERTY SERVICE Co.,Ltd.

Address before: 518129 Bantian HUAWEI headquarters office building, Longgang District, Guangdong, Shenzhen

Patentee before: HUAWEI TECHNOLOGIES Co.,Ltd.