WO2014173119A1 - 一种众核间通信方法及系统 - Google Patents

一种众核间通信方法及系统 Download PDF

Info

Publication number
WO2014173119A1
WO2014173119A1 PCT/CN2013/087395 CN2013087395W WO2014173119A1 WO 2014173119 A1 WO2014173119 A1 WO 2014173119A1 CN 2013087395 W CN2013087395 W CN 2013087395W WO 2014173119 A1 WO2014173119 A1 WO 2014173119A1
Authority
WO
WIPO (PCT)
Prior art keywords
service
shared memory
memory address
user
system service
Prior art date
Application number
PCT/CN2013/087395
Other languages
English (en)
French (fr)
Inventor
吴小科
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Priority to EP13882839.7A priority Critical patent/EP2977909A4/en
Publication of WO2014173119A1 publication Critical patent/WO2014173119A1/zh
Priority to US14/920,331 priority patent/US9990306B2/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/10Address translation
    • G06F12/1072Decentralised address translation, e.g. in distributed shared memory systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F15/00Digital computers in general; Data processing equipment in general
    • G06F15/16Combinations of two or more digital computers each having at least an arithmetic unit, a program unit and a register, e.g. for a simultaneous processing of several programs
    • G06F15/163Interprocessor communication
    • G06F15/167Interprocessor communication using a common memory, e.g. mailbox
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/544Buffers; Shared memory; Pipes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/10Providing a specific technical effect
    • G06F2212/1016Performance improvement
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/65Details of virtual memory and virtual address translation

Definitions

  • the present invention relates to the field of computer hardware technologies, and in particular, to a method and system for communication between many cores. Background technique
  • the Microkernel Operating System (English: Microkernel Operating System) architecture was developed in the late 1980s and is well suited for distributed system environments due to its efficient support for multiprocessor operation.
  • the microkernel is an operating system kernel that provides the necessary services.
  • the necessary monthly tasks include tasks, threads, and interprocess communication (English: Inter Process Communication, IPG) and memory management. All services of the microkernel (including device drivers) run in user mode, while processing services are the same as processing other programs, and each service runs in its own address space, and the services are protected from each other.
  • FIG. 1 is a schematic diagram of a client/server model based on a microkernel operating system provided by the prior art.
  • both a user process and a system service are connected to a microkernel.
  • the microkernel sends the request information of the system service, and the microkernel responds to the received request information, and schedules the system service process corresponding to the requested information.
  • the system service processes the user request, the system sends a message to the kernel, and finally the kernel responds to the received message.
  • GPU Central Processing Unit
  • FIG. 2 is a schematic diagram of communication between a user process of a many-core architecture and a system service process provided by the prior art.
  • IPG inter-core communication needs to run a proxy service on each micro-kernel.
  • Monitoring (English: Monitor), Monitor is responsible for managing the microkernel data structure, and coordinating intra-core and inter-core communication. After the system is started, all Monitors in the system form a full connection, which is connected in pairs. At the same time Monitor uses an array to maintain a list of services on the microkernel and provides a globally unique identifier for each service in the system.
  • the user process When the user process requests the service, it first sends a message to the microkernel.
  • the microkernel schedules the monitor to run. Mon i tor will judge whether the system service requested by the user is on the same microkernel according to the content of the message. If not, according to FIG. Processing, that is, the local Monitor sends a message to the Mon i tor on the microkernel where the requested system service is located.
  • the message communication of this process is to use the I PG inter-core communication mechanism, and then the remote monitor sends a message to the micro of the remote monitor.
  • the microkernel schedules the target service process; after the target service finishes processing the message, it sends a message to the microkernel, and then the microkernel dispatches Mon i tor, and the Mon i tor sends the message to the microkernel of the required system service through the interoperal communication of the IPG. On the Monitor, Monitor sends a message to the microkernel. Finally, the microkernel schedules the user process to complete the scheduling process of the request and response that the user process and the service process are not on the same microkernel.
  • FIG. 3 is another schematic diagram of the communication interaction between the multi-core architecture user process and the system service process provided by the prior art, and FIG. 3 shows that when the user process and the system service process are not on the same microkernel, at least eight context switches and Two IPC inter-core communication, if the system service process can not process user process requests and need to call other services, it needs more times of context switching and inter-core communication, and the early macro kernel (English: Monol ithic Kernel, referred to as: Mono Kernel ) In the operating system, only two context switches are required.
  • the embodiment of the present invention provides a method for communication between many cores to solve the problem that the prior art is in a multi-core kernel architecture, and the user process and the service process communication require multiple context switches, and the micro-core operating system is inefficient.
  • the inter-nuclear communication method includes:
  • the service management Service Manager process requests shared memory from the microkernel operating system, and maps the first shared memory allocated by the microkernel operating system to the virtual address space of the Service Manager process; the Serv ice Manager process receives the registration of the system service process. a message, the service identifier of the system service process carried by the registration message and a second shared memory address corresponding to the service identifier; the service manager process sends a response message of the registration message to the system service process, where The response message carries a first shared memory address;
  • the service manager process receives the system service request of the user process, and finds a second shared memory address corresponding to the service identifier according to the service identifier carried by the system service request; the service manager process identifies the service identifier, the first The shared memory address and the second shared memory address corresponding to the service identifier are sent to the user process, so that the user process sets the first shared memory and the second shared memory address corresponding to the first shared memory address.
  • the corresponding second shared memory is mapped to the virtual address space of the user process.
  • the method before the service manager process receives the registration message of the system service process, the method further includes:
  • the monitor sends a startup message of the Service Manager process, where the startup message carries the first shared memory address, so that all the remote monitors map the first shared memory corresponding to the first shared memory address to the virtual of all the remote monitors. Address space, establishing a connection between the Service Manager process and all of the remote Mon i tor;
  • All remote monitors include user process monitors and system service processes
  • the service manager process receives the registration message of the system service process, and the method includes: receiving, by the service manager process, a registration message of the system monthly service process by using a monitor of the system monthly service process;
  • Receiving, by the service manager process, a system service request of the user process includes: receiving, by the service process, the system process request of the user process by using the monitor of the user process;
  • the Service Manager process passes the monitor of the user process ⁇ ! And occupying the monthly service identifier, the first shared memory address, and a second shared memory address corresponding to the service identifier.
  • the method includes:
  • the service manager process receives and records the service identifier of the system service process and the third shared memory address corresponding to the service identifier;
  • the service manager process receives the system service request of the user process, and finds the third shared memory address corresponding to the service identifier carried by the system service request according to the service identifier carried in the system service request;
  • the service manager process sends the third shared memory address to the user process, so that the user process maps the third shared memory corresponding to the third shared memory address to the virtual address space of the user process;
  • the Service Manager process forwards the system service request of the user process to the system service process, so that the system service process processes the system service request of the user process and sends the processing result to the user process.
  • the inter-nuclear communication method includes:
  • the system service process requests shared memory from the microkernel operating system, and maps the second shared memory allocated by the microkernel operating system to its own virtual address space;
  • the system service process sends a registration message to the Servicing Process, the registration message carrying the service identifier of the system service process and the second shared memory address corresponding to the service identifier;
  • the system service process receives the response message of the registration message sent by the process, and maps the first shared memory corresponding to the first shared memory address carried by the response message to the virtual address of the system service process. space.
  • the method further includes:
  • the system service process When the system service process migrates to the target microkernel, the system service process requests shared memory from the microkernel operating system, and maps the third shared memory allocated by the microkernel operating system to its own virtual address space;
  • the system service process sends the service identifier of the system service process and the third shared memory address corresponding to the service identifier to the Servce Manager process.
  • a third aspect is an inter-core communication system, the communication system comprising:
  • mapping unit configured to apply for shared memory to the microkernel operating system, and map the first shared memory allocated by the microkernel operating system to a virtual address space of the ServManager process;
  • a receiving unit configured to receive a registration message of the system service process, and record a service identifier of the system service process carried by the registration message and a second shared memory address corresponding to the service identifier;
  • a response unit configured to send a response message of the registration message to the system service process, where the response message carries a first shared memory address
  • the receiving unit is further configured to receive a system service request of the user process, and find a second shared memory address corresponding to the service identifier according to the service identifier carried by the system service request;
  • a sending unit configured to send the service identifier, the first shared memory address, and a second shared memory address corresponding to the service identifier to the user process, so that the user process
  • the first shared memory corresponding to the first shared memory address and the second shared memory corresponding to the second shared memory address are mapped to the virtual address space of the user process.
  • the sending unit is further configured to:
  • the startup message carrying a first shared memory address, so that all the remote terminals map the first shared memory corresponding to the first shared memory address to the virtual address of all the remote monitors Space, establishing a connection between the Service Manager process and all of the remote monitors;
  • All remote monitors include user process monitors and system service processes
  • the receiving unit is configured to: receive, by the Monitor of the system service process, a registration message of the system service process, and record a service identifier of the system service process carried by the registration message and a second share corresponding to the service identifier Memory address; and,
  • the response unit is specifically configured to: send, by using a monitor of the system monthly service process, a response message of the registration message to the system service process;
  • the sending unit is configured to send, by using a monitor of the user process, the service identifier, the first shared memory address, and a second shared memory address corresponding to the service identifier to the user process.
  • the receiving unit is further configured to: when the system service process migrates to the target microkernel, the service manager process receives and records the service identifier of the system service process and the third shared memory address corresponding to the service identifier;
  • the receiving unit is further configured to receive a system service request of the user process, and find a third shared memory address corresponding to the service identifier according to the service identifier carried by the system service request;
  • the sending unit is further configured to send the third shared memory address to the user process, so that the user process maps the third shared memory corresponding to the third shared memory address to the virtual address space of the user process;
  • the sending unit is further configured to forward the system service request of the user process to the system service process, so that the system service process processes the system service request of the user process and sends the processing result to the user process.
  • a fourth aspect is an inter-core communication system, the communication system comprising:
  • mapping unit configured to apply for shared memory to the microkernel operating system, and map the second shared memory allocated by the microkernel operating system to its own virtual address space;
  • a sending unit configured to send a registration message to the Servicing Process, where the registration message carries a service identifier of the system service process and a second shared memory address corresponding to the service identifier
  • a receiving unit configured to receive a response message of the registration message
  • the response message carries a first shared memory address, and the first shared memory corresponding to the first shared memory address is mapped to a virtual address space of the system service process.
  • the mapping unit is further configured to: when the system service process migrates to the target microkernel, apply for a shared memory address to the microkernel operating system, and map the third shared memory corresponding to the third shared memory address allocated by the microkernel operating system to the third shared memory. Virtual address space;
  • the sending unit is further configured to send a service identifier of the system service process and a third shared memory address corresponding to the service identifier to the ServManager process.
  • FIG. 1 is a schematic diagram of a client/server model based on a microkernel operating system provided by the prior art
  • FIG. 2 is a schematic diagram of communication interaction between a user process of a many-core architecture provided by the prior art and a system service process;
  • FIG. 3 is another schematic diagram of communication interaction between a multi-core architecture user process and a system service process provided by the prior art
  • FIG. 4 is a schematic diagram of a scenario applicable to a method for communication between many-cores according to an embodiment of the present invention
  • FIG. 5 is a flowchart of an implementation of a method for communication between many-cores according to another embodiment of the present invention
  • FIG. 6 is another embodiment of the present invention
  • FIG. 7 is a schematic diagram of a method for operating a shared memory according to another embodiment of the present invention.
  • FIG. 8 is a structural diagram of a communication between a many-core communication system according to another embodiment of the present invention
  • FIG. 9 is a structural diagram of a communication system between a many-core communication according to another embodiment of the present invention
  • FIG. 11 is a structural diagram of a network device according to another embodiment of the present invention. detailed description
  • FIG. 4 shows a scenario applicable to the inter-core communication method according to an embodiment of the present invention.
  • all microkernels use the same microkernel operating system, specify a specific microkernel in the system, and run a specific service management in a single core and single thread mode (English: Se rv i ce Manage r ) process. , used to provide all the services provided by the system, and manage the connection between the system service process requested by the user and the user process.
  • the user process includes user process A and user process B.
  • the system service process includes: process service, device driver, file Services, virtual memory, and other services.
  • the actively invoked system service process acts as a user process
  • the called process acts as a system service process.
  • a proxy service monitor is run on each microkernel, and all monitors can be fully connected, that is, all monitors are connected in pairs.
  • FIG. 5 is a flowchart showing an implementation process of the inter-core communication method according to an embodiment of the present invention.
  • the execution body of the embodiment is Service Manager, and the process of the method is as follows:
  • step S501 the Service Manager process requests shared memory from the microkernel operating system, and maps the first shared memory allocated by the microkernel operating system to the virtual address space of the Service Manager process.
  • the Service Manager process when the Service Manager process starts, it will apply for shared memory to the microkernel operating system.
  • the above microkernel operating system is the operating system used by the microkernel where the Service Manager process is located.
  • the first shared memory is microkernel operating system memory management.
  • the module allocates shared memory for the Service Manager process.
  • the address of the first shared memory is the first shared memory address.
  • the Service Manager process, the system monthly service process, and the user process are located in different microkernels of the same processor or microkernels located in multiple different processors.
  • the microkernel operating system memory management module divides the linear memory address into three parts, including: kernel space, user space, and shared memory space.
  • the shared memory space is allocated from 0xf"-f, and the first block
  • the specific shared memory area is allocated specifically for use by the Service Manager process, and the remaining shared memory space is allocated to the system service process. After the system service process starts, it applies for a fixed-size memory to the microkernel operating system, which is called the system service process.
  • the system service process After the shared memory, that is, the second shared memory, or the system service process is migrated to the target microkernel, the system service process re-applies a fixed-size memory to the microkernel operating system, which is also referred to as the shared memory of the system service process, that is, The third shared memory.
  • step S502 the ServManager process receives the registration message of the system service process, and records the service information of the system service process and the second shared memory address carried by the registration message.
  • the micro-core operating system first requests the shared memory address of the system service process, that is, the second shared memory address, and then registers with the Service Manager process, and the system service process is registered.
  • the service information and the second shared memory address are sent to a Service Manager process, where the service information includes a service identifier, and the service identifier corresponds to a second shared memory address.
  • the service identifier is used to distinguish different system service processes, where the service identifier can be implemented by numbers, letters or other means.
  • the service identifier of the system service process and the second shared memory address are corresponding relationships, each system service process has a corresponding service identifier, and each system service process has a second shared memory allocated, and the address of the second shared memory
  • the service identifier of the system service process and the second shared memory address are the corresponding relationship.
  • the service manager process records the service identifier of the system service process and the second shared memory address corresponding to the service identifier.
  • the implementation manner in which the Service Manager process receives the registration message of the system service process includes:
  • Manner 1 The Monitor of the system service process receives the registration message of the system service process from the system service process, and the Mon i tor of the Service Manager process receives the registration message of the system monthly service process from the Mony to the system of the system service process, and the Service Manager process Receiving a registration message of the system service process from Mon i to r of the Servicing Process;
  • Manner 2 The Service Manager process receives the registration message of the system service process through the Mon i tor of the system monthly service process.
  • the second method omits the Monitor Manager process. Inter-link, more efficient.
  • step S503 the Service Manager process sends a response message of the registration message to the system service process, where the response message carries the first shared memory address.
  • system service process maps the first shared memory to its own virtual address space according to the first shared memory address, so that the Service Manager process can directly communicate with the system service process.
  • the implementation manner of the response message that the Service Manager process sends the registration message to the system service process includes:
  • Manner 1 The Service Manager process sends a response message of the registration message to the Monitor of the Service Manager process, and the Mon i tor of the Service Manager process sends a response message of the registration message to the Monitor of the system service process, and the Monitor of the system service process will be The response message of the registration message is sent to the system service process;
  • Manner 2 The Service Manager process sends a response message of the registration message to the system monthly service process through the Mon i tor of the system monthly service process.
  • the second method is that the Service Manager process is directly related to the system service process.
  • the Monitor communicates, omitting the middle of the Monitor of the Service Manager process.
  • step S504 the Service Manager process receives the system service request of the user process, and finds the second shared memory address corresponding to the service identifier according to the service identifier carried in the system service request.
  • the implementation manner of the service manager process receiving the system service request of the user process includes:
  • Manner 1 The Monitor of the user process receives the system service request of the user process from the user process, and the Mon i tor of the Service Manager process receives the system monthly service request of the user process from the Mon i tor of the user process, Service Manager ⁇ ⁇ The Monitor of the Service Manager process receives a system service request of the user process;
  • Method 2 The Service Manager process receives the user process through the Mon i tor of the user process.
  • the second method is that the Serv i ce Manager process directly communicates with the user process, omitting the intermediate link of the Mon i tor of the Serv i ce Manager process.
  • step S505 the ServManager process sends the service identifier, the first shared memory address, and the second shared memory address corresponding to the service identifier to the user process, so that the user process puts the user
  • the first shared memory corresponding to the shared memory address and the second shared memory corresponding to the second shared memory address are mapped to the virtual address space of the user process.
  • the purpose of sending the service identifier to the user process is to enable the user process to distinguish between the first shared memory address and the second shared memory address.
  • the user process receives the first shared memory address and the second shared memory address, and maps the first shared memory and the second shared memory to the first shared memory address and the second shared memory address according to the first shared memory address and the second shared memory address.
  • the virtual address space realizes that the user process can directly communicate with the Servicing Process and the system service process directly, and solves the problem that the user process and the system service process communication need multiple context switching in the prior art.
  • the implementation manner in which the user process communicates with the system service process is as shown in Table 2.
  • the message stored in the shared memory of each system service process is divided into two parts, including a header and a message body, and the header is used to set system services.
  • the message body portion includes an allocation bitmap, a preparation bitmap, and a message block.
  • the allocation bitmap is used to indicate that the message block is in an idle state or is used, and the preparation bitmap is used to indicate whether the message block is ready to be processed.
  • the user Each time the user requests the service, the user first queries the allocation bitmap to apply for an idle message block. After the application is successful, the corresponding identifier bit in the allocation bitmap is modified, and the message block is operated to fill in the message content, and the corresponding bitmap is also modified. Flag bit.
  • the system service process queries the message block that has the identification bit in the preparation bitmap, reads the content in the message block, provides the service, and resets the corresponding bitmap in the allocation bitmap and the preparation bitmap after completion.
  • the implementation manner in which the service manager process sends the service identifier, the first shared memory address, and the second shared memory address corresponding to the service identifier to the user process includes:
  • Manner 1 The Service Manager process sends the service identifier, the first shared memory address, and the second shared memory address corresponding to the service identifier to the Monitor of the Service Manager process, and the Mon i tor ⁇ of the Servicing Process The first shared memory address and the second shared memory address corresponding to the service identifier are sent to the user process.
  • the monitor the user process's Mon i tor sends the service identifier, the first shared memory address, and the second shared memory address corresponding to the service identifier to the user process.
  • Manner 2 The service manager process sends the service identifier, the first shared memory address, and the second shared memory address corresponding to the service identifier to the Monitor of the user process, and the Monitor of the user process identifies the service identifier and the first shared memory. The address and the second shared memory address corresponding to the service identifier are sent to the user process.
  • step S501 before step S502, the method further includes:
  • the Service Manager process sends a Service Manager process start message to all remote monitors through the local proxy, the start message carries the first shared memory address, so that all the remote Mon itors will use the first shared memory.
  • the first shared memory corresponding to the address is mapped to the virtual address space of all the remote monitors, and the connection between the Service Manager process and all the remote monitors is established;
  • the remote monitor includes the monitor of the user process and the Mon i tor of the system service process;
  • the registration message of the service manager process receiving the system service process is specifically that the service manager process receives the registration message of the system monthly service process through the monitor of the system monthly service process;
  • the response message is specifically that the Service Manager process sends the response message of the registration message to the system service process by using a monitor of the system monthly service process;
  • the service manager process ⁇ 1 the monthly service identifier, the first shared memory address, and the second shared memory address corresponding to the service identifier are sent to the user process, specifically, the service manager process passes the user process.
  • the Service Manager process sends a message to the system monthly service process or receives a message from the system service process, and directly passes the Monitor of the system service process, and the Service Manager process sends a message to the user process or from the user process. Receive messages directly through the user process's Monitors
  • the Service Manager process directly communicates with the Mon i tor of the user process and the Mon i tor of the system service process by using the foregoing method, so that each time the user process and the system service process communicate with the Service Manager process, the Serv i must pass through the Serv i.
  • the Monitor of the ce Manager process improves the communication efficiency of the system.
  • the method further includes:
  • the service manager process receives and records the service identifier of the system service process and the third shared memory address corresponding to the service identifier;
  • the service manager process receives the system service request of the user process, and finds the third shared memory address corresponding to the service identifier according to the service identifier carried in the system service request;
  • the service manager process sends the third shared memory address to the user process, so that the user process maps the third shared memory address corresponding to the third shared memory to the virtual address space of the user process;
  • the Service Manager process forwards the system service request of the user process to the system service process.
  • system service process processes the system service request of the user process and sends the processing result to the user process.
  • the service identifier of the system service process is unchanged, but the system service process needs to re-apply the shared memory of the system service process to the microkernel operating system through the migrated target microkernel.
  • the third shared memory is the third shared memory address, and the third shared memory address is used to distinguish the original shared memory address.
  • the user process when the system service process migrates, the user process cannot communicate with the system service process according to the original second shared memory address, but sends the system service request to the system service request.
  • the Servicing Process checks to the third shared memory address registered by the system monthly service process, and sends the third shared memory address to the user process, so that the user process can directly interact with the migrated
  • the system service process communicates, and the Servce Manager process forwards the user's system service request to the migrated system service process, and the user process can communicate with the migrated system service process in a simple step.
  • FIG. 6 is a flowchart showing an implementation process of a method for communication between many parties according to another embodiment of the present invention.
  • the execution subject of the embodiment is a system service process, and the process of the method is as follows:
  • step S601 the system service process requests shared memory from the microkernel operating system, and maps the second shared memory allocated by the micro-core operating system to its own virtual address space.
  • microkernel operating system refers to the operating system used by the microkernel where the system service process is located.
  • step S602 the system service process sends a registration message to the Servicing Process, where the registration message carries the service information of the system service process and the second shared memory address.
  • the service information of the system service process includes a service identifier of the system service process, and the service identifier corresponds to the second shared memory address.
  • step S603 the system service process receives a response message of the registration message, where the response message carries the first shared memory address, and maps the first shared memory corresponding to the first shared memory address.
  • the method further includes:
  • the system service process When the system service process migrates to the target microkernel, the system service process requests shared memory from the microkernel operating system, and maps the third shared memory allocated by the microkernel operating system to its own virtual space 4 to the address space;
  • the system service process sends the service identifier of the system service process and the third shared memory address corresponding to the service identifier to the Service Manager process.
  • FIG. 7 is a diagram showing a method for operating a shared memory according to another embodiment of the present invention. The method is as follows:
  • the microkernel operating system provides an I ibc to share the memory of the operating system.
  • the present invention provides an application programming interface (English: Appl ication Programming Interface, API for short) to implement a method for operating the shared memory of the microkernel operating system.
  • the user process, the monitor, the system service process, and the Serv Manager process respectively map the shared memory of the Service Manager process, that is, the first shared memory, to its own virtual address space, so that the Service Manager process can directly communicate with the user process, the monitor, and the system service. Process communication.
  • Monitor here refers to all the above remote monitors.
  • the user process and the system service process map the shared memory of the system service process, that is, the second shared memory or the third shared memory, to their own virtual address space, so that the user process and the system service process can directly communicate.
  • Fig. 8 is a view showing the configuration of an inter-core communication system according to another embodiment of the present invention. For the convenience of description, only parts related to the embodiment of the present invention are shown.
  • the inter-nuclear communication system includes:
  • the mapping unit 81 is configured to apply for shared memory to the microkernel operating system, and map the first shared memory allocated by the microkernel operating system to the virtual address space of the Service Manager process.
  • a receiving unit 82 configured to receive a registration message of a system service process, and record the registration message
  • the response unit 83 is configured to send a response message of the registration message to the system service process, where the response message carries a first shared memory address.
  • the receiving unit 82 is further configured to receive a system service request of the user process, and search for a second shared memory address corresponding to the service identifier according to the service identifier carried by the system service request.
  • the sending unit 84 is configured to send the service identifier, the first shared memory address, and a second shared memory address corresponding to the service identifier to the user process, so that the user process puts the first share
  • the first shared memory corresponding to the memory address and the second shared memory corresponding to the second shared memory are mapped to the virtual address space of the user process.
  • the sending unit 84 is further configured to:
  • the remote monitors include the Monitor of the user process and the Mon i tor of the system service process.
  • the receiving unit 82 is further configured to: when the system service process migrates to the target microkernel, the service manager process receives and records the service identifier of the system service process and the third shared memory address corresponding to the service identifier;
  • the receiving unit 82 is further configured to receive a system service request of the user process, and search for a third shared memory address corresponding to the service identifier according to the service identifier carried by the system service request;
  • the sending unit 84 is further configured to send the third shared memory address to the user process, so that the user process maps the third shared memory corresponding to the third shared memory address to the virtual address space of the user process;
  • the sending unit 84 is further configured to forward the system service request of the user process to the system service process, so that the system service process processes the system service request of the user process and sends the processing result to the user.
  • the inter-nuclear communication system provided in this embodiment can use the corresponding inter-core communication method.
  • the inter-nuclear communication system provided in this embodiment can use the corresponding inter-core communication method.
  • the related description of the embodiment corresponding to FIG. 5 of the above-mentioned inter-core communication method and details are not described herein again.
  • Fig. 9 is a view showing the configuration of an inter-core communication system according to another embodiment of the present invention. For the convenience of description, only parts related to the embodiment of the present invention are shown.
  • the inter-nuclear communication system includes:
  • the mapping unit 91 is configured to apply for a system service shared memory to the microkernel operating system, and map the second shared memory allocated by the microkernel operating system to its own virtual address space.
  • the sending unit 92 is configured to send a registration message to the Servicing Process, where the registration message carries the service information of the system service process and the second shared memory address corresponding to the service identifier.
  • the receiving unit 93 is configured to receive a response message of the registration message, where the response message carries a first shared memory address, and maps the first shared memory corresponding to the first shared memory address to a virtual address space of the system service process.
  • the mapping unit 91 is further configured to: when the system service process migrates to the target microkernel, apply a shared memory address to the microkernel operating system, and map the third shared memory corresponding to the third shared memory address allocated by the microkernel operating system to Own virtual address space;
  • the sending unit 92 is further configured to send the service identifier of the system service process and the third shared memory address corresponding to the service identifier to the ServManager process.
  • the inter-nuclear communication system provided in this embodiment can use the corresponding inter-core communication method.
  • the inter-nuclear communication system provided in this embodiment can use the corresponding inter-core communication method.
  • the related description of the embodiment corresponding to FIG. 6 in the above-mentioned inter-core communication method and details are not described herein again.
  • Figure 10 shows the composition of a network device according to another embodiment of the present invention, for convenience Only parts related to the embodiment of the present invention are shown.
  • the network device includes a processor 1001, a memory 1002, a communication interface 1003, and a bus 1004.
  • the processor 1001, the memory 1002, and the communication interface 1003 are connected to each other through a bus 1004; the bus 1004 may be an industry standard architecture system (English: Industry Standard Architecture, ISA for short) or an interconnection device (English: Per iphera I Component Interconnect) , referred to as: PGI) bus and so on.
  • ISA Industry Standard Architecture
  • PGI Per iphera I Component Interconnect
  • the above processor 1001 is a multi-core general-purpose processor or a plurality of processors, including a central processing unit (English: Central Processing Unit, GPU for short) and a network processor (English: Network Processor, ⁇ for short).
  • a central processing unit English: Central Processing Unit, GPU for short
  • a network processor English: Network Processor, ⁇ for short.
  • the processor 1001 is configured to:
  • the service manager process sends the service identifier, the first shared memory address, and the second shared memory address corresponding to the service identifier to the user process;
  • the control user process maps the first shared memory corresponding to the first shared memory address and the second shared memory corresponding to the second shared memory address to a virtual address space of the user process.
  • the processor 1001 is further configured to:
  • the remote monitors include the Monitor of the user process and the Mon i tor of the system service process.
  • controller 1001 is further configured to:
  • the Manager process sends a service identifier of the system service process and a third shared memory address corresponding to the service identifier;
  • Controlling the Service Manager process to send the third shared memory address to the user process, so that the user process maps the third shared memory corresponding to the third shared memory address to the virtual address space of the user process;
  • the control system service process processes the system service request of the user process and sends the processing result to the user process.
  • FIG. 11 shows a composition of a network device according to another embodiment of the present invention. For convenience of description, only parts related to the embodiment of the present invention are shown.
  • the network device includes a processor 1101, a memory 1102, a communication interface 1103, and a bus 1104.
  • the processor 1101, the memory 1102, and the communication interface 1103 are connected to each other through a bus 1104; the bus 1104 may be an industry standard architecture system (English: Industry Standard Architecture,
  • ISA ISA Bus
  • Xipuwei Component Interconnect English: Per iphera I Component Interconnect, referred to as: PGI
  • the processor 1101 is a multi-core general-purpose processor or a plurality of processors, including a central processing unit (English: Central Processing Unit, GPU for short) and a network processor (English: Network Processor, NP for short).
  • a central processing unit English: Central Processing Unit, GPU for short
  • a network processor English: Network Processor, NP for short.
  • the processor 1101 is configured to:
  • the control system service process requests shared memory from the microkernel operating system, and maps the second shared memory allocated by the microkernel operating system to its own virtual address space;
  • the control system service process sends a registration message to the Service Manager process, where the registration message carries the service identifier of the system service process and the second shared memory address corresponding to the service identifier; and controls the registration message of the Servicing Process to process the system service process, And sending a response message of the registration message to the system service process, where the response message carries the first shared memory address; the control system service process receives the response message, and maps the first shared memory corresponding to the first shared memory address to The virtual address space of the system service process.
  • processor 1101 is further configured to:
  • control system service process When the system service process migrates to the target microkernel, the control system service process requests shared memory from the microkernel operating system, and maps the third shared memory allocated by the microkernel operating system to its own virtual address space;
  • the control system service process sends the service identifier of the system service process and the third shared memory address corresponding to the service identifier to the Service Manager process.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Computer And Data Communications (AREA)

Abstract

本发明适用于技术领域,提供了一种众核间通信方法,所述方法包括:服务管理进程向微内核操作系统申请共享内存,将微内核操作系统分配的共享内存映射到自己的虚拟地址空间;接收并记录注册的系统服务进程的服务标识和与服务标识对应的第二共享内存地址;根据系统服务请求所携带的服务标识,查找系统服务请求所携带服务标识对应的第二共享内存地址;将系统服务请求所携带服务标识、第一共享内存地址以及所述服务标识对应的第二共享内存地址发送所述用户进程。通过本发明可以解决现有技术存在的,在微内核的众核架构下,用户进程和系统服务进程通信需要多次上下文切换的问题。

Description

一种众核间通信方法及系统 技术领域 本发明属于计算机硬件技术领域,尤其涉及一种众核间通信方法及系统。 背景技术
微内核操作系统 (英文: Microkernel Operating System) 结构, 是 20 世纪 80年代后期发展起来的, 由于有效地支持多处理机运行, 非常适用于分 布式系统环境。 微内核是一种能够提供必要服务的操作系统内核, 其中必要 的月良务包括任务、 线程、 进程间通4言 (英文: Inter Process Communication, 简称: IPG) 以及内存管理等。 微内核的所有服务 (包括设备驱动) 在用户态 下运行, 而处理服务与处理其它程序一样, 并且每个服务都在自己的地址空 间中运行, 服务彼此之间受到了保护。
图 1 是现有技术提供的微内核操作系统基于客户 /服务器模型示意图,在 图 1 中, 用户进程和系统服务都与微内核连接, 用户需要请求系统服务时, 首先用户通过用户进程向所述微内核发送系统服务的请求信息, 微内核响应 接收到的请求信息, 调度所请求信息对应的系统服务进程, 系统服务处理完 用户请求后, 会发送消息给内核, 最后内核响应接收到的消息, 调度之前需 要请求系统服务的用户进程。
在众核架构下, 多个微内核实例同时存在, 每个中央处理器 (英文:
Central Processing Unit, 简称: GPU) 运行一个独立的微内核实例, 并且 用户态的各个进程可以随意放置在各个微内核实例上运行。 因此用户进程和 系统服务进程可能不在同一个微内核上运行, 此时两者之间的信息交换需要 采用 IPG核间通信机制。
图 2是现有技术提供的众核架构用户进程与系统服务进程通信交互的一 示意图, 如图 2所示, IPG核间通信需要在每个微内核上运行一个代理服务 监控(英文: Monitor) , Monitor 负责管理微内核数据结构, 以及协调核内和 核间通信, 并且系统启动完成后, 系统中所有 Monitor构成全连接, 两两相 连。 同时 Monitor采用一个数组維护本微内核上的服务列表, 并且提供了每 个服务在系统中全局唯一标识。
用户进程请求服务时, 首先会发送消息给微内核, 微内核调度 Monitor 运行, Mon i tor会根据消息内容来判断用户所请求系统服务是否在同一微内 核上, 若否, 则根据图 2所示处理, 即本地 Monitor会发送消息给所请求系 统服务所在的微内核上的 Mon i tor, 此过程的消息通信是采用 I PG核间通信 机制, 然后远程 Monitor 发送消息给所述远程 Monitor所在的微内核, 微内 核调度目标服务进程; 目标服务处理完消息后, 发送消息给微内核, 然后微 内核调度 Mon i tor, Mon i tor通过 I PG核间通信将消息发送给所需要系统服务 的微内核上的 Monitor, Monitor再发送消息给微内核, 最后微内核调度用户 进程, 从而完成一次用户进程和服务进程不在同一个微内核上的请求和响应 的调度过程。
从图 1 和图 2可以看出, 当用户进程和系统服务进程都在同一微内核上 时, 至少需要四次上下文切换, 即四次消息交换过程。
图 3是现有技术提供的众核架构用户进程与系统服务进程通信交互的另 一示意图, 图 3示出了当用户进程与系统服务进程不在同一微内核上时, 至 少需要八次上下文切换和两次 IPC核间通信, 如果系统服务进程不能处理用 户进程请求而需要调用其他服务时, 则需要更多次数的上下文切换和核间通 信, 而早期的宏内核 (英文: Monol ithic Kernel , 简称: Mono Kernel ) 操 作系统中, 仅需要两次上下文切换。
因此现有技术存在的问题是, 在微内核的众核架构下, 用户进程和系统 服务进程通信需要多次上下文切换, 微内核操作系统效率很低。 发明内容
本发明实施例提供一种众核间通信方法, 以解决现有技术在微内核的众 核架构下, 用户进程和服务进程通信需要多次上下文切换, 微内核操作系统 效率很低的问题。
第一方面, 所述众核间通信方法包括:
服务管理 Service Manager进程向微内核操作系统申请共享内存, 将所 述微内核操作系统分配的第一共享内存映射到所述 Service Manager进程的 虚拟地址空间; Serv i ce Manager进程接收系统服务进程的注册消息, 记录 所述注册消息所携带的所述系统服务进程的服务标识和所述服务标识对应的 第二共享内存地址; Service Manager进程向所述系统服务进程发送所述注 册消息的响应消息, 所述响应消息携带第一共享内存地址;
Service Manager进程接收用户进程的系统服务请求, 根据所述系统服务 请求所携带的服务标识, 查找到所述服务标识对应的第二共享内存地址; Service Manager进程将所述服务标识、 所述第一共享内存地址以及所述服 务标识对应的第二共享内存地址发送给所述用户进程, 以使得所述用户进程 把所述第一共享内存地址对应的第一共享内存和所述第二共享内存地址对应 的第二共享内存映射到用户进程的虚拟地址空间。
在第一方面的第一种可能的实现方式中, 在所述 Service Manager进程 接收系统服务进程的注册消息之前还包括:
Service Manager进程通过本地代理服务监控 Mon i tor 向所有远程
Monitor 发送 Service Manager进程的启动消息, 所述启动消息携带第一共 享内存地址, 以使得所述所有远程 Monitor将所述第一共享内存地址对应的 第一共享内存映射到所述所有远程 Monitor的虚拟地址空间, 建立 Service Manager进程和所述所有远程 Mon i tor的连接;
所述所有远程 Monitor 包括用户进程的 Monitor和系统服务进程的
Mon i tor; 所述 Service Manager进程接收系统服务进程的注册消息, 包括: 所述 Service Manager进程通过系统月良务进程的 Monitor接收系统月良务 进程的注册消息;
所述 Service Manager进程向所述系统服务进程发送所述注册消息的响 应消息, 包括:
所述 Service Manager进程通过系统月良务进程的 Monitor 向所述系统月良 务进程发送所述注册消息的响应消息;
所述 Service Manager进程接收用户进程的系统服务请求, 包括: 所述 Service Manager进程通过用户进程的 Monitor接收用户进程的系 统^^务请求;
所述 Service Manager进程^ 1所述月良务标识、 所述第一共享内存地址以 及所述服务标识对应的第二共享内存地址发送给所述用户进程, 包括:
所述 Service Manager进程通过用户进程的 Monitor ^!夺所述月良务标识、 所述第一共享内存地址以及所述服务标识对应的第二共享内存地址。
在第一方面的第二种可能的实现方式中, 所述方法包括:
当系统服务进程迁移至目标微内核时, Service Manager进程接收并记 录系统服务进程的服务标识和所述服务标识对应的第三共享内存地址;
Service Manager进程接收用户进程的系统服务请求, 根据系统服务请 求所携带的服务标识, 查找到所述系统服务请求所携带的服务标识对应的第 三共享内存地址;
Service Manager进程将所述第三共享内存地址发送至用户进程, 以使 得用户进程将所述第三共享内存地址对应的第三共享内存映射到用户进程的 虚拟地址空间;
Service Manager进程将用户进程的系统服务请求转发给系统服务进 程, 以使得系统服务进程处理所述用户进程的系统服务请求并将处理结果发 送至用户进程。 第二方面, 所述众核间通信方法包括:
系统服务进程向微内核操作系统申请共享内存, 将微内核操作系统分配 的第二共享内存映射到自己的虚拟地址空间;
系统服务进程向 Serv i ce Manager进程发送注册消息, 所述注册消息携 带系统服务进程的服务标识和所述服务标识对应的第二共享内存地址;
系统服务进程接收所述 Se rv i ce Manager进程发送的注册消息的响应消 息, 并将所述响应消息携带的第一共享内存地址对应的第一共享内存对应映 射到所述系统服务进程的虚拟地址空间。
在第二方面的第一种可能的实现方式中, 所述方法还包括:
当系统服务进程迁移至目标微内核时, 系统服务进程向微内核操作系统 申请共享内存, 将所述微内核操作系统分配的第三共享内存映射到自己的虚 以地址空间;
系统服务进程将系统服务进程的服务标识和所述服务标识对应的第三共 享内存地址发送至 Serv i ce Manager进程。
第三方面, 一种众核间通信系统, 所述通信系统包括:
映射单元, 用于向微内核操作系统申请共享内存, 将所述微内核操作系 统分配的第一共享内存映射到 Serv i ce Manage r进程的虚拟地址空间;
接收单元, 用于接收系统服务进程的注册消息, 记录所述注册消息所携 带的所述系统服务进程的服务标识和所述服务标识对应的第二共享内存地 址;
响应单元, 用于向所述系统服务进程发送注册消息的响应消息, 所述响 应消息携带第一共享内存地址;
接收单元, 还用于接收用户进程的系统服务请求, 根据所述系统服务请 求所携带的服务标识, 查找到所述服务标识对应的第二共享内存地址;
发送单元, 用于将所述服务标识、 所述第一共享内存地址以及所述服务 标识对应的第二共享内存地址发送至所述用户进程, 以使得所述用户进程把 所述第一共享内存地址对应的第一共享内存和第二共享内存地址对应的第二 共享内存映射到用户进程的虚拟地址空间。
在第三方面的第一种可能的实现方式中,
所述发送单元还用于:
通过本地代理服务监控 Monitor向所有远程 Monitor 发送 Service
Manager进程的启动消息, 所述启动消息携带第一共享内存地址, 以使得所 述所有远程 Mon i tor将所述第一共享内存地址对应的第一共享内存映射到所 述所有远程 Monitor的虚拟地址空间, 建立 Service Manager进程和所述所 有远程 Monitor的连接;
所述所有远程 Monitor 包括用户进程的 Monitor和系统服务进程的
Mon i tor;
所述接收单元具体用于: 通过所述系统服务进程的 Monitor接收系统服 务进程的注册消息, 记录所述注册消息所携带的所述系统服务进程的服务标 识和所述服务标识对应的第二共享内存地址; 以及,
通过所述用户进程的 Monitor接收用户进程的系统服务请求, 根据所述 系统服务请求所携带的服务标识, 查找到所述服务标识对应的第二共享内存 地址;
所述响应单元具体用于: 通过所述系统月良务进程的 Monitor 向所述系统 服务进程发送所述注册消息的响应消息;
所述发送单元具体用于:通过所述用户进程的 Monitor将所述服务标识、 所述第一共享内存地址以及所述服务标识对应的第二共享内存地址发送至所 述用户进程。
在第三方面的第二种可能的实现方式中,
所述接收单元, 还用于当系统服务进程迁移至目标微内核时, Service Manager进程接收并记录系统服务进程的服务标识和所述服务标识对应的第 三共享内存地址; 所述接收单元, 还用于接收用户进程的系统服务请求, 根据系统服务请 求所携带的服务标识, 查找到所述服务标识对应的第三共享内存地址;
所述发送单元, 还用于将所述第三共享内存地址发送至用户进程, 以使 得用户进程将所述第三共享内存地址对应的第三共享内存映射到用户进程的 虚拟地址空间;
所述发送单元,还用于将用户进程的系统服务请求转发给系统服务进程, 以使得系统服务进程处理所述用户进程的系统服务请求并将处理结果发送至 用户进程。
第四方面, 一种众核间通信系统, 所述通信系统包括:
映射单元, 用于向微内核操作系统申请共享内存, 将微内核操作系统分 配的第二共享内存映射到自己的虚拟地址空间;
发送单元, 用于向 Serv i ce Manager进程发送注册消息, 所述注册消息 携带系统服务进程的服务标识和所述服务标识对应的第二共享内存地址; 接收单元, 用于接收注册消息的响应消息, 所述响应消息携带第一共享 内存地址, 将所述第一共享内存地址对应的第一共享内存映射到系统服务进 程的虚拟地址空间。
在第四方面的第一种可能的实现方式中,
所述映射单元, 还用于当系统服务进程迁移至目标微内核时, 向微内核 操作系统申请共享内存地址, 将微内核操作系统分配的第三共享内存地址对 应的第三共享内存映射到自己的虚拟地址空间;
所述发送单元,还用于将系统服务进程的服务标识和所述服务标识对应 的第三共享内存地址发送至 Serv i ce Manage r进程。 附图说明
为了更清楚地说明本发明实施例中的技术方案, 下面将对实施例或现有 技术描述中所需要使用的附图作简单地介绍, 显而易见地, 下面描述中的附 图仅仅是本发明的一些实施例, 对于本领域普通技术人员来讲, 在不付出创 造性劳动的前提下, 还可以根据这些附图获得其他的附图。
图 1 是现有技术提供的微内核操作系统基于客户 /服务器模型示意图; 图 2是现有技术提供的众核架构用户进程与系统服务进程通信交互的一 示意图;
图 3是现有技术提供的众核架构用户进程与系统服务进程通信交互的另 一示意图;
图 4是本发明一实施例提供的众核间通信方法所适用的场景示意图; 图 5是本发明另一实施例提供的众核间通信方法的实现流程图; 图 6是本发明另一实施例提供的众核间通信方法的实现流程图; 图 7是本发明另一实施例提供的操作共享内存方法的示意图;
图 8是本发明另一实施例提供的众核间通信系统的组成结构图; 图 9是本发明另一实施例提供的众核间通信系统的组成结构图; 图 1 0是本发明另一实施例提供的网络设备的组成结构图;
图 1 1 是本发明另一实施例提供的网络设备的组成结构图。 具体实施方式
为了使本发明的目的、 技术方案及优点更加清楚明白, 以下结合附图及 实施例, 对本发明进行进一步详细说明。 应当理解, 此处所描述的具体实施 例仅仅用以解释本发明, 并不用于限定本发明。
图 4示出了本发明一实施例提供的众核间通信方法所适用的场景。
在本实施例中, 所有的微内核使用同一微内核操作系统, 在系统中指定 一特定的微内核, 以单核单线程的方式运行特定的服务管理 (英文: Se rv i ce Manage r ) 进程, 用来系统提供的所有服务, 并管理用户所请求的系统服务进 程与用户进程之间建立通信连接, 用户进程包括用户进程 A和用户进程 B, 系统服务进程包括: 进程服务、 设备驱动、 文件服务、 虚拟内存和其它服务。 在本实施例中, 当一个系统服务进程调用另外一个系统服务进程时, 主 动调用的系统服务进程作为用户进程, 而被调用的进程作为系统服务进程。
每个微内核上运行一个代理服务 Monitor, 所有的 Monitor之间可以建 立全连接, 即所有的 Monitor之间两两连接。
图 5示出了本发明一实施例提供的众核间通信方法的实现流程, 该实施 例的执行主体是 Service Manager, 该方法过程详述如下:
在步骤 S501 中, Service Manager进程向微内核操作系统申请共享内 存, 将微内核操作系统分配的第一共享内存映射到 Service Manager进程的 虚拟地址空间。
需要说明的是, 在 Service Manager进程启动时, 会向微内核操作系统 申请共享内存, 上述微内核操作系统是 Service Manager进程所在微内核使 用的操作系统。
在本文中, "第一"、 "第二" 和 "第三" 并不指代先后顺序, 而是用 于区分共享内存和共享内存地址, 所述第一共享内存是微内核操作系统内存 管理模块为 Service Manager进程分配的共享内存, 第一共享内存的地址为 第一共享内存地址。
在本实施例中, Service Manager进程、 系统月良务进程和用户进程位于 同一处理器的不同微内核或者位于多个不同处理器的微内核。
如表 1 所示, 微内核操作系统内存管理模块会将线性内存地址分成 3部 分, 包括: 内核空间、 用户空间和共享内存空间, 共享内存空间是从 0xf"-f 开始分配, 并且第一块的特定共享内存区域是专门分配给 Service Manager 进程使用的, 剩余的共享内存空间分配给系统服务进程。 系统服务进程启动 后向微内核操作系统申请一块固定大小的内存, 这里称为系统服务进程的共 享内存, 也就是第二共享内存, 或者系统服务进程迁移至目标微内核后, 系 统服务进程重新向微内核操作系统申请一块固定大小的内存, 这里也称为系 统服务进程的共享内存, 也就是第三共享内存。 系统服务进程 系统服务进程 特定共享 内核空间 用户空间
的共享内存 的共享内存 内存区域 表 1
在步骤 S502中, Serv i ce Manager进程接收系统服务进程的注册消息, 记录所述注册消息所携带的系统服务进程的服务信息和第二共享内存地址。
在本实施例中, 系统服务进程启动完成后, 首先向微内核操作系统申请 系统服务进程的共享内存地址, 也就是第二共享内存地址, 然后向 Service Manager进程进行注册, 注册时把系统服务进程的服务信息和所述第二共享 内存地址发送给 Service Manager进程, 所述服务信息包括服务标识, 所述 服务标识与第二共享内存地址对应。
需要说明的是, 服务标识用于区分不同的系统服务进程, 这里服务标识 可以用数字、 字母或者其它方式来实现。 系统服务进程的服务标识和第二共 享内存地址是对应关系, 每个系统服务进程都有对应服务标识, 每个系统服 务进程都有被分配的第二共享内存, 所述第二共享内存的地址为第二共享内 存地址, 因此系统服务进程的服务标识和第二共享内存地址是——对应的关 系, Service Manager进程记录系统服务进程的服务标识和所述服务标识对 应的第二共享内存地址。
具体地, Service Manager进程接收系统服务进程的注册消息的实现方 式包括:
方式一: 系统服务进程的 Monitor从系统服务进程接收系统服务进程的 注册消息, Service Manager进程的 Mon i tor从系统月良务进程的 Mon i tor接 系统月良务进程的注册消息, Service Manager进程从 Serv i ce Manager进 程的 Mon i to r接收系统服务进程的注册消息;
方式二: Service Manager进程通过系统月良务进程的 Mon i tor接^ 系统 服务进程的注册消息。
需要说明的是, 方式二省略了 Service Manager进程的 Monitor这一中 间环节, 效率更高。
在步骤 S503中, Service Manager进程向系统服务进程发送注册消息的 响应消息, 所述响应消息携带第一共享内存地址。
在本实施例中, 系统服务进程根据第一共享内存地址, 将第一共享内存 映射到自己的虚拟地址空间, 可以实现 Service Manager进程与系统服务进 程直接通信。
具体地, Service Manager进程向系统服务进程发送注册消息的响应消 息的实现方式包括:
方式一: Service Manager进程向 Service Manager进程的 Monitor 发 送所述注册消息的响应消息, Service Manager进程的 Mon i tor 向系统服务 进程的 Monitor 发送所述注册消息的响应消息, 系统服务进程的 Monitor将 所述注册消息的响应消息发送给系统服务进程;
方式二: Service Manager进程通过系统月良务进程的 Mon i tor 向系统月良 务进程发送所述注册消息的响应消息。
需要说明的是, 方式二是 Service Manager进程直接与系统服务进程的
Monitor进行通信, 省略了 Service Manager进程的 Monitor这一中间环节。
在步骤 S504中, Service Manager进程接收用户进程的系统服务请求, 根据系统服务请求所携带的服务标识, 查找到所述服务标识对应的第二共享 内存地址。
具体地, Service Manager进程接收用户进程的系统服务请求的实现方 式包括:
方式一: 用户进程的 Monitor从用户进程接收所述用户进程的系统服务 请求, Service Manager进程的 Mon i tor从用户进程的 Mon i tor接收所述用 户进程的系统月良务请求, Service Manager ϋ λ Service Manager进程的 Monitor接收所述用户进程的系统服务请求;
方式二: Service Manager进程通过用户进程的 Mon i tor接收用户进程
11 的系统服务请求。
需要说明的是, 方式二是 Serv i ce Manager进程直接与用户进程进行通 讯, 省略了 Serv i ce Manager进程的 Mon i tor这一中间环节。
在步骤 S505中, Serv i ce Manager进程将所述服务标识、 第一共享内存 地址以及所述服务标识对应的第二共享内存地址发送至所述用户进程, 以使 得所述用户进程把所述第一共享内存地址对应的第一共享内存和第二共享内 存地址对应的第二共享内存映射到用户进程的虚拟地址空间。
需要说明的是, 发送服务标识至用户进程的目的是, 为了让用户进程能 够区分第一共享内存地址和第二共享内存地址。
在本实施例中, 用户进程接收第一共享内存地址和第二共享内存地址, 根据所述第一共享内存地址和第二共享内存地址, 将第一共享内存和第二共 享内存映射到自己的虚拟地址空间, 实现了用户进程可以直接与 Serv i ce Manager进程和系统服务进程直接通信, 解决了现有技术中用户进程和系统 服务进程通信需要多次上下文切换的问题。
具体地, 用户进程与系统服务进程通信的实现方式如表 2所示, 每个系 统服务进程的共享内存存储的消息分为两部分, 包括头部和消息体, 头部用 于设置系统服务的标识, 消息体部分包括分配位图、 准备位图和消息块, 分 配位图用于表示消息块处于空闲状态或者被使用, 准备位图用于表示消息块 是否准备好被处理的消息。
每次用户请求服务时, 首先查询分配位图来申请一个空闲的消息块, 申 请成功后修改分配位图中对应的标识位, 并且操作该消息块填写消息内容, 同时也修改准备位图对应的标识位。 系统服务进程查询到准备位图有标识位 的消息块, 读取该消息块中的内容, 提供服务, 完成后复位分配位图和准备 位图中对应的标识位。
Figure imgf000014_0001
12 表 2
具体地, Service Manager进程将所述服务标识、 第一共享内存地址以 及所述服务标识对应的第二共享内存地址发送至所述用户进程的实现方式包 括:
方式一: Service Manager进程将所述服务标识、 第一共享内存地址以 及所述服务标识对应的第二共享内存地址发送至 Service Manager进程的 Monitor, Serv i ce Manager进程的 Mon i tor ^!夺所述月良务才示 口、、 第一共享内存 地址以及所述服务标识对应的第二共享内存地址发送至用户进程的
Monitor, 用户进程的 Mon i tor将所述服务标识、 第一共享内存地址以及所述 服务标识对应的第二共享内存地址发送至用户进程。
方式二: Service Manager进程将所述服务标识、 第一共享内存地址以 及所述服务标识对应的第二共享内存地址发送至用户进程的 Monitor, 用户 进程的 Monitor将所述服务标识、 第一共享内存地址以及所述服务标识对应 的第二共享内存地址发送至用户进程。
可选的, 在步骤所述 S501 之后, 在步骤 S502之前还包括:
Service Manager进程通过本地代理月良务 Mon i tor 向所有远程 Monitor 发送 Service Manager进程启动消息, 所述启动消息携带第一共享内存地址, 以使得所述所有远程 Mon i tor将所述第一共享内存地址对应的第一共享内存 映射到所述所有远程 Monitor的虚拟地址空间, 建立 Service Manager进程 和所述所有远程 Monitor的连接;
所述所有远程 Monitor 包括用户进程的 Monitor和系统服务进程的 Mon i tor;
所述 Service Manager进程接收系统服务进程的注册消息具体为所述 Service Manager进程通过系统月良务进程的 Monitor接收系统月良务进程的注 册消息;
所述 Service Manager进程向所述系统服务进程发送所述注册消息的响
13 应消息具体为所述 Service Manager进程通过系统月良务进程的 Monitor 向所 述系统服务进程发送所述注册消息的响应消息;
所述 Service Manager进程接收用户进程的系统服务请求具体为所述 Service Manager进程通过用户进程的 Monitor接收用户进程的系统服务请 求;
所述 Service Manager进程^ 1所述月良务标识、 所述第一共享内存地址以 及所述服务标识对应的第二共享内存地址发送给所述用户进程具体为所述 Service Manager进程通过用户进程的 Mon i tor ^!夺所述月良务标识、 所述第一 共享内存地址以及所述服务标识对应的第二共享内存地址。
在本实施例中, 通过上述方法, 使得 Service Manager进程向系统月良务 进程发送消息或者从系统服务进程接收消息都直接通过系统服务进程的 Monitor, Service Manager进程向用户进程发送消息或者从用户进程接收消 息都直接通过用户进程的 Monitors
在本实施例中, 通过上述方法使得 Service Manager进程直接与用户进 程的 Mon i tor和系统服务进程的 Mon i tor通信, 避免每次用户进程和系统服 务进程与 Service Manager进程通信还必须通过 Serv i ce Manager进程的 Monitor, 提高了系统的通信效率。
可选的, 所述方法还包括:
当系统服务进程迁移至目标微内核时, Service Manager进程接收并记 录系统服务进程的服务标识和所述服务标识对应的第三共享内存地址;
Service Manager进程接收用户进程的系统服务请求, 根据系统服务请 求所携带的服务标识, 查找到所述服务标识对应的第三共享内存地址;
Service Manager进程将所述第三共享内存地址发送至用户进程, 以使 得用户进程将所述第三共享内存地址对应第三共享内存映射到用户进程的虚 拟地址空间;
Service Manager进程将用户进程的系统服务请求转发给系统服务进程,
14 以使得系统服务进程处理所述用户进程的系统服务请求并将处理结果发送至 用户进程。
在本实施例中, 系统服务进程发生迁移时, 系统服务进程的服务标识不 变, 但是系统服务进程需要通过迁移后的目标微内核, 向微内核操作系统重 新申请系统服务进程的共享内存, 也就是上述的第三共享内存, 第三共享内 存的地址为第三共享内存地址, 这里的第三共享内存地址是为了与原有的第 二共享内存地址进行区分。
在本实施例中, 当系统服务进程迁移时, 用户进程不能根据原有的第二 共享内存地址与系统服务进程进行通信, 而是将系统服务请求发送给
Serv i ce Manager进程, 由 Serv i ce Manage r进程查 ^到系统月良务进程更新 注册的第三共享内存地址, 将第三共享内存地址发送给用户进程, 使得用户 进程可以直接与迁移后的系统服务进程进行通信, Serv i ce Manager进程将 用户的系统服务请求转发给迁移后的系统服务进程, 通过简单的步骤就可以 实现用户进程与迁移后的系统服务进程进行通信。
图 6示出了本发明另一实施例提供的众核间通信方法的实现流程, 该实 施例的执行主体是系统服务进程, 该方法过程详述如下:
在步骤 S601 中, 系统服务进程向微内核操作系统申请共享内存, 将微内 核操作系统分配的第二共享内存映射到自己的虚拟地址空间。
需要说明的是, 微内核操作系统是指系统服务进程所在微内核使用的操 作系统。
在步骤 S602中, 系统服务进程向 Serv i ce Manage r进程发送注册消息, 所述注册消息携带系统服务进程的服务信息和第二共享内存地址。
在本实施例中,系统服务进程的服务信息包括系统服务进程的服务标识, 且服务标识与第二共享内存地址对应。
在步骤 S603中, 系统服务进程接收注册消息的响应消息, 所述响应消息 携带第一共享内存地址, 将所述第一共享内存地址对应的第一共享内存映射
15 到系统服务进程的虚拟地址空间。
可选的, 所述方法还包括:
当系统服务进程迁移至目标微内核时, 系统服务进程向微内核操作系统 申请共享内存, 将所述微内核操作系统分配的第三共享内存映射到自己的虚 4以地址空间;
系统服务进程将系统服务进程的服务标识和服务标识对应的第三共享内 存地址发送至 Service Manager进程。
图 7示出了本发明另一实施例提供的操作共享内存方法, 该方法详述如 下:
微内核操作系统提供了一个 I ibc来操作系统共享内存,本发明提供了一 套应用程序编程接口 (英文: Appl ication Programming Interface, 简称: API) 来实现微内核操作系统操作共享内存的方法。
用户进程、 Monitor, 系统服务进程和 Serv i ce Manager进程分別将 Service Manager进程的共享内存, 也就是第一共享内存映射自己的虚拟地 址空间, 使得 Service Manager进程可以直接和用户进程、 Monitor 以及系 统服务进程通信。
需要说明的是, 这里的 Monitor指上述所有远程 Monitors
用户进程和系统服务进程将系统服务进程的共享内存, 也就是第二共享 内存或者是第三共享内存, 分別映射到自己虚拟地址空间, 使得用户进程和 系统服务进程可以直接通信。
图 8示出了本发明另一实施例提供的众核间通信系统的组成结构, 为了 便于说明, 仅示出了与本发明实施例相关的部分。
该众核间通信系统包括:
映射单元 81, 用于向微内核操作系统申请共享内存, 将微内核操作系统 分配的第一共享内存映射到 Service Manager进程的虚拟地址空间。
接收单元 82, 用于接收系统服务进程的注册消息, 记录所述注册消息所
16 携带的系统服务进程的服务信息和第二共享内存地址。
响应单元 83, 用于向所述系统服务进程发送注册消息的响应消息, 所述 响应消息携带第一共享内存地址。
所述接收单元 82, 还用于接收用户进程的系统服务请求, 根据系统服务 请求所携带的服务标识, 查找所述服务标识对应的第二共享内存地址。
发送单元 84, 用于将所述服务标识、 所述第一共享内存地址以及所述服 务标识对应的第二共享内存地址发送至所述用户进程, 以使得所述用户进程 把所述第一共享内存地址对应的第一共享内存和第二共享内存对应的第二共 享内存映射到用户进程的虚拟地址空间。
可选的, 所述发送单元 84还用于:
通过本地代理服务 Monitor 向所有远程 Monitor 发送 Service Manager 进程的启动消息, 所述启动消息携带第一共享内存地址, 以使得所述所有远 程 Mon i tor将所述第一共享内存地址对应的第一共享内存映射到所述所有远 程 Monitor的虚拟地址空间, 建立 Service Manager进程和所述所有远程 Monitor的连接;
所述所有远程 Monitor 包括用户进程的 Monitor和系统服务进程的 Mon i tor。
可选的,
所述接收单元 82,还用于当系统服务进程迁移至目标微内核时, Service Manager进程接收并记录系统服务进程的服务标识和所述服务标识对应的第 三共享内存地址;
所述接收单元 82, 还用于接收用户进程的系统服务请求, 根据系统服务 请求所携带的服务标识, 查找所述服务标识对应的第三共享内存地址;
所述发送单元 84, 还用于将所述第三共享内存地址发送至用户进程, 以 使得用户进程将所述第三共享内存地址对应的第三共享内存映射到用户进程 的虚拟地址空间;
17 所述发送单元 84, 还用于将用户进程的系统服务请求转发给系统服务进 程, 以使得系统服务进程处理所述用户进程的系统服务请求并将处理结果发 送至用户。
本实施例提供的众核间通信系统可以使用在前述对应的众核间通信方 法, 详情参见上述众核间通信方法图 5对应的实施例的相关描述, 在此不再 赘述。
图 9示出了本发明另一实施例提供的众核间通信系统的组成结构, 为了 便于说明, 仅示出了与本发明实施例相关的部分。
该众核间通信系统包括:
映射单元 91, 用于向微内核操作系统申请系统服务共享内存, 将微内核 操作系统分配的第二共享内存映射到自己的虚拟地址空间。
发送单元 92, 用于向 Serv i ce Manage r进程发送注册消息, 所述注册消 息携带系统服务进程的服务信息和服务标识对应的第二共享内存地址。
接收单元 93, 用于接收注册消息的响应消息, 所述响应消息携带第一共 享内存地址, 将所述第一共享内存地址对应的第一共享内存映射到系统服务 进程的虚拟地址空间。
可选的,
所述映射单元 91, 还用于当系统服务进程迁移至目标微内核时, 向微内 核操作系统申共享内存地址, 将微内核操作系统分配的第三共享内存地址对 应的第三共享内存映射到自己的虚拟地址空间;
所述发送单元 92, 还用于将系统服务进程的服务标识和所述服务标识对 应的第三共享内存地址发送至 Serv i ce Manage r进程。
本实施例提供的众核间通信系统可以使用在前述对应的众核间通信方 法, 详情参见上述众核间通信方法图 6对应的实施例的相关描述, 在此不再 赘述。
图 1 0示出了本发明另一实施例提供的网络设备的组成结构,为了便于说 明, 仅示出了与本发明实施例相关的部分。
该网络设备包括处理器 1001、存储器 1002、通信接口 1003和总线 1004。 处理器 1001、 存储器 1002、 通信接口 1003通过总线 1004相互连接; 总 线 1004可以是工业标准架构体系 (英文: Industry Standard Architecture, 简称: ISA)总线或夕卜围组件互联(英文: Per iphera I Component Interconnect, 简称: PGI) 总线等。
上述的处理器 1001 是多内核通用处理器或者是多个处理器,包括中央处 理器 (英文: Central Processing Unit, 简称 GPU) 、 网络处理器 (英文: Network Processor , 简称 ΝΡ) 等。
所述处理器 1001 用于:
控制 Service Manager进程向微内核操作系统申请共享内存, 将微内核 操作系统分配的第一共享内存映射到 Serv i ce Manager进程的虚拟地址空间; 控制系统服务进程向 Service Manager进程发送系统服务进程的注册消 息;
控制 Service Manager进程接收并记录所述注册消息所携带的系统服务 进程的服务标识和所述服务标识对应的第二共享内存地址;
控制 Service Manager进程向所述系统服务进程发送所述注册消息的响 应消息, 所述响应消息携带第一共享内存地址;
控制用户进程向 Service Manager进程发送系统服务请求;
控制 Service Manager进程根据所述系统服务请求所携带的服务标识, 查找到所述服务标识对应的第二共享内存地址;
控制 Service Manager进程将所述服务标识、 所述第一共享内存地址以 及所述服务标识对应的第二共享内存地址发送所述用户进程;
控制用户进程把所述第一共享内存地址对应的第一共享内存和所述第二 共享内存地址对应的第二共享内存映射到用户进程的虚拟地址空间。
可选的, 所述处理器 1001 还用于:
19 控制 Service Manager进程通过本地代理服务监控 Monitor 向所有远程 Monitor 发送 Service Manager进程的启动消息, 所述启动消息携带第一共 享内存地址;
控制所述所有远程 Monitor将所述第一共享内存地址对应的第一共享内 存映射到所述所有远程 Monitor的虚拟地址空间, 建立 Serv i ce Manager进 程和所述所有远程 Monitor的连接;
所述所有远程 Monitor 包括用户进程的 Monitor和系统服务进程的 Mon i tor。
可选的, 所述控制器 1001 还用于:
当系统服务进程迁移至目标微内核时, 控制系统服务进程向 Serv i ce
Manager进程发送系统服务进程的服务标识和所述服务标识对应的第三共享 内存地址;
控制 Service Manager进程接收并记录系统服务进程的服务标识和所述 服务标识对应的第三共享内存地址;
控制 Service Manager进程将所述第三共享内存地址发送至用户进程, 以使得用户进程将所述第三共享内存地址对应的第三共享内存映射到用户进 程的虚拟地址空间;
控制 Service Manager进程将用户进程的系统服务请求转发给系统服务 进程;
控制系统服务进程处理所述用户进程的系统服务请求, 并将处理结果发 送至用户进程。
图 11 示出了本发明另一实施例提供的网络设备的组成结构,为了便于说 明, 仅示出了与本发明实施例相关的部分。
该网络设备包括处理器 1101、存储器 1102、通信接口 1103和总线 1104。 处理器 1101、 存储器 1102、 通信接口 1103通过总线 1104相互连接; 总 线 1104可以是工业标准架构体系 (英文: Industry Standard Architecture,
20 简称: ISA)总线或夕卜围组件互联(英文: Per iphera I Component Interconnect, 简称: PGI) 总线等。
上述的处理器 1101 是多内核通用处理器或者多个处理器,包括中央处理 器(英文: Central Processing Unit, 简称 GPU)、 网络处理器(英文: Network Processor, 简称 NP) 等。
所述处理器 1101 用于:
控制系统服务进程向微内核操作系统申请共享内存, 将微内核操作系统 分配的第二共享内存映射到自己的虚拟地址空间;
控制系统服务进程向 Service Manager进程发送注册消息, 所述注册消 息携带系统服务进程的服务标识和所述服务标识对应的第二共享内存地址; 控制 Serv i ce Manager进程处理系统服务进程的注册消息, 并向系统服 务进程发送注册消息的响应消息, 所述响应消息携带第一共享内存地址; 控制系统服务进程接收所述响应消息, 将所述第一共享内存地址对应的 第一共享内存对应映射到系统服务进程的虚拟地址空间。
可选的, 所述处理器 1101 还用于:
当系统服务进程迁移至目标微内核时, 控制系统服务进程向微内核操作 系统申请共享内存, 将所述微内核操作系统分配的第三共享内存映射到自己 的虚拟地址空间;
控制系统服务进程将系统服务进程的服务标识和所述服务标识对应的第 三共享内存地址发送至 Service Manager进程。
本领域普通技术人员还可以理解, 实现上述实施例方法中的全部或部分 步骤是可以通过程序来指令相关的硬件来完成, 所述的程序可以在存储于可 读取存储介质中, 所述的存储介质, 包括 ROM/RAM等。
以上所述仅为本发明的较佳实施例而已, 并不用以限制本发明, 凡在本 发明的精神和原则之内所作的任何修改、 等同替换和改进等, 均应包含在本 发明的保护范围之内。

Claims

权 利 要 求
1、 一种众核间通信方法, 其特征在于, 所述方法包括:
服务管理 Service Manager进程向微内核操作系统申请共享内存, 将所 述微内核操作系统分配的第一共享内存映射到所述 Service Manager进程的 虚拟地址空间;
Service Manager进程接收系统服务进程的注册消息, 记录所述注册消 息所携带的所述系统服务进程的服务标识和所述服务标识对应的第二共享 内存地址;
Service Manager进程向所述系统服务进程发送所述注册消息的响应消 息, 所述响应消息携带第一共享内存地址;
Service Manager进程接收用户进程的系统服务请求, 根据所述系统服 务请求所携带的服务标识, 查找到所述服务标识对应的第二共享内存地址; Service Manager进程^ 1所述月良务标识、 所述第一共享内存地址以及所 述服务标识对应的第二共享内存地址发送给所述用户进程, 以使得所述用户 进程把所述第一共享内存地址对应的第一共享内存和所述第二共享内存地 址对应的第二共享内存映射到用户进程的虚拟地址空间。
2、 如权利要求 1 所述的方法, 其特征在于, 在所述 Service Manager 进程接收系统服务进程的注册消息之前, 还包括:
Service Manager进程通过本地代理服务监控 Mon i tor 向所有远程 Monitor 发送 Service Manager进程的启动消息, 所述启动消息携带第一共 享内存地址, 以使得所述所有远程 Monitor将所述第一共享内存地址对应的 第一共享内存映射到所述所有远程 Monitor的虚拟地址空间, 建立 Service Manager进程和所述所有远程 Mon i tor的连接;
所述所有远程 Monitor 包括用户进程的 Monitor和系统服务进程的 Mon i tor;
所述 Service Manager进程接收系统服务进程的注册消息, 包括:
22 所述 Service Manager进程通过系统月良务进程的 Monitor接收系统月良务 进程的注册消息;
所述 Service Manager进程向所述系统服务进程发送所述注册消息的响 应消息, 包括:
所述 Service Manager进程通过系统月良务进程的 Monitor向所述系统月良 务进程发送所述注册消息的响应消息;
所述 Service Manager进程接收用户进程的系统服务请求, 包括: 所述 Service Manager进程通过用户进程的 Monitor接收用户进程的系 统服务请求;
所述 Service Manager进程将所述服务标识、 所述第一共享内存地址以 及所述服务标识对应的第二共享内存地址发送给所述用户进程, 包括: 所述 Service Manager进程通过用户进程的 Monitor ^!夺所述月良务标识、 所述第一共享内存地址以及所述服务标识对应的第二共享内存地址。
3、 如权利要求 1 所述的方法, 其特征在于, 所述方法还包括: 当系统服务进程迁移至目标微内核时, Service Manager进程接收并记 录系统服务进程的服务标识和所述服务标识对应的第三共享内存地址;
Service Manager进程接收用户进程的系统服务请求, 根据系统服务请 求所携带的服务标识, 查找到所述系统服务请求所携带的服务标识对应的第 三共享内存地址;
Service Manager进程将所述第三共享内存地址发送至用户进程, 以使 得用户进程将所述第三共享内存地址对应的第三共享内存映射到用户进程 的虚拟地址空间;
Service Manager进程将用户进程的系统服务请求转发给系统服务进 程, 以使得系统服务进程处理所述用户进程的系统服务请求并将处理结果发 送至用户进程。
4、 一种众核间通信方法, 其特征在于, 所述方法包括:
23 系统服务进程向微内核操作系统申请共享内存,将微内核操作系统分配 的第二共享内存映射到自己的虚拟地址空间;
系统服务进程向 Serv i ce Manager进程发送注册消息, 所述注册消息携 带系统服务进程的服务标识和所述服务标识对应的第二共享内存地址; 系统服务进程接收所述 Serv i ce Manager进程发送的注册消息的响应消 息, 并将所述响应消息携带的第一共享内存地址对应的第一共享内存对应映 射到所述系统服务进程的虚拟地址空间。
5、 如权利要求 4所述的方法, 其特征在于, 所述方法还包括: 当系统服务进程迁移至目标微内核时, 系统服务进程向微内核操作系统 申请共享内存,将所述微内核操作系统分配的第三共享内存映射到自己的虚 以地址空间;
系统服务进程将系统服务进程的服务标识和所述服务标识对应的第三 共享内存地址发送至 Serv i ce Manager进程。
6、 一种众核间通信系统, 其特征在于, 所述系统包括:
映射单元, 用于向微内核操作系统申请共享内存, 将所述微内核操作系 统分配的第一共享内存映射到 Serv i ce Manager进程的虚拟地址空间; 接收单元, 用于接收系统服务进程的注册消息, 记录所述注册消息所携 带的所述系统服务进程的服务标识和所述服务标识对应的第二共享内存地 址;
响应单元, 用于向所述系统服务进程发送注册消息的响应消息, 所述响 应消息携带第一共享内存地址;
接收单元, 还用于接收用户进程的系统服务请求, 根据所述系统服务请 求所携带的服务标识, 查找到所述服务标识对应的第二共享内存地址; 发送单元, 用于将所述服务标识、 所述第一共享内存地址以及所述服务 标识对应的第二共享内存地址发送至所述用户进程, 以使得所述用户进程把 所述第一共享内存地址对应的第一共享内存和第二共享内存地址对应的第 二共享内存映射到用户进程的虚拟地址空间。
7、 如权利要求 6所述的系统, 其特征在于,
所述发送单元还用于:
通过本地代理服务监控 Monitor向所有远程 Monitor 发送 Service Manager进程的启动消息, 所述启动消息携带第一共享内存地址, 以使得所 述所有远程 Monitor将所述第一共享内存地址对应的第一共享内存映射到 所述所有远程 Monitor的虚拟地址空间, 建立 Serv i ce Manager进程和所述 所有远程 Monitor的连接;
所述所有远程 Monitor 包括用户进程的 Monitor和系统服务进程的 Monitor;
所述接收单元具体用于:通过所述系统服务进程的 Monitor接收系统服 务进程的注册消息, 记录所述注册消息所携带的所述系统服务进程的服务标 识和所述服务标识对应的第二共享内存地址; 以及,
通过所述用户进程的 Monitor接收用户进程的系统服务请求,根据所述 系统服务请求所携带的服务标识, 查找到所述服务标识对应的第二共享内存 地址;
所述响应单元具体用于:通过所述系统月良务进程的 Monitor 向所述系统 服务进程发送所述注册消息的响应消息;
所述发送单元具体用于: 通过所述用户进程的 Monitor将所述服务标 识、所述第一共享内存地址以及所述服务标识对应的第二共享内存地址发送 至所述用户进程。
8、 如权利要求 6所述的系统, 其特征在于,
所述接收单元, 还用于当系统服务进程迁移至目标微内核时, Service Manager进程接收并记录系统服务进程的服务标识和所述服务标识对应的第 三共享内存地址;
所述接收单元, 还用于接收用户进程的系统服务请求, 根据系统服务请
25 求所携带的服务标识, 查找到所述服务标识对应的第三共享内存地址; 所述发送单元, 还用于将所述第三共享内存地址发送至用户进程, 以使 得用户进程将所述第三共享内存地址对应的第三共享内存映射到用户进程 的虚拟地址空间;
所述发送单元, 还用于将用户进程的系统服务请求转发给系统服务进 程, 以使得系统服务进程处理所述用户进程的系统服务请求并将处理结果发 送至用户进程。
9、 一种的众核间通信系统, 其特征在于, 所述系统包括:
映射单元, 用于向微内核操作系统申请共享内存, 将微内核操作系统分 配的第二共享内存映射到自己的虚拟地址空间;
发送单元, 用于向 Serv i ce Manager进程发送注册消息, 所述注册消息 携带系统服务进程的服务标识和所述服务标识对应的第二共享内存地址; 接收单元, 用于接收注册消息的响应消息, 所述响应消息携带第一共享 内存地址,将所述第一共享内存地址对应的第一共享内存映射到系统服务进 程的虚拟地址空间。
1 0、 如权利要求 9所述的系统, 其特征在于,
所述映射单元, 还用于当系统服务进程迁移至目标微内核时, 向微内核 操作系统申请共享内存地址,将微内核操作系统分配的第三共享内存地址对 应的第三共享内存映射到自己的虚拟地址空间;
所述发送单元, 还用于将系统服务进程的服务标识和所述服务标识对 应的第三共享内存地址发送至 Serv i ce Manage r进程。
26
PCT/CN2013/087395 2013-04-26 2013-11-19 一种众核间通信方法及系统 WO2014173119A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP13882839.7A EP2977909A4 (en) 2013-04-26 2013-11-19 METHOD AND SYSTEM FOR COMMUNICATION AMONG MULTIPLE CORES
US14/920,331 US9990306B2 (en) 2013-04-26 2015-10-22 Inter-manycore communications method and system

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310150599.2 2013-04-26
CN201310150599.2A CN104123265B (zh) 2013-04-26 2013-04-26 一种众核间通信方法及系统

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US14/920,331 Continuation US9990306B2 (en) 2013-04-26 2015-10-22 Inter-manycore communications method and system

Publications (1)

Publication Number Publication Date
WO2014173119A1 true WO2014173119A1 (zh) 2014-10-30

Family

ID=51768679

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2013/087395 WO2014173119A1 (zh) 2013-04-26 2013-11-19 一种众核间通信方法及系统

Country Status (4)

Country Link
US (1) US9990306B2 (zh)
EP (1) EP2977909A4 (zh)
CN (1) CN104123265B (zh)
WO (1) WO2014173119A1 (zh)

Families Citing this family (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104571953B (zh) * 2014-12-25 2017-10-17 珠海金山网络游戏科技有限公司 一种扩展进程中内存地址控制的方法
CN105653377B (zh) * 2015-12-23 2019-07-26 致象尔微电子科技(上海)有限公司 一种异构多核系统核间通讯方法及控制器
US9886303B2 (en) * 2016-06-15 2018-02-06 International Business Machines Corporation Specialized micro-hypervisors for unikernels
CN109117253B (zh) * 2017-06-26 2022-05-24 阿里巴巴集团控股有限公司 一种微内核调度的方法和装置
US10592431B2 (en) 2018-08-13 2020-03-17 Hewlett Packard Enterprise Development Lp Independent shared and process virtual address translations
CN109669792A (zh) * 2018-12-24 2019-04-23 网宿科技股份有限公司 分析数据报文的方法及业务服务器
WO2020133197A1 (zh) * 2018-12-28 2020-07-02 深圳市大疆创新科技有限公司 多进程间的通信方法和系统
CN109933441B (zh) * 2019-02-28 2020-11-17 上海交通大学 微内核进程间通讯方法和系统
CN110532106B (zh) * 2019-07-16 2023-01-13 华为技术有限公司 进程间的通讯方法、装置、设备和存储介质
CN115878210A (zh) * 2021-09-29 2023-03-31 华为技术有限公司 一种系统配置处理方法及相关设备
CN114979241A (zh) * 2022-06-01 2022-08-30 北京字跳网络技术有限公司 通信方法、装置、存储介质以及电子设备
CN115480904B (zh) * 2022-10-09 2023-06-09 电子科技大学 微内核中系统服务并发调用方法
CN115775199B (zh) * 2022-11-23 2024-04-16 海光信息技术股份有限公司 数据处理方法和装置、电子设备和计算机可读存储介质
CN116662037B (zh) * 2023-07-24 2023-10-20 杭州鉴智机器人科技有限公司 一种共享内存的处理方法、装置、电子设备及存储介质

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1811717A (zh) * 2006-01-10 2006-08-02 杭州东信灵通电子实业公司 通用进程间通信实现方法
CN101246466A (zh) * 2007-11-29 2008-08-20 华为技术有限公司 多核系统中共享内存的管理方法和装置
US20090144510A1 (en) * 2007-11-16 2009-06-04 Vmware, Inc. Vm inter-process communications

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101727351B (zh) 2009-12-14 2012-09-05 北京航空航天大学 面向多核平台的虚拟机监控器非对称调度器及其调度方法
US8954697B2 (en) * 2010-08-05 2015-02-10 Red Hat, Inc. Access to shared memory segments by multiple application processes

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1811717A (zh) * 2006-01-10 2006-08-02 杭州东信灵通电子实业公司 通用进程间通信实现方法
US20090144510A1 (en) * 2007-11-16 2009-06-04 Vmware, Inc. Vm inter-process communications
CN101246466A (zh) * 2007-11-29 2008-08-20 华为技术有限公司 多核系统中共享内存的管理方法和装置

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP2977909A4 *

Also Published As

Publication number Publication date
CN104123265A (zh) 2014-10-29
US9990306B2 (en) 2018-06-05
EP2977909A4 (en) 2016-04-20
EP2977909A1 (en) 2016-01-27
CN104123265B (zh) 2017-12-22
US20160041923A1 (en) 2016-02-11

Similar Documents

Publication Publication Date Title
WO2014173119A1 (zh) 一种众核间通信方法及系统
US10365830B2 (en) Method, device, and system for implementing hardware acceleration processing
US10180843B2 (en) Resource processing method and device for a multi-core operating system
US8478926B1 (en) Co-processing acceleration method, apparatus, and system
US9798565B2 (en) Data processing system and method having an operating system that communicates with an accelerator independently of a hypervisor
US10146566B2 (en) Enabling virtual desktop connections to remote clients
US7383555B2 (en) Apparatus and method for sharing a network I/O adapter between logical partitions
WO2018119952A1 (zh) 一种设备虚拟化方法、装置、系统及电子设备、计算机程序产品
JP2005276175A (ja) 拡張性のあるプリントスプーラ
WO2021008183A1 (zh) 数据传输方法、装置及服务器
JP2006127461A (ja) 情報処理装置、通信処理方法、並びにコンピュータ・プログラム
WO2018076882A1 (zh) 存储设备的操作方法及物理服务器
US20140122565A1 (en) Centralized Computing
US9697047B2 (en) Cooperation of hoarding memory allocators in a multi-process system
WO2019001140A1 (zh) 一种管理vnf实例化的方法和设备
CN114020417A (zh) 一种虚拟负载均衡系统及其工作方法
CN112783675A (zh) Ipc通信方法
CN116383127B (zh) 节点间通信方法、装置、电子设备及存储介质
KR102160014B1 (ko) 혼합 네트워크상에서의 태스크 간 통신 방법 및 시스템
WO2023231768A1 (zh) 一种多核处理器及相关核间通信方法
WO2023230766A1 (zh) 一种数据传输方法及虚拟化系统
JPH08110883A (ja) 非scsiデバイスのアクセス方法
JPS59188749A (ja) デ−タ転送制御方式
JP2008097273A (ja) ネットワークインタフェース装置、ネットワークインタフェース制御方法、情報処理装置、データ転送方法
JPH0251740A (ja) プロセス割当制御方式

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 13882839

Country of ref document: EP

Kind code of ref document: A1

REEP Request for entry into the european phase

Ref document number: 2013882839

Country of ref document: EP

WWE Wipo information: entry into national phase

Ref document number: 2013882839

Country of ref document: EP

NENP Non-entry into the national phase

Ref country code: DE