WO2011023106A1 - Scheduling method and scheduler for multi-core processor messages - Google Patents

Scheduling method and scheduler for multi-core processor messages Download PDF

Info

Publication number
WO2011023106A1
WO2011023106A1 PCT/CN2010/076335 CN2010076335W WO2011023106A1 WO 2011023106 A1 WO2011023106 A1 WO 2011023106A1 CN 2010076335 W CN2010076335 W CN 2010076335W WO 2011023106 A1 WO2011023106 A1 WO 2011023106A1
Authority
WO
WIPO (PCT)
Prior art keywords
message
image
control block
task
sink
Prior art date
Application number
PCT/CN2010/076335
Other languages
French (fr)
Chinese (zh)
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 华为技术有限公司
Publication of WO2011023106A1 publication Critical patent/WO2011023106A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues

Definitions

  • Multi-core processor message scheduling method and scheduler The present application claims priority to Chinese Patent Application No. 200910171233.7, entitled “Multi-core Processor Message Scheduling Method and Scheduler", filed on August 25, 2009, The entire contents are incorporated herein by reference.
  • the present invention relates to the field of computer and communication technologies, and in particular, to a multi-core processor scheduling method and a scheduler. Background technique
  • each core has a shared memory space.
  • Memory buffers are entities that pass messages between tasks and between cores.
  • the buffer that carries the message is usually designed as a queue structure that is connected in tandem.
  • a queue of such buffers is called a message queue.
  • the time overhead includes the execution time of the message scheduling function operation message queue, and the task switching time caused by the task entering and exiting the blocking state because the message is sent in a blocking manner.
  • the memory overhead refers to the memory space occupied by the message queue. The length of the message queue and the size of each buffer in the queue determine the memory overhead of the message scheduling function.
  • mailboxes and message pools are a general method for implementing message scheduling.
  • the mailbox method organizes the message queue with a static buffer to implement message scheduling; the message pool method uses a dynamic buffer allocation mechanism to implement message scheduling.
  • An embodiment of the present invention provides a multi-core processor message scheduling method, which is used to improve the efficiency of message delivery.
  • the method includes:
  • the embodiment of the present invention further provides a multi-core processor message scheduling method, which is used to improve the efficiency of message delivery, and the method includes:
  • the embodiment of the present invention further provides a multi-core processor message scheduler, which is used to improve the efficiency of message delivery.
  • the multi-core processor message scheduler includes:
  • a message control block for generating a message, where the message control block records description information and scheduling control information of the message;
  • a second generating module configured to generate a message image of the message, where the message image points to the message control block;
  • And adding a module configured to add the message image to a sink task message image queue corresponding to the message.
  • the embodiment of the present invention further provides a multi-core processor message scheduler, which is used to improve the efficiency of message delivery.
  • the multi-core processor message scheduler includes:
  • An extracting module configured to extract a message image of the message from the sink task message image queue; a feedback module, configured to feed back, according to the message control block pointed by the message image, the description information and the scheduling control information of the message to the sink task .
  • the message image constituting the message queue is separated from the message control block for describing and controlling the message.
  • the image is added to the message image queue of the corresponding sink task; when receiving the message, only the message image of the message needs to be extracted from the sink task message image queue, and the description information of the message is fed back to the sink task according to the message control block pointed to by the message image and Scheduling control information; thus, in the messaging process, high-speed transmission of messages can be realized without repeated data copying operations, and no additional memory is needed, which can save memory overhead and improve message transmission efficiency.
  • FIG. 1 and FIG. 2 are flowcharts showing a process of a multi-core processor message scheduling method according to an embodiment of the present invention
  • FIG. 3 is a schematic diagram of an implementation scenario of a multi-core processor message scheduling method according to an embodiment of the present invention
  • Schematic diagram of memory management example
  • FIG. 5 is a flowchart of detailed operations of a message creation process according to an embodiment of the present invention.
  • FIG. 6 is a flowchart showing a detailed operation of a scheduler in an execution part of a kernel to which a source task belongs in a message sending process according to an embodiment of the present invention
  • FIG. 8 is a flowchart of detailed operations of a scheduler in an execution part of a core to which a source task belongs in a synchronization message sending process according to an embodiment of the present invention
  • FIG. 9 is a flowchart of detailed operations of an execution part of a kernel to which a scheduler belongs in a synchronization message during a synchronization message transmission according to an embodiment of the present invention.
  • FIG. 10 is a flowchart showing a detailed operation of a scheduler in an execution part of a core to which a source task belongs in a process of sending a synchronization response message according to an embodiment of the present invention
  • FIG. 11 is a flowchart of a scheduler in a process of sending a synchronization response message according to an embodiment of the present invention. Detailed operational flow chart of the execution part of the kernel;
  • FIG. 12 is a flowchart of detailed operations of a message receiving process according to an embodiment of the present invention.
  • FIG. 13 is a flowchart of detailed operations of a message release process according to an embodiment of the present invention.
  • FIG. 14 and FIG. 15 are schematic diagrams showing the structure of a multi-core processor message scheduler according to an embodiment of the present invention. detailed description
  • the processing flow of the multi-core processor message scheduling method in the embodiment of the present invention may include:
  • Step 101 Generate a message control block of the message, where the message control block records the description information of the message and the scheduling control information.
  • Step 103 Add the message image to the sink task message image queue.
  • the message image that constitutes the message queue is separated from the message control block that describes and controls the message.
  • the message image is added to the message image queue of the corresponding sink task, so that the message transmission process does not need to perform repeated data copy operations, and the message can be sent at a high speed without using extra memory, which can save memory overhead and improve the efficiency of message transmission.
  • the processing flow of the multi-core processor message scheduling method in the embodiment of the present invention may include:
  • Step 201 Extract (ie, dequeue) the message image of the message from the sink task message image queue.
  • Step 202 Feed back, according to the message control block pointed to by the message image, the description information and the scheduling control information of the message to the sink task. .
  • the message image that constitutes the message queue is separated from the message control block that describes and controls the message.
  • the message control block that describes and controls the message.
  • an implementation entity/module involved in a multi-core processor message scheduling method may include the following parts: a message scheduling interface, a three-level scheduling mechanism, and a scheduler.
  • the message scheduling interface provides a series of function primitives, including: message creation primitive, message sending primitive, message receiving primitive, message release primitive, synchronization message sending primitive, and synchronous response message sending primitive.
  • the three-level scheduling mechanism is for ease of description, and will involve three parts for the scheduler management and scheduling messages, including: message image queue cluster, message control block set, and data buffer set together called “three-level scheduling mechanism" " .
  • the message image queue cluster is divided into two categories: intra-core message image queue cluster, inter-core message image queue cluster.
  • the message image is the image of the receiving message of the task and the kernel in the corresponding message queue, which points to the message control block that receives the message.
  • Each task on each core has a message image queue, and the message images it receives from this task are organized in a linked list. In general, all message images enter and exit this queue in FIFO (First In First Out) mode, which is added from the end of the queue and extracted from the head of the team.
  • FIFO First In First Out
  • the message image queue for all tasks of a kernel constitutes the kernel's intra-core message image queue cluster.
  • each core also has an inter-core message image queue.
  • the message images received by all tasks of a kernel from tasks on other cores are first arranged in the inter-core message image queue of the kernel, and the scheduler transfers them one by one to the message image queue of the corresponding receiving task.
  • the inter-core message image queue is also in the form of a linked list, and the message image also enters and exits the queue in FIFO mode.
  • the intercore message image queues of all cores form the intercore message image queue cluster of the multicore processor.
  • Control block A message control block records description information and scheduling control information of a message. in case The message carries less data.
  • the message control block can contain all the information of the message.
  • the data can be stored in a data buffer, pointed to by the buffer pointer in the message control block.
  • This data buffer may be determined according to actual conditions, for example, according to the amount of data that the message can carry.
  • the data buffer set contains all the data buffers indicated by the message control block because the message carries more data.
  • the size of the data buffer varies depending on the amount of data carried by the corresponding message.
  • the message classification is explained below in conjunction with the dynamic memory management example in the embodiment of the present invention shown in FIG. 4, and the relationship between the components in the three-level scheduling mechanism shown in FIG. 3 is further explained.
  • control block of message B does not carry a data buffer, which is a signal message; the control blocks of messages A, C, and D respectively carry data buffers of different sizes, which are buffer messages.
  • the message is divided into a unicast message and a broadcast message.
  • the receiving task is also called the sinking task.
  • the sending task is also called the source task.
  • a message has only one source task, recorded in the message control block; and there can be multiple sink tasks, which are recorded in its message image.
  • the control blocks of messages A, B, and C are indicated by multiple message maps, that is, they all have multiple sink tasks, so they are broadcast messages; message D is only indicated by one message map, which is a unicast message.
  • the message is divided into the intra-core message and the inter-core message.
  • the scheduler directly adds its message image to the message image queue of the sink task; for inter-core messages, the scheduler first adds its message image to the inter-core message image queue of the kernel to which the sink task belongs, and then Transfer it to the message image queue of the sink task.
  • the two sink tasks of message C belong to core 1 and core 2, respectively, which are inter-core messages; two message images of message A, one of which is located in the inter-core message image queue of core 2, which is about to be transferred. Go to the message image queue of a task of core 2, and therefore also the inter-core message.
  • the message is further divided into a normal message, a synchronization message, and a synchronization response message according to whether the transmission process is accompanied by a change in the running state of the task.
  • the normal message is sent in a non-blocking manner, and the scheduler does not change the running status of the source task and the sink task.
  • the synchronization message is sent in blocking mode, and the scheduler is doing it.
  • the source task is placed in a blocking state while the information image is added to the sink task message image queue.
  • the scheduler releases the blocking state of the sink task, so that it can continue to run.
  • the message image of the synchronous response message is not added to the message image queue of the sink task in FIFO mode, and the scheduler inserts it into the position of the leader of the queue, so that the message is received first after the sink task continues to run.
  • the three-level message scheduling mechanism can be managed and scheduled by the scheduler.
  • the scheduler When the source task creates a message, the scheduler generates a message control block that establishes a connection between the message control block and the data buffer of the source task input.
  • the scheduler When the source task sends a message, the scheduler generates a message image, which points to the message control block.
  • the intra-core message For the intra-core message, it is added directly to the sink task message image queue.
  • For the inter-core message before the core of the sink task The relay of the inter-core message image queue.
  • the scheduler When the sink task receives the message, the scheduler extracts a message image from the message image queue of the current task, and according to the message control block indicated by it, feeds back the message source, the message type and the data buffer carried by the message to the sink task, Release the message image.
  • the scheduler releases the message, the scheduler releases the message control block and the data buffer carried by the message after confirming that the message has no other sink tasks.
  • the scheduler also needs to change the running status of the source task and the sink task accordingly.
  • the message creation primitive accepts the message type, message name, and message body of the source task input.
  • the message body is the message data itself that needs to be sent;
  • the message body contains a pointer to the data buffer carried by the message, the location of the message data in the buffer, and the length of the message data.
  • the message creation primitive triggers the message creation process of the scheduler, and the execution ends to feed back the message handle to the source task.
  • the message sending primitive accepts the sink message identifier input by the source task and the message handle to be sent, and triggers the message sending process of the scheduler.
  • the message receiving primitive triggers the message receiving process of the scheduler, and the execution ends to feed back a message handle of the received message to the sink task, and the message type, source task identifier, message name, and message body of the message.
  • the message body is the message data itself.
  • the message body includes the data buffer pointer, the location of the message data in the buffer, and the length of the message data.
  • the message release primitive accepts the message handle input by the sink task, triggering the message release process of the scheduler.
  • the synchronization message sending primitive and the synchronization response message sending primitive accept the same input as the message sending primitive, triggering the scheduler's synchronization message sending process and the synchronous reply message sending process.
  • the three-level scheduling mechanism shown in Figure 3 and Figure 4 is based on the message control block data structure and message image data structure shown in Tables 1 and 2.
  • the multi-core processor message scheduling method in the embodiment of the present invention may be composed of the following scheduling processes when sending a message: a message creation process, a message sending process, a synchronous message sending process, and a synchronous response message sending process; , can be composed of the following scheduling process: message receiving process, message release process.
  • Step 101 in FIG. 1 is a message creation process.
  • the specific implementation may include: filling a message type, a source task identifier, and a message name in the message control block; if the message is a signal message not carrying a data buffer, Filling the message data in the message body of the message control block; or, if the message is a buffer message carrying a data buffer, filling the data buffer pointer and the message data in the message body of the message control block Location and length.
  • the detailed operation process of the message creation process may include: Step 501: Obtain a message control block from a memory pool;
  • Step 502 filling the message type, the source task identifier, the message name in the message control block; Step 503, determining the message type, if it is a signal message, executing step 504, if it is a buffer area message, executing step 505;
  • Step 504 directly filling the message data in the message control block, performing step 506;
  • Step 505 filling in the data buffer pointer, the location and length of the message data in the message control block, step 506;
  • Step 506 Feedback the message handle, and end processing.
  • the message data is copied into the message control block for transmission; for a buffer message carrying a large amount of information, the pointer of the data buffer and the message data are directly transmitted through the message control block.
  • the location and length of the punching area Therefore, no matter whether there are a large number of data copies in the subsequent message sending and receiving processes between the same kernel task or between different kernel tasks, high-speed transfer can be realized.
  • Steps 102 and 103 in FIG. 1 are message sending processes.
  • step 102 may include: pointing a message control block pointer of the message image to the message control block; filling the sink task identifier, the synchronization response flag, and the linked list in the message image pointer.
  • step 103 may include: when the message is an intra-core message, directly adding the message image to a sink task message image queue; or, when the message is an inter-core message, mapping the message to a kernel to which the host task belongs The inter-core message image queue is transferred to the sink task message image queue.
  • the message sending process is divided into an execution part of the kernel in which the scheduler belongs to the source task and an execution part of the kernel to which the scheduler belongs in the sink task.
  • the scheduler is in the execution part of the kernel to which the source task belongs, where the scheduler compares the source task identifier recorded in the message control block with the input sink task identifier, and determines whether the message to be sent is a core message or Inter-core news. Specifically, the comparison is the core number of the task in the source task identifier and the core number of the task in the sink task identifier to determine whether the message is a nuclear message or an inter-core message.
  • the detailed operation flow of the scheduler in the execution part of the kernel to which the source task belongs in the message sending process of FIG. 6 may include:
  • Step 601 Obtain a message image from a memory pool.
  • Step 602 Fill the sinking task identifier in the message image, and point it to the message control block.
  • Step 603 Determine whether it is an intra-core message or an inter-core message. If it is an intra-core message, perform step 604. If it is an inter-core message, perform the step. 605;
  • Step 604 Add a message image queue to the sink task, and end the processing
  • Step 605 Add an inter-core message image queue to the kernel to which the sink task belongs;
  • Step 606 Trigger an inter-core interrupt, and end processing.
  • Figure 7 shows the execution part of the kernel to which the scheduler belongs in the present example.
  • the scheduler responds to the inter-core interrupt of the kernel to which the sink task belongs, and extracts the message image one by one from the inter-core message image queue of the kernel.
  • the sink task IDs are transferred to the message image queue of the corresponding sink task.
  • the detailed operation flow of the scheduler in the execution part of the kernel to which the scheduler belongs in the message sending process of FIG. 7 may include:
  • Step 701 Inter-core interruption is generated
  • Step 702 Extract a message image from the inter-core message image queue of the kernel.
  • Step 703 Transfer the message image to a message image queue of the sink task.
  • Step 704 Determine whether the inter-core message image queue of the kernel is empty, and if yes, end the processing, otherwise proceed to step 702 to continue.
  • the method may further include: placing the source task in a blocking state, waiting to be received from The source task continues to run after the synchronization response message of the sink task.
  • the synchronization message sending process is also divided into the execution part of the kernel in which the scheduler belongs to the source task and the execution part of the kernel to which the scheduler belongs in the sink task.
  • the detailed operation process of the scheduler in the execution part of the kernel to which the source task belongs during the synchronization message sending process may include:
  • Step 801 Obtain a message image from a memory pool.
  • Step 802 Fill the sinking task identifier in the message image, and point it to the message control block.
  • Step 803 Determine whether it is an intra-core message or an inter-core message. If it is an intra-core message, perform step 804. If it is an inter-core message, perform the step. 805;
  • Step 804 adding a message image queue to the sink task, performing step 807;
  • Step 805 Add an inter-core message image queue to the kernel to which the sink task belongs;
  • Step 806 triggering an inter-core interrupt, performing step 807;
  • Step 807 Put the source task into a blocking state, and end the processing.
  • the detailed operation process of the scheduler in the execution part of the kernel to which the sink task belongs during the synchronization message sending process may include:
  • Step 901 Inter-core interruption is generated
  • Step 902 Extract a message image from the inter-core message image queue of the kernel.
  • Step 903 Transfer the message image to a message image queue of the sink task.
  • Step 904 Determine whether the inter-core message image queue of the kernel is empty. If yes, the process ends. Otherwise, go to step 902 to continue.
  • the synchronization message sending process is different from the normal message sending process in that: the scheduler not only adds the message image of the synchronization message to the message image queue of the sink task of the synchronization message, but also The source task of the synchronization message is placed in a blocking state so that it can continue to run after receiving a synchronization response message from the sink task of the synchronization message.
  • the message image is added to the head of the sink task message image queue of the synchronization response message, and the blocking status of the sink task of the synchronization response message is released. .
  • the synchronization response message transmission process is also divided into an execution part of the kernel to which the scheduler belongs and a execution part of the kernel to which the scheduler belongs in the sink task.
  • the detailed operation procedure of the scheduler in the execution part of the kernel to which the source task belongs during the synchronization response message sending process may include:
  • Step 1001 Obtain a message image from a memory pool.
  • Step 1002 pad the sink task identifier in the message image, and point it to the message control block; Step 1003, set a synchronization response flag;
  • Step 1004 Determine whether it is an intra-core message or an inter-core message. If it is an intra-core message, go to step 1005. If it is an inter-core message, go to step 1007.
  • Step 1005 Insert a team leader of the queue task message image queue
  • Step 1006 Dissolve the blocking state of the sink task, and end the processing
  • Step 1007 Add an inter-core message image queue to the kernel to which the sink task belongs;
  • Step 1008 Trigger an inter-core interrupt and end processing.
  • the detailed operation procedure of the scheduler in the execution part of the core to which the sink task belongs during the synchronization response message sending process may include:
  • Step 1101 Inter-core interruption is generated
  • Step 1102 Extract a message image from the inter-core message image queue of the kernel;
  • Step 1103 Transfer the message image to a message image queue of the sink task, and insert the message from the head position;
  • Step 1104 Release the blocking state of the sink task.
  • Step 1105 Determine whether the inter-core message image queue is empty, and if yes, end the process, otherwise proceed to step 1102 to continue.
  • the scheduler sets a synchronization response flag in the message image of the message, and after determining that it is a nuclear message, inserts the message image queue of the sink task from the head position, and finally releases the blocking state of the sink task. ;
  • the scheduler After judging that it is an inter-core message, in the execution part of the kernel to which the sink task belongs, the scheduler inserts the message into the head of the sink task message image queue according to the synchronization response flag in the message image, and also cancels the blocking state of the sink task.
  • Steps 201 and 202 in FIG. 2 are message receiving processes.
  • step 202 may include: Feedback source task identifier, message type, message name; if the message is a signal message that does not carry a data buffer, feedback message data; or, if the message is a buffer message carrying a data buffer, feedback data The buffer pointer, the location and length of the message data.
  • the method further includes: releasing a memory resource of the message image.
  • the detailed operation process of the message receiving process may include: Step 1201: Extract a message image from a message image queue of the task;
  • Step 1202 Obtain a message control block.
  • Step 1203 feedback message handle, source task identifier, message type, message name;
  • Step 1204 determining the message type, if it is a signal message, executing step 1205, if it is a buffer zone message, executing step 1206;
  • Step 1205 feedback message data, performing step 1207;
  • Step 1206 the feedback data buffer pointer, the location and length of the message data, step 1207;
  • Step 1207 Release the memory resource of the message image, and end the process.
  • the message release process may further include: if the message is a signal message that does not carry a data buffer, and the message has no other sink task, Release the memory resource of the message control block; or, if the message is a buffer message carrying a data buffer, and the message has no other sink task, release the message control block and the data buffer Memory resources.
  • the detailed operation process of the message release process may include: Step 1301: Determine whether the message has other sink tasks, and if so, end the process, otherwise perform step 1302;
  • Step 1302 determining the message type, if it is a signal message, performing step 1303, if it is a buffer zone message, executing step 1304;
  • Step 1303 Release the memory resource of the message control block, and end processing
  • Step 1304 Release the memory resource of the message control block and the memory resource of the data buffer carried by the message, and end the process. It can be completed by a program to instruct related hardware, and the program can be stored in a computer.
  • the program may include all or part of the steps in the foregoing embodiment, and the storage medium may include: a ROM, a RAM, a magnetic disk, an optical disk, and the like.
  • a multi-core processor message scheduler is also provided in the embodiment of the present invention, as described in the following embodiments. Since the principle of solving the problem by the multi-core processor message scheduler is similar to that of the multi-core processor message scheduling method, the implementation of the multi-core processor message scheduler can be referred to the implementation of the multi-core processor message scheduling method, and the repetition will not be repeated.
  • the multi-core processor message scheduler in the embodiment of the present invention may include: a first generation module 1401, a message control block for generating a message, the message control block recording description information and scheduling control of the message Information
  • a second generating module 1402 configured to generate a message image of the message, where the message image points to the message control block;
  • the first generating module 1401 may include:
  • a first padding unit configured to fill a message type, a source task identifier, and a message name in the message control block
  • the second padding unit may include an entity for filling message data in a message body of the message control block when the message is a signal message not carrying a data buffer, and for the message being When a buffer message carrying a data buffer is carried, any one or a combination of the data buffer pointer, the location of the message data, and the length of the entity are filled in the message body of the message control block.
  • the second generating module 1402 can include:
  • a third padding unit configured to point a message control block pointer of the message image to the message control block
  • a fourth filling unit configured to populate the sink task identifier, the synchronization response flag, and the linked list pointer in the message image.
  • the adding module 1403 can also be used to: When the message is an intra-core message, the message image is directly added to the sink task message image queue; or
  • the message image is transferred to the sink task message image queue via the inter-core message image queue of the kernel to which the sink task belongs.
  • the adding module 1403 may include an entity for directly adding the message image to a sink task message image queue when the message is an intra-core message and for when the message is an inter-core message, Any one or a combination of two of the entities in the inter-core message image queue of the kernel to which the message is to be hosted to the task message image queue.
  • the multi-core processor message scheduler shown in FIG. 14 may further include:
  • a blocking module configured to: after the adding module adds the message image of the synchronization message to the sink task message image queue, placing the source task in a blocking state, and continuing to run the source task after receiving the synchronization response message from the sink task .
  • the adding module 1403 may be further configured to add a message image of the synchronization response message to a head of the sink task message image queue; the multi-core processor message scheduler may further include :
  • the blocking release module is configured to cancel the blocking state of the sink task after the adding module adds the message image to the head of the sink task message image queue.
  • the multi-core processor message scheduler in the embodiment of the present invention may include: an extracting module 1501, configured to extract a message image of a message from a sink task message image queue; and a feedback module 1502, configured to The message control block pointed to by the message image feeds back the description information and the scheduling control information of the message to the sink task.
  • the feedback module 1502 can include:
  • a first feedback unit configured to feed back a source task identifier, a message type, and a message name
  • a second feedback unit configured to: when the message is a signal message that does not carry a data buffer, feed back the message data; or, when the message is a buffer message carrying a data buffer, the feedback data buffer The area pointer, the location and length of the message data.
  • the multi-core processor message scheduler shown in FIG. 15 may further include: a first release module, configured to release a memory resource of the message image; a second release module, configured to release a memory resource of the message control block when the message is a signal message that does not carry a data buffer, and if there is no other sink task; or, the message is a portable data buffer When the zone's buffer message and there are no other sink tasks, the memory resources of the message control block and the data buffer are released.
  • the message image constituting the message queue is separated from the message control block for describing and controlling the message.
  • the message is sent, it is not necessary to copy the message control block and the data buffer, but only the message image and the message are generated.
  • the image is added to the message image queue of the corresponding sink task; when receiving the message, only the message image of the message needs to be extracted from the sink task message image queue, and the description information of the message is fed back to the sink task according to the message control block pointed to by the message image and Scheduling control information; thus, in the messaging process, high-speed transmission of messages can be realized without repeated data copying operations, and no additional memory is needed, which can save memory overhead and improve message transmission efficiency.
  • the multi-core processor message scheduling method and the scheduler in the embodiment of the invention can implement high-speed message delivery in various scenarios, and greatly reduce the time overhead of the message scheduling function.
  • the message image that constitutes the message queue and the message control block that describes and controls the message are separated.
  • message broadcast only multiple message images are added to the message image queue of the corresponding sink task without copying the message control. Block and data buffers for high-speed message broadcast.
  • the multi-core processor message scheduling method and the scheduler of the embodiment of the present invention directly transmit a buffer that carries message data for a case where there is a large amount of information, and transmits a message control block for a case where the amount of information is small.
  • Message data no extra memory is used. Therefore, the memory overhead of the message scheduling function can also be greatly reduced.
  • the multi-core processor message scheduling method and the scheduler of the embodiment of the present invention can support variable length messages and variable length message queues without setting the maximum amount of data carried by the message and the length limit of the message queue.
  • the embodiments of the present invention are particularly applicable to multi-core DSP software with limited on-chip memory capacity and extremely high real-time requirements.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

A method for multi-core processor message scheduling is provided. The method includes: creating a message control block for a message, wherein the message control block records the description information and the scheduling control information of the message; creating a message reflection of the message, wherein the message reflection points to the message control block; inserting the message reflection into the message reflection queue of a sink task. A scheduler for multi-core processor messages is also provided. The disclosed solution enables high speed message transmission while requiring no additional memory, reducing memory cost and improving message transmission efficiency.

Description

说 明 书  Description
多核处理器消息调度方法及调度器 本申请要求了 2009年 8月 25日提交的, 申请号为 200910171233.7, 发明名称为 "多核处理器消息调度方法及调度器"的中国专利申请的优先权, 其全部内容通过引用结合在本申请中。 技术领域  Multi-core processor message scheduling method and scheduler. The present application claims priority to Chinese Patent Application No. 200910171233.7, entitled "Multi-core Processor Message Scheduling Method and Scheduler", filed on August 25, 2009, The entire contents are incorporated herein by reference. Technical field
本发明涉及计算机及通信技术领域, 尤其涉及多核处理器调度方法及 调度器。 背景技术  The present invention relates to the field of computer and communication technologies, and in particular, to a multi-core processor scheduling method and a scheduler. Background technique
多核处理器系统中, 各内核拥有共享的内存空间。 内存緩冲区是任务之 间以及内核之间传递消息的实体。 为了保证先发送的消息先被接收, 承载消 息的緩冲区通常被设计成前后连接的队列结构。 这种緩冲区构成的队列称为 消息队列。  In a multi-core processor system, each core has a shared memory space. Memory buffers are entities that pass messages between tasks and between cores. In order to ensure that the first transmitted message is received first, the buffer that carries the message is usually designed as a queue structure that is connected in tandem. A queue of such buffers is called a message queue.
作为一种被频繁使用的系统功能, 消息传递的效率在很大程度上影响多 任务嵌入式系统的运行效率 , 这种影响体现在消息调度过程存在时间和内存 两方面的开销。 时间开销包括消息调度功能操作消息队列的执行时间, 以及 因为用阻塞方式发送消息, 任务进入、 退出阻塞状态所引起的任务切换时间。 消息在发送之后和接收之前, 相应的数据暂时存放在消息队列的緩冲区中, 内存开销就是指消息队列占用的内存空间。 消息队列的长度和队列中各个緩 冲区的大小决定了消息调度功能的内存开销。  As a frequently used system function, the efficiency of message transfer greatly affects the operating efficiency of multi-tasking embedded systems. This effect is reflected in the time and memory overhead of the message scheduling process. The time overhead includes the execution time of the message scheduling function operation message queue, and the task switching time caused by the task entering and exiting the blocking state because the message is sent in a blocking manner. After the message is sent and received, the corresponding data is temporarily stored in the buffer of the message queue. The memory overhead refers to the memory space occupied by the message queue. The length of the message queue and the size of each buffer in the queue determine the memory overhead of the message scheduling function.
由此可见, 消息队列的管理方式在很大程度上影响消息传递的效率, 是 消息调度技术所面临的重要问题。  It can be seen that the management of message queue greatly affects the efficiency of message delivery, and is an important issue faced by message scheduling technology.
现有技术中, 邮箱和消息池是实现消息调度的通用方法。 邮箱方法用静 态緩冲区组织消息队列以实现消息调度; 消息池方法则釆用动态緩冲区分配 机制以实现消息调度。  In the prior art, mailboxes and message pools are a general method for implementing message scheduling. The mailbox method organizes the message queue with a static buffer to implement message scheduling; the message pool method uses a dynamic buffer allocation mechanism to implement message scheduling.
由于现有技术在实现消息调度时, 需要在消息收发过程进行大量重复的 数据拷贝操作, 导致时间开销大, 并且也使消息广播和消息转发过程需要额 外内存来存放新消息, 导致内存资源浪费, 因而无法为多核处理器提供较高 效的消息调度功能。 发明内容 Because the prior art implements message scheduling, it needs to perform a large number of repetitions in the messaging process. The data copy operation results in a large time overhead, and also causes the message broadcast and message forwarding process to require additional memory to store new messages, resulting in wasted memory resources and thus failing to provide a more efficient message scheduling function for the multi-core processor. Summary of the invention
本发明实施例提供一种多核处理器消息调度方法, 用以提高消息传递的 效率, 该方法包括:  An embodiment of the present invention provides a multi-core processor message scheduling method, which is used to improve the efficiency of message delivery. The method includes:
产生消息的消息控制块 , 所述消息控制块记录所述消息的描述信息及调 度控制信息;  Generating a message control block of the message, the message control block recording description information of the message and scheduling control information;
产生所述消息的消息映像, 所述消息映像指向所述消息控制块; 将所述消息映像添加到所述消息对应的宿任务消息映像队列。  Generating a message image of the message, the message image pointing to the message control block; adding the message image to a sink task message image queue corresponding to the message.
本发明实施例还提供一种多核处理器消息调度方法, 用以提高消息传递 的效率, 该方法包括:  The embodiment of the present invention further provides a multi-core processor message scheduling method, which is used to improve the efficiency of message delivery, and the method includes:
从所接收消息对应的宿任务消息映像队列中摘取所述消息的消息映像; 根据所述消息映像指向的消息控制块, 向宿任务反馈所述消息的描述信 息及调度控制信息。  Extracting a message image of the message from a sink task message image queue corresponding to the received message; and, according to the message control block pointed to by the message image, feeding back the description information of the message and the scheduling control information to the sink task.
本发明实施例还提供一种多核处理器消息调度器, 用以提高消息传递的 效率, 该多核处理器消息调度器包括:  The embodiment of the present invention further provides a multi-core processor message scheduler, which is used to improve the efficiency of message delivery. The multi-core processor message scheduler includes:
第一产生模块, 用于产生消息的消息控制块, 所述消息控制块记录所述 消息的描述信息及调度控制信息;  a first generation module, a message control block for generating a message, where the message control block records description information and scheduling control information of the message;
第二产生模块, 用于产生所述消息的消息映像, 所述消息映像指向所述 消息控制块;  a second generating module, configured to generate a message image of the message, where the message image points to the message control block;
添加模块, 用于将所述消息映像添加到所述消息对应的宿任务消息映像 队列。  And adding a module, configured to add the message image to a sink task message image queue corresponding to the message.
本发明实施例还提供一种多核处理器消息调度器 , 用以提高消息传递的 效率, 该多核处理器消息调度器包括:  The embodiment of the present invention further provides a multi-core processor message scheduler, which is used to improve the efficiency of message delivery. The multi-core processor message scheduler includes:
摘取模块, 用于从宿任务消息映像队列中摘取消息的消息映像; 反馈模块, 用于根据所述消息映像指向的消息控制块, 向宿任务反馈所 述消息的描述信息及调度控制信息。 本发明实施例中 , 构成消息队列的消息映像和对消息进行描述和控制的 消息控制块分离, 在发送消息时, 无需复制消息控制块和数据緩冲区, 而仅 需产生消息映像、 将消息映像添加到对应宿任务的消息映像队列; 在接收消 息时, 仅需从宿任务消息映像队列中摘取消息的消息映像, 根据消息映像指 向的消息控制块, 向宿任务反馈消息的描述信息及调度控制信息; 因而在消 息收发过程无需进行重复的数据拷贝操作, 即可实现消息的高速传输, 且无 需使用额外内存, 可以节省内存开销, 提高消息传递的效率。 附图说明 施例或现有技术描述中所需要使用的附图作简单地介绍, 显而易见地, 下面 描述中的附图仅仅是本发明的一些实施例 , 对于本领域普通技术人员来讲, 在不付出创造性劳动性的前提下, 还可以根据这些附图获得其他的附图。 在 附图中: An extracting module, configured to extract a message image of the message from the sink task message image queue; a feedback module, configured to feed back, according to the message control block pointed by the message image, the description information and the scheduling control information of the message to the sink task . In the embodiment of the present invention, the message image constituting the message queue is separated from the message control block for describing and controlling the message. When the message is sent, it is not necessary to copy the message control block and the data buffer, but only the message image and the message are generated. The image is added to the message image queue of the corresponding sink task; when receiving the message, only the message image of the message needs to be extracted from the sink task message image queue, and the description information of the message is fed back to the sink task according to the message control block pointed to by the message image and Scheduling control information; thus, in the messaging process, high-speed transmission of messages can be realized without repeated data copying operations, and no additional memory is needed, which can save memory overhead and improve message transmission efficiency. BRIEF DESCRIPTION OF THE DRAWINGS The accompanying drawings, which are set forth in the description of the claims Other drawings may also be obtained from these drawings without the inventive labor. In the drawing:
图 1、 图 2为本发明实施例中多核处理器消息调度方法的处理流程图; 图 3为本发明实施例中多核处理器消息调度方法的实施场景示意图; 图 4为本发明实施例中动态内存管理实例示意图;  1 and FIG. 2 are flowcharts showing a process of a multi-core processor message scheduling method according to an embodiment of the present invention; FIG. 3 is a schematic diagram of an implementation scenario of a multi-core processor message scheduling method according to an embodiment of the present invention; Schematic diagram of memory management example;
图 5为本发明实施例中消息创建过程的详细操作流程图;  FIG. 5 is a flowchart of detailed operations of a message creation process according to an embodiment of the present invention;
图 6为本发明实施例中消息发送过程中调度器在源任务所属内核的执行 部分的详细操作流程图;  6 is a flowchart showing a detailed operation of a scheduler in an execution part of a kernel to which a source task belongs in a message sending process according to an embodiment of the present invention;
图 7为本发明实施例中消息发送程中调度器在宿任务所属内核的执行部 分的详细操作流程图;  7 is a flowchart showing the detailed operation of the execution part of the kernel to which the scheduler belongs in the message sending process in the message sending process according to the embodiment of the present invention;
图 8为本发明实施例中同步消息发送过程中调度器在源任务所属内核的 执行部分的详细操作流程图;  FIG. 8 is a flowchart of detailed operations of a scheduler in an execution part of a core to which a source task belongs in a synchronization message sending process according to an embodiment of the present invention; FIG.
图 9为本发明实施例中同步消息发送过程中调度器在宿任务所属内核的 执行部分的详细操作流程图;  FIG. 9 is a flowchart of detailed operations of an execution part of a kernel to which a scheduler belongs in a synchronization message during a synchronization message transmission according to an embodiment of the present invention;
图 10 为本发明实施例中同步应答消息发送过程中调度器在源任务所属 内核的执行部分的详细操作流程图;  FIG. 10 is a flowchart showing a detailed operation of a scheduler in an execution part of a core to which a source task belongs in a process of sending a synchronization response message according to an embodiment of the present invention; FIG.
图 11 为本发明实施例中同步应答消息发送过程中调度器在宿任务所属 内核的执行部分的详细操作流程图; FIG. 11 is a flowchart of a scheduler in a process of sending a synchronization response message according to an embodiment of the present invention; Detailed operational flow chart of the execution part of the kernel;
图 12为本发明实施例中消息接收过程的详细操作流程图;  FIG. 12 is a flowchart of detailed operations of a message receiving process according to an embodiment of the present invention;
图 13为本发明实施例中消息释放过程的详细操作流程图;  FIG. 13 is a flowchart of detailed operations of a message release process according to an embodiment of the present invention;
图 14、 图 15为本发明实施例中多核处理器消息调度器的结构示意图。 具体实施方式  14 and FIG. 15 are schematic diagrams showing the structure of a multi-core processor message scheduler according to an embodiment of the present invention. detailed description
为使本发明实施例的目的、 技术方案和优点更加清楚明白, 下面结合附 图对本发明实施例做进一步详细说明。 在此, 本发明的示意性实施例及其说 明用于解释本发明, 但并不作为对本发明的限定。  In order to make the objects, technical solutions and advantages of the embodiments of the present invention more clearly, the embodiments of the present invention are further described in detail below. The illustrative embodiments of the present invention and the description thereof are intended to be illustrative of the invention, and are not intended to limit the invention.
如图 1所示, 本发明实施例中多核处理器消息调度方法的处理流程可以 包括:  As shown in FIG. 1, the processing flow of the multi-core processor message scheduling method in the embodiment of the present invention may include:
步骤 101、 产生消息的消息控制块, 所述消息控制块记录所述消息的描 述信息及调度控制信息;  Step 101: Generate a message control block of the message, where the message control block records the description information of the message and the scheduling control information.
步驟 102、 产生所述消息的消息映像, 所述消息映像指向所述消息控制 块;  Step 102: Generate a message image of the message, where the message image points to the message control block;
步驟 103、 将所述消息映像添加到宿任务消息映像队列。  Step 103: Add the message image to the sink task message image queue.
图 1所示流程中, 构成消息队列的消息映像和对消息进行描述和控制的 消息控制块分离, 在发送消息时, 无需复制消息控制块和数据緩冲区, 而仅 需产生消息映像、 将消息映像添加到对应宿任务的消息映像队列, 因而在消 息发送过程无需进行重复的数据拷贝操作, 即可实现消息的高速发送, 且无 需使用额外内存, 可以节省内存开销, 提高消息发送的效率。  In the flow shown in Figure 1, the message image that constitutes the message queue is separated from the message control block that describes and controls the message. When sending the message, there is no need to copy the message control block and the data buffer, but only the message image is generated. The message image is added to the message image queue of the corresponding sink task, so that the message transmission process does not need to perform repeated data copy operations, and the message can be sent at a high speed without using extra memory, which can save memory overhead and improve the efficiency of message transmission.
如图 2所示, 本发明实施例中多核处理器消息调度方法的处理流程可以 包括:  As shown in FIG. 2, the processing flow of the multi-core processor message scheduling method in the embodiment of the present invention may include:
步骤 201、 从宿任务消息映像队列中摘取(即出列) 消息的消息映像; 步驟 202、 根据所述消息映像指向的消息控制块, 向宿任务反馈所述消 息的描述信息及调度控制信息。  Step 201: Extract (ie, dequeue) the message image of the message from the sink task message image queue. Step 202: Feed back, according to the message control block pointed to by the message image, the description information and the scheduling control information of the message to the sink task. .
图 2所示流程中, 构成消息队列的消息映像和对消息进行描述和控制的 消息控制块分离, 在接收消息时, 无需复制消息控制块和数据緩冲区, 而仅 需从宿任务消息映像队列中摘取消息的消息映像, 根据消息映像指向的消息 控制块, 向宿任务反馈消息的描述信息及调度控制信息, 因而在消息接收过 程无需进行重复的数据拷贝操作, 即可实现消息的高速接收, 且无需使用额 外内存, 可以节省内存开销, 提高消息接收的效率。 In the flow shown in Figure 2, the message image that constitutes the message queue is separated from the message control block that describes and controls the message. When receiving the message, there is no need to copy the message control block and the data buffer, but only the slave task message image The message image of the message in the queue, according to the message pointed to by the message image The control block feeds back the description information and the scheduling control information of the message to the sink task, so that the message receiving process does not need to perform a repeated data copy operation, so that the message can be received at a high speed without using extra memory, which can save memory overhead and improve the message. The efficiency of reception.
下面具体举例说明本发明实施例的多核处理器消息调度方法的实施。 图 The implementation of the multi-core processor message scheduling method in the embodiment of the present invention is specifically illustrated below. Figure
3为多核处理器消息调度方法的实施场景示意图, 图 3中, 多核处理器消息 调度方法涉及的实施实体 /模块可以包括如下几个部分: 消息调度接口、 三级 调度机构、 调度器。 3 is a schematic diagram of an implementation scenario of a multi-core processor message scheduling method. In FIG. 3, an implementation entity/module involved in a multi-core processor message scheduling method may include the following parts: a message scheduling interface, a three-level scheduling mechanism, and a scheduler.
消息调度接口提供一系列功能原语, 包括: 消息创建原语、 消息发送原 语、 消息接收原语、 消息释放原语、 同步消息发送原语、 同步应答消息发送 原语。  The message scheduling interface provides a series of function primitives, including: message creation primitive, message sending primitive, message receiving primitive, message release primitive, synchronization message sending primitive, and synchronous response message sending primitive.
三级调度机构是为了便于描述, 将涉及用于调度器管理、 调度消息的三 个部分, 包括: 消息映像队列簇、 消息控制块集合、 数据緩冲区集合一起称 之为 "三级调度机构" 。  The three-level scheduling mechanism is for ease of description, and will involve three parts for the scheduler management and scheduling messages, including: message image queue cluster, message control block set, and data buffer set together called "three-level scheduling mechanism" " .
其中, 消息映像队列簇分为两类: 核内消息映像队列簇、 核间消息映像 队列簇。  Among them, the message image queue cluster is divided into two categories: intra-core message image queue cluster, inter-core message image queue cluster.
消息映像是任务与内核的接收消息在相应消息队列中的映像, 它指向接 收消息的消息控制块。  The message image is the image of the receiving message of the task and the kernel in the corresponding message queue, which points to the message control block that receives the message.
每个内核上的每一个任务都拥有一个消息映像队列 , 它由这个任务接收 的消息映像以链表形式组织起来。 一般情况下, 所有消息映像以 FIFO ( First In First Out, 先进先出)方式进出这个队列, 即从队尾添加, 从队首摘取。 一个内核所有任务的消息映像队列组成这个内核的核内消息映像队列簇。  Each task on each core has a message image queue, and the message images it receives from this task are organized in a linked list. In general, all message images enter and exit this queue in FIFO (First In First Out) mode, which is added from the end of the queue and extracted from the head of the team. The message image queue for all tasks of a kernel constitutes the kernel's intra-core message image queue cluster.
除了核内消息映像队列簇以外,每个内核还拥有一个核间消息映像队列。 一个内核所有任务从其它内核上的任务接收到的消息映像首先排列在这个内 核的核间消息映像队列中, 由调度器将它们逐个转移到相应接收任务的消息 映像队列中去。 核间消息映像队列同样是以链表形式存在, 消息映像同样以 FIFO方式进出这个队列。所有内核的核间消息映像队列组成多核处理器的核 间消息映像队列簇。 的控制块。 一个消息控制块记录一个消息的描述信息和调度控制信息。 如果 消息携带的数据量较少, 消息控制块可以包含这个消息的全部信息; 如果消 息需要携带较多数据, 这些数据可以存储在一个数据緩冲区里, 由消息控制 块中的緩冲区指针指向这一数据緩冲区。 具体是否需要将数据存储在一个数 据緩冲区中, 可以依据实际情况进行决定, 比如可以依据消息可携带的数据 量进行决定。 In addition to the intra-core message image queue cluster, each core also has an inter-core message image queue. The message images received by all tasks of a kernel from tasks on other cores are first arranged in the inter-core message image queue of the kernel, and the scheduler transfers them one by one to the message image queue of the corresponding receiving task. The inter-core message image queue is also in the form of a linked list, and the message image also enters and exits the queue in FIFO mode. The intercore message image queues of all cores form the intercore message image queue cluster of the multicore processor. Control block. A message control block records description information and scheduling control information of a message. in case The message carries less data. The message control block can contain all the information of the message. If the message needs to carry more data, the data can be stored in a data buffer, pointed to by the buffer pointer in the message control block. This data buffer. Whether the data needs to be stored in a data buffer may be determined according to actual conditions, for example, according to the amount of data that the message can carry.
数据緩冲区集合包含所有因为消息携带较多数据而由消息控制块指示的 数据緩冲区。 数据緩冲区的大小因相应消息携带数据量的不同而不同。  The data buffer set contains all the data buffers indicated by the message control block because the message carries more data. The size of the data buffer varies depending on the amount of data carried by the corresponding message.
下面结合图 4所示的本发明实施例中动态内存管理实例说明消息分类, 并进一步解释图 3所示三级调度机构中各组成部分的关系。  The message classification is explained below in conjunction with the dynamic memory management example in the embodiment of the present invention shown in FIG. 4, and the relationship between the components in the three-level scheduling mechanism shown in FIG. 3 is further explained.
根据是否使用数据緩冲区, 消息分为信号消息和緩冲区消息。 图 4中, 消息 B的控制块不携带数据緩冲区, 是信号消息; 消息 A、 C、 D的控制块 分别携带大小不同的数据緩冲区, 它们都是緩冲区消息。  Messages are divided into signal messages and buffer messages depending on whether or not the data buffer is used. In Figure 4, the control block of message B does not carry a data buffer, which is a signal message; the control blocks of messages A, C, and D respectively carry data buffers of different sizes, which are buffer messages.
根据接收任务是否唯一, 消息分为单播消息和广播消息。 接收任务又称 为宿任务, 相应的, 发送任务又称为源任务。 一个消息只有一个源任务, 记 录在消息控制块中; 而宿任务可以有多个, 分别记录在它的消息映像中。 图 4中, 消息 A、 B、 C的控制块被多个消息映像所指示, 即它们都有多个宿任 务, 所以是广播消息; 消息 D只被一个消息映像指示, 是单播消息。  According to whether the receiving task is unique, the message is divided into a unicast message and a broadcast message. The receiving task is also called the sinking task. Correspondingly, the sending task is also called the source task. A message has only one source task, recorded in the message control block; and there can be multiple sink tasks, which are recorded in its message image. In Figure 4, the control blocks of messages A, B, and C are indicated by multiple message maps, that is, they all have multiple sink tasks, so they are broadcast messages; message D is only indicated by one message map, which is a unicast message.
才艮据源任务和宿任务是否属于同一内核,消息分为核内消息与核间消息。 特别的, 如果广播消息的多个宿任务中, 有些与它的源任务属于同一内核, 有些属于不同内核, 那么它既是核内消息, 又是核间消息。 对于核内消息, 调度器直接把它的消息映像添加到宿任务的消息映像队列中;对于核间消息, 调度器首先把它的消息映像添加到宿任务所属内核的核间消息映像队列 , 然 后将其转移到宿任务的消息映像队列中。 图 4中, 消息 C的两个宿任务分别 属于核 1与核 2, 它是核间消息; 消息 A的两个消息映像, 其中之一位于核 2的核间消息映像队列, 它即将被转移到核 2某个任务的消息映像队列中, 因此也是核间消息。  According to whether the source task and the sink task belong to the same kernel, the message is divided into the intra-core message and the inter-core message. In particular, if a plurality of sink tasks of a broadcast message belong to the same kernel as its source task, and some belong to different cores, then it is both a nuclear message and an inter-core message. For intra-core messages, the scheduler directly adds its message image to the message image queue of the sink task; for inter-core messages, the scheduler first adds its message image to the inter-core message image queue of the kernel to which the sink task belongs, and then Transfer it to the message image queue of the sink task. In Figure 4, the two sink tasks of message C belong to core 1 and core 2, respectively, which are inter-core messages; two message images of message A, one of which is located in the inter-core message image queue of core 2, which is about to be transferred. Go to the message image queue of a task of core 2, and therefore also the inter-core message.
根据发送过程是否伴随着任务运行状态的改变, 消息还分为普通消息、 同步消息和同步应答消息。 普通消息按照非阻塞方式发送, 调度器不改变源 任务和宿任务的运行状态。 同步消息按照阻塞方式发送, 调度器在把它的消 息映像添加到宿任务消息映像队列的同时, 将源任务置于阻塞状态。 相对的, 同步应答消息发送时, 调度器解除宿任务的阻塞状态, 使它得以继续运行。 不同于一般情况, 同步应答消息的消息映像并不是按 FIFO方式添加到宿任 务的消息映像队列, 调度器将它插入队首的位置, 使宿任务继续运行后最先 接收到这个消息。 The message is further divided into a normal message, a synchronization message, and a synchronization response message according to whether the transmission process is accompanied by a change in the running state of the task. The normal message is sent in a non-blocking manner, and the scheduler does not change the running status of the source task and the sink task. The synchronization message is sent in blocking mode, and the scheduler is doing it. The source task is placed in a blocking state while the information image is added to the sink task message image queue. In contrast, when the synchronous response message is sent, the scheduler releases the blocking state of the sink task, so that it can continue to run. Different from the general situation, the message image of the synchronous response message is not added to the message image queue of the sink task in FIFO mode, and the scheduler inserts it into the position of the leader of the queue, so that the message is received first after the sink task continues to run.
三级消息调度机构, 以及各种消息的创建、 发送、 接收、 释放过程都可 以受调度器的管理和调度。 源任务创建消息时, 调度器产生消息控制块, 建 立消息控制块与源任务输入的数据緩冲区之间的联系。 源任务发送消息时 , 调度器产生消息映像, 使它指向消息控制块, 对于核内消息, 直接把它添加 到宿任务消息映像队列, 对于核间消息, 在此之前先经过宿任务所属内核的 核间消息映像队列的中转。 宿任务接收消息时, 调度器从当前任务的消息映 像队列摘取一个消息映像, 根据它所指示的消息控制块, 向宿任务反馈消息 来源、 消息类型和消息所携带的数据緩冲区, 同时释放消息映像。 宿任务释 放消息时, 调度器在确认该消息没有其他的宿任务后, 释放消息控制块和消 息携带的数据緩冲区。  The three-level message scheduling mechanism, as well as the creation, transmission, reception, and release of various messages, can be managed and scheduled by the scheduler. When the source task creates a message, the scheduler generates a message control block that establishes a connection between the message control block and the data buffer of the source task input. When the source task sends a message, the scheduler generates a message image, which points to the message control block. For the intra-core message, it is added directly to the sink task message image queue. For the inter-core message, before the core of the sink task The relay of the inter-core message image queue. When the sink task receives the message, the scheduler extracts a message image from the message image queue of the current task, and according to the message control block indicated by it, feeds back the message source, the message type and the data buffer carried by the message to the sink task, Release the message image. When the sink task releases the message, the scheduler releases the message control block and the data buffer carried by the message after confirming that the message has no other sink tasks.
如前所述, 对于同步消息和同步应答消息的发送, 调度器还需相应改变 源任务和宿任务的运行状态。  As mentioned earlier, for the sending of synchronization messages and synchronization response messages, the scheduler also needs to change the running status of the source task and the sink task accordingly.
一个实施例中, 图 3所示的消息调度接口的各种功能原语描述如下: 消息创建原语接受源任务输入的消息类型、 消息名和消息体。 对于信号 消息, 消息体就是需要发送的消息数据本身; 对于緩冲区消息, 消息体包含 消息所携带数据緩冲区的指针、 消息数据在緩冲区内的位置、 消息数据的长 度。 消息创建原语触发调度器的消息创建过程, 执行结束向源任务反馈消息 句柄。  In one embodiment, various functional primitives of the message scheduling interface shown in FIG. 3 are described as follows: The message creation primitive accepts the message type, message name, and message body of the source task input. For a signal message, the message body is the message data itself that needs to be sent; for a buffer message, the message body contains a pointer to the data buffer carried by the message, the location of the message data in the buffer, and the length of the message data. The message creation primitive triggers the message creation process of the scheduler, and the execution ends to feed back the message handle to the source task.
消息发送原语接受源任务输入的宿消息标识和待发送消息句柄, 触发调 度器的消息发送过程。  The message sending primitive accepts the sink message identifier input by the source task and the message handle to be sent, and triggers the message sending process of the scheduler.
消息接收原语触发调度器的消息接收过程, 执行结束向宿任务反馈一个 接收消息的消息句柄, 以及这个消息的消息类型、 源任务标识、 消息名和消 息体。 对于信号消息, 消息体就是消息数据本身, 对于緩冲区消息, 消息体 包括数据緩冲区指针、 消息数据在緩冲区内的位置、 消息数据的长度。 消息释放原语接受宿任务输入的消息句柄 ,触发调度器的消息释放过程。 同步消息发送原语和同步应答消息发送原语接受与消息发送原语相同的 输入, 触发调度器的同步消息发送过程和同步应答消息发送过程。 The message receiving primitive triggers the message receiving process of the scheduler, and the execution ends to feed back a message handle of the received message to the sink task, and the message type, source task identifier, message name, and message body of the message. For signal messages, the message body is the message data itself. For buffer messages, the message body includes the data buffer pointer, the location of the message data in the buffer, and the length of the message data. The message release primitive accepts the message handle input by the sink task, triggering the message release process of the scheduler. The synchronization message sending primitive and the synchronization response message sending primitive accept the same input as the message sending primitive, triggering the scheduler's synchronization message sending process and the synchronous reply message sending process.
图 3、 图 4所示三级调度机构基于表一和表二显示的消息控制块数据结 构和消息映像数据结构构成。  The three-level scheduling mechanism shown in Figure 3 and Figure 4 is based on the message control block data structure and message image data structure shown in Tables 1 and 2.
表一 消息控制块数据结构  Table 1 Message Control Block Data Structure
Figure imgf000009_0001
具体实施时, 本发明实施例的多核处理器消息调度方法在发送消息时, 可以由下列调度过程组成: 消息创建过程、 消息发送过程、 同步消息发送过 程、 同步应答消息发送过程; 在接收消息时, 可以由下列调度过程组成: 消 息接收过程、 消息释放过程。
Figure imgf000009_0001
In a specific implementation, the multi-core processor message scheduling method in the embodiment of the present invention may be composed of the following scheduling processes when sending a message: a message creation process, a message sending process, a synchronous message sending process, and a synchronous response message sending process; , can be composed of the following scheduling process: message receiving process, message release process.
图 1中步驟 101为消息创建过程, 具体实施时可以包括: 在所述消息控 制块填充消息类型、 源任务标识、 消息名; 若所述消息为不携带数据緩冲区 的信号消息, 在所述消息控制块的消息体中填充消息数据; 或者, 若所述消 息为携带数据緩冲区的緩冲区消息 , 在所述消息控制块的消息体中填充数据 緩冲区指针、 消息数据的位置和长度。  Step 101 in FIG. 1 is a message creation process. The specific implementation may include: filling a message type, a source task identifier, and a message name in the message control block; if the message is a signal message not carrying a data buffer, Filling the message data in the message body of the message control block; or, if the message is a buffer message carrying a data buffer, filling the data buffer pointer and the message data in the message body of the message control block Location and length.
如图 5所示, 一个实施例中, 消息创建过程的详细操作流程可以包括: 步驟 501、 从内存池获取消息控制块;  As shown in FIG. 5, in an embodiment, the detailed operation process of the message creation process may include: Step 501: Obtain a message control block from a memory pool;
步骤 502、 在消息控制块填充消息类型、 源任务标识、 消息名; 步骤 503、 判断消息类型, 若是信号消息, 则执行步骤 504, 若是緩冲 区消息, 则执行步驟 505;  Step 502, filling the message type, the source task identifier, the message name in the message control block; Step 503, determining the message type, if it is a signal message, executing step 504, if it is a buffer area message, executing step 505;
步驟 504、 在消息控制块直接填充消息数据, 执行步驟 506;  Step 504, directly filling the message data in the message control block, performing step 506;
步驟 505、 在消息控制块填入数据緩冲区指针、 消息数据的位置和长度, 执行步驟 506;  Step 505, filling in the data buffer pointer, the location and length of the message data in the message control block, step 506;
步骤 506、 反馈消息句柄, 结束处理。  Step 506: Feedback the message handle, and end processing.
对于携带信息量较少的信号消息, 将消息数据复制进消息控制块进行传 递; 对于携带信息量较多的緩冲区消息, 通过消息控制块直接传递数据緩冲 区的指针以及消息数据在緩冲区的位置和长度。 因此, 无论在同一内核任务 间还是在不同内核任务间, 后续的消息发送和接收过程都不存在大量的数据 拷贝, 可以实现高速传递。  For a signal message carrying less information, the message data is copied into the message control block for transmission; for a buffer message carrying a large amount of information, the pointer of the data buffer and the message data are directly transmitted through the message control block. The location and length of the punching area. Therefore, no matter whether there are a large number of data copies in the subsequent message sending and receiving processes between the same kernel task or between different kernel tasks, high-speed transfer can be realized.
图 1中步骤 102、 103为消息发送过程, 具体实施时步骤 102可以包括: 将消息映像的消息控制块指针指向所述消息控制块; 在所述消息映像填充宿 任务标识、 同步应答标志、 链表指针。 步驟 103可以包括: 所述消息为核内 消息时, 直接将所述消息映像添加到宿任务消息映像队列; 或者, 所述消息 为核间消息时, 将所述消息映像经宿任务所属内核的核间消息映像队列中转 至宿任务消息映像队列。 一个实施例中, 消息发送过程分为调度器在源任务所属内核的执行部分 和调度器在宿任务所属内核的执行部分。 Steps 102 and 103 in FIG. 1 are message sending processes. In specific implementation, step 102 may include: pointing a message control block pointer of the message image to the message control block; filling the sink task identifier, the synchronization response flag, and the linked list in the message image pointer. Step 103 may include: when the message is an intra-core message, directly adding the message image to a sink task message image queue; or, when the message is an inter-core message, mapping the message to a kernel to which the host task belongs The inter-core message image queue is transferred to the sink task message image queue. In one embodiment, the message sending process is divided into an execution part of the kernel in which the scheduler belongs to the source task and an execution part of the kernel to which the scheduler belongs in the sink task.
如图 6所示为本例中调度器在源任务所属内核的执行部分, 其中, 调度 器比较消息控制块中记录的源任务标识和输入的宿任务标识, 判断待发送消 息是核内消息还是核间消息。 具体而言, 比较的是源任务标识中的任务所属 核编号和宿任务标识中的任务所属核编号 , 来判断消息是核内消息还是核间 消息。 对于核内消息, 把消息映像直接添加到宿任务的消息映像队列; 对于 核间消息, 在把消息映像添加到宿任务所属内核的核间消息映像队列后, 向 宿任务所属内核触发核间中断。 图 6的消息发送过程中调度器在源任务所属 内核的执行部分的详细操作流程可以包括:  As shown in FIG. 6 , in this example, the scheduler is in the execution part of the kernel to which the source task belongs, where the scheduler compares the source task identifier recorded in the message control block with the input sink task identifier, and determines whether the message to be sent is a core message or Inter-core news. Specifically, the comparison is the core number of the task in the source task identifier and the core number of the task in the sink task identifier to determine whether the message is a nuclear message or an inter-core message. For intra-core messages, add the message image directly to the message image queue of the sink task; for inter-core messages, after adding the message image to the inter-core message image queue of the kernel to which the sink task belongs, trigger the inter-core interrupt to the kernel to which the sink task belongs. . The detailed operation flow of the scheduler in the execution part of the kernel to which the source task belongs in the message sending process of FIG. 6 may include:
步驟 601、 从内存池获取消息映像;  Step 601: Obtain a message image from a memory pool.
步骤 602、 在消息映像填充宿任务标识, 并使它指向消息控制块; 步骤 603、 判断是核内消息还是核间消息, 若是核内消息, 则执行步骤 604, 若是核间消息, 则执行步驟 605;  Step 602: Fill the sinking task identifier in the message image, and point it to the message control block. Step 603: Determine whether it is an intra-core message or an inter-core message. If it is an intra-core message, perform step 604. If it is an inter-core message, perform the step. 605;
步驟 604、 添加到宿任务的消息映像队列, 结束处理;  Step 604: Add a message image queue to the sink task, and end the processing;
步驟 605、 添加到宿任务所属内核的核间消息映像队列;  Step 605: Add an inter-core message image queue to the kernel to which the sink task belongs;
步驟 606、 触发核间中断, 结束处理。  Step 606: Trigger an inter-core interrupt, and end processing.
图 7所示为本例中调度器在宿任务所属内核的执行部分, 其中, 调度器 响应宿任务所属内核的核间中断, 从本内核的核间消息映像队列逐一取出消 息映像, 根据其中记录的宿任务标识, 将它们转移到相应宿任务的消息映像 队列。 图 7的消息发送程中调度器在宿任务所属内核的执行部分的详细操作 流程可以包括:  Figure 7 shows the execution part of the kernel to which the scheduler belongs in the present example. The scheduler responds to the inter-core interrupt of the kernel to which the sink task belongs, and extracts the message image one by one from the inter-core message image queue of the kernel. The sink task IDs are transferred to the message image queue of the corresponding sink task. The detailed operation flow of the scheduler in the execution part of the kernel to which the scheduler belongs in the message sending process of FIG. 7 may include:
步驟 701、 核间中断产生;  Step 701: Inter-core interruption is generated;
步骤 702、 从本内核的核间消息映像队列中摘取一个消息映像; 步驟 703、 将这个消息映像转移到宿任务的消息映像队列;  Step 702: Extract a message image from the inter-core message image queue of the kernel. Step 703: Transfer the message image to a message image queue of the sink task.
步驟 704、 判断本内核的核间消息映像队列是否为空, 若是, 则结束处 理, 否则转入步驟 702继续执行。  Step 704: Determine whether the inter-core message image queue of the kernel is empty, and if yes, end the processing, otherwise proceed to step 702 to continue.
一个实施例中, 若所述消息为同步消息, 则在将所述消息映像添加到宿 任务消息映像队列之后, 还可以包括: 将源任务置于阻塞状态, 待收到来自 宿任务的同步应答消息后继续运行源任务。 In an embodiment, if the message is a synchronization message, after adding the message image to the sink task message image queue, the method may further include: placing the source task in a blocking state, waiting to be received from The source task continues to run after the synchronization response message of the sink task.
同步消息发送过程也分为调度器在源任务所属内核的执行部分和调度器 在宿任务所属内核的执行部分。  The synchronization message sending process is also divided into the execution part of the kernel in which the scheduler belongs to the source task and the execution part of the kernel to which the scheduler belongs in the sink task.
如图 8所示, 一个实施例中, 同步消息发送过程中调度器在源任务所属 内核的执行部分的详细操作流程可以包括:  As shown in FIG. 8, in an embodiment, the detailed operation process of the scheduler in the execution part of the kernel to which the source task belongs during the synchronization message sending process may include:
步驟 801、 从内存池获取消息映像;  Step 801: Obtain a message image from a memory pool.
步骤 802、 在消息映像填充宿任务标识, 并使它指向消息控制块; 步驟 803、 判断是核内消息还是核间消息, 若是核内消息, 则执行步驟 804, 若是核间消息, 则执行步驟 805;  Step 802: Fill the sinking task identifier in the message image, and point it to the message control block. Step 803: Determine whether it is an intra-core message or an inter-core message. If it is an intra-core message, perform step 804. If it is an inter-core message, perform the step. 805;
步驟 804、 添加到宿任务的消息映像队列, 执行步驟 807;  Step 804, adding a message image queue to the sink task, performing step 807;
步驟 805、 添加到宿任务所属内核的核间消息映像队列;  Step 805: Add an inter-core message image queue to the kernel to which the sink task belongs;
步骤 806、 触发核间中断, 执行步骤 807;  Step 806, triggering an inter-core interrupt, performing step 807;
步骤 807、 将源任务置于阻塞状态, 结束处理。  Step 807: Put the source task into a blocking state, and end the processing.
如图 9所示, 一个实施例中, 同步消息发送过程中调度器在宿任务所属 内核的执行部分的详细操作流程可以包括:  As shown in FIG. 9, in an embodiment, the detailed operation process of the scheduler in the execution part of the kernel to which the sink task belongs during the synchronization message sending process may include:
步驟 901、 核间中断产生;  Step 901: Inter-core interruption is generated;
步驟 902、 从本内核的核间消息映像队列中摘取一个消息映像; 步骤 903、 将这个消息映像转移到宿任务的消息映像队列;  Step 902: Extract a message image from the inter-core message image queue of the kernel. Step 903: Transfer the message image to a message image queue of the sink task.
步驟 904、 判断本内核的核间消息映像队列是否为空, 若是, 则结束处 理, 否则转入步驟 902继续执行。  Step 904: Determine whether the inter-core message image queue of the kernel is empty. If yes, the process ends. Otherwise, go to step 902 to continue.
由图 8和图 9可以得知, 同步消息发送过程与普通消息发送过程的不同 之处在于: 调度器不仅把同步消息的消息映像添加到所述同步消息的宿任务 的消息映像队列, 还将所述同步消息的源任务置于阻塞状态, 使其在收到来 自所述同步消息的宿任务的同步应答消息后才能够继续运行。  It can be seen from FIG. 8 and FIG. 9 that the synchronization message sending process is different from the normal message sending process in that: the scheduler not only adds the message image of the synchronization message to the message image queue of the sink task of the synchronization message, but also The source task of the synchronization message is placed in a blocking state so that it can continue to run after receiving a synchronization response message from the sink task of the synchronization message.
一个实施例中, 若所述消息为同步应答消息, 则将所述消息映像添加到 所述同步应答消息的宿任务消息映像队列的队首, 并解除所述同步应答消息 的宿任务的阻塞状态。  In one embodiment, if the message is a synchronization response message, the message image is added to the head of the sink task message image queue of the synchronization response message, and the blocking status of the sink task of the synchronization response message is released. .
同步应答消息发送过程也分为调度器在源任务所属内核的执行部分和调 度器在宿任务所属内核的执行部分。 如图 10所示, 一个实施例中, 同步应答消息发送过程中调度器在源任务 所属内核的执行部分的详细操作流程可以包括: The synchronization response message transmission process is also divided into an execution part of the kernel to which the scheduler belongs and a execution part of the kernel to which the scheduler belongs in the sink task. As shown in FIG. 10, in an embodiment, the detailed operation procedure of the scheduler in the execution part of the kernel to which the source task belongs during the synchronization response message sending process may include:
步驟 1001、 从内存池获取消息映像;  Step 1001: Obtain a message image from a memory pool.
步驟 1002、 在消息映像填充宿任务标识, 并使它指向消息控制块; 步驟 1003、 设置同步应答标志;  Step 1002: pad the sink task identifier in the message image, and point it to the message control block; Step 1003, set a synchronization response flag;
步驟 1004、 判断是核内消息还是核间消息, 若是核内消息, 则执行步驟 1005, 若是核间消息, 则执行步骤 1007;  Step 1004: Determine whether it is an intra-core message or an inter-core message. If it is an intra-core message, go to step 1005. If it is an inter-core message, go to step 1007.
步驟 1005、 插入宿任务消息映像队列的队首;  Step 1005: Insert a team leader of the queue task message image queue;
步驟 1006、 解除宿任务的阻塞状态, 结束处理;  Step 1006: Dissolve the blocking state of the sink task, and end the processing;
步驟 1007、 添加到宿任务所属内核的核间消息映像队列;  Step 1007: Add an inter-core message image queue to the kernel to which the sink task belongs;
步驟 1008、 触发核间中断, 结束处理。  Step 1008: Trigger an inter-core interrupt and end processing.
如图 11所示, 一个实施例中, 同步应答消息发送过程中调度器在宿任务 所属内核的执行部分的详细操作流程可以包括:  As shown in FIG. 11, in an embodiment, the detailed operation procedure of the scheduler in the execution part of the core to which the sink task belongs during the synchronization response message sending process may include:
步驟 1101、 核间中断产生;  Step 1101: Inter-core interruption is generated;
步驟 1102、 从本内核的核间消息映像队列中摘取一个消息映像; 步驟 1103、将这个消息映像转移到宿任务的消息映像队列, 从队首位置 插入;  Step 1102: Extract a message image from the inter-core message image queue of the kernel; Step 1103: Transfer the message image to a message image queue of the sink task, and insert the message from the head position;
步骤 1104、 解除宿任务的阻塞状态;  Step 1104: Release the blocking state of the sink task.
步驟 1105、 判断核间消息映像队列是否为空, 若是, 则结束处理, 否则 转入步驟 1 102继续执行。  Step 1105: Determine whether the inter-core message image queue is empty, and if yes, end the process, otherwise proceed to step 1102 to continue.
由图 10和图 1 1可以得知, 同步应答消息发送过程与普通消息发送过程 的不同之处在于:  It can be seen from FIG. 10 and FIG. 1 that the synchronization reply message sending process is different from the normal message sending process in that:
在源任务所属内核的执行部分, 调度器在这个消息的消息映像中设置同 步应答标志, 在判断是核内消息后, 从队首位置插入宿任务的消息映像队列, 最后解除宿任务的阻塞状态;  In the execution part of the kernel to which the source task belongs, the scheduler sets a synchronization response flag in the message image of the message, and after determining that it is a nuclear message, inserts the message image queue of the sink task from the head position, and finally releases the blocking state of the sink task. ;
在判断是核间消息后, 在宿任务所属内核的执行部分, 调度器根据消息 映像中的同步应答标志, 把这个消息插入宿任务消息映像队列的队首, 同样 解除宿任务的阻塞状态。  After judging that it is an inter-core message, in the execution part of the kernel to which the sink task belongs, the scheduler inserts the message into the head of the sink task message image queue according to the synchronization response flag in the message image, and also cancels the blocking state of the sink task.
图 2中步骤 201、 202为消息接收过程, 具体实施时步骤 202可以包括: 反馈源任务标识、 消息类型、 消息名; 若所述消息为不携带数据緩冲区的信 号消息, 反馈消息数据; 或者, 若所述消息为携带数据緩冲区的緩冲区消息, 反馈数据緩冲区指针、 消息数据的位置和长度。 一个实施例中, 在步驟 202 之后, 还可以包括: 释放所述消息映像的内存资源。 Steps 201 and 202 in FIG. 2 are message receiving processes. In specific implementation, step 202 may include: Feedback source task identifier, message type, message name; if the message is a signal message that does not carry a data buffer, feedback message data; or, if the message is a buffer message carrying a data buffer, feedback data The buffer pointer, the location and length of the message data. In an embodiment, after step 202, the method further includes: releasing a memory resource of the message image.
如图 12所示, 一个实施例中, 消息接收过程的详细操作流程可以包括: 步驟 1201、 从本任务的消息映像队列中摘取一个消息映像;  As shown in FIG. 12, in an embodiment, the detailed operation process of the message receiving process may include: Step 1201: Extract a message image from a message image queue of the task;
步骤 1202、 得到消息控制块;  Step 1202: Obtain a message control block.
步驟 1203、 反馈消息句柄、 源任务标识、 消息类型、 消息名;  Step 1203, feedback message handle, source task identifier, message type, message name;
步驟 1204、 判断消息类型, 若为信号消息, 则执行步驟 1205, 若为緩 冲区消息, 则执行步驟 1206;  Step 1204, determining the message type, if it is a signal message, executing step 1205, if it is a buffer zone message, executing step 1206;
步驟 1205、 反馈消息数据, 执行步驟 1207;  Step 1205, feedback message data, performing step 1207;
步骤 1206、 反馈数据緩冲区指针、 消息数据的位置和长度, 执行步骤 1207;  Step 1206, the feedback data buffer pointer, the location and length of the message data, step 1207;
步驟 1207、 释放消息映像的内存资源, 结束处理。  Step 1207: Release the memory resource of the message image, and end the process.
一个实施例中, 在上述消息接收过程之后, 还可以包括消息释放过程, 具体实施时可以包括: 若所述消息为不携带数据緩冲区的信号消息, 所述消 息没有其他的宿任务, 则释放所述消息控制块的内存资源; 或者, 若所述消 息为携带数据緩冲区的緩冲区消息, 所述消息没有其他的宿任务, 则释放所 述消息控制块及数据緩冲区的内存资源。  In an embodiment, after the message receiving process, the message release process may further include: if the message is a signal message that does not carry a data buffer, and the message has no other sink task, Release the memory resource of the message control block; or, if the message is a buffer message carrying a data buffer, and the message has no other sink task, release the message control block and the data buffer Memory resources.
如图 13所示, 一个实施例中, 消息释放过程的详细操作流程可以包括: 步驟 1301、 判断消息是否还有其他的宿任务, 若是, 则结束处理, 否则 执行步驟 1302;  As shown in Figure 13, in an embodiment, the detailed operation process of the message release process may include: Step 1301: Determine whether the message has other sink tasks, and if so, end the process, otherwise perform step 1302;
步驟 1302、 判断消息类型, 若为信号消息, 则执行步驟 1303, 若为緩 冲区消息 , 则执行步骤 1304;  Step 1302, determining the message type, if it is a signal message, performing step 1303, if it is a buffer zone message, executing step 1304;
步驟 1303、 释放消息控制块的内存资源, 结束处理;  Step 1303: Release the memory resource of the message control block, and end processing;
步驟 1304、释放消息控制块的内存资源以及消息所携带数据緩冲区的内 存资源, 结束处理。 是可以通过程序来指令相关的硬件完成, 所述的程序可以存储于一计算机可 读取存储介质中, 该程序在执行时, 可以包括上述实施例方法中的全部或部 分步骤, 所述的存储介质可以包括: ROM、 RAM, 磁盘、 光盘等。 Step 1304: Release the memory resource of the message control block and the memory resource of the data buffer carried by the message, and end the process. It can be completed by a program to instruct related hardware, and the program can be stored in a computer. In the reading of the storage medium, the program may include all or part of the steps in the foregoing embodiment, and the storage medium may include: a ROM, a RAM, a magnetic disk, an optical disk, and the like.
本发明实施例中还提供了一种多核处理器消息调度器, 如下面的实施例 所述。 由于多核处理器消息调度器解决问题的原理与多核处理器消息调度方 法相似, 因此多核处理器消息调度器的实施可以参见多核处理器消息调度方 法的实施, 重复之处不再赘述。  A multi-core processor message scheduler is also provided in the embodiment of the present invention, as described in the following embodiments. Since the principle of solving the problem by the multi-core processor message scheduler is similar to that of the multi-core processor message scheduling method, the implementation of the multi-core processor message scheduler can be referred to the implementation of the multi-core processor message scheduling method, and the repetition will not be repeated.
如图 14所示, 本发明实施例中多核处理器消息调度器可以包括: 第一产生模块 1401 , 用于产生消息的消息控制块, 所述消息控制块记录 所述消息的描述信息及调度控制信息;  As shown in FIG. 14, the multi-core processor message scheduler in the embodiment of the present invention may include: a first generation module 1401, a message control block for generating a message, the message control block recording description information and scheduling control of the message Information
第二产生模块 1402, 用于产生所述消息的消息映像, 所述消息映像指向 所述消息控制块;  a second generating module 1402, configured to generate a message image of the message, where the message image points to the message control block;
添加模块 1403, 用于将所述消息映像添加到宿任务消息映像队列。 一个实施例中, 第一产生模块 1401可以包括:  Add module 1403, which is used to add the message image to the sink task message image queue. In an embodiment, the first generating module 1401 may include:
第一填充单元, 用于在所述消息控制块填充消息类型、 源任务标识、 消 息名;  a first padding unit, configured to fill a message type, a source task identifier, and a message name in the message control block;
第二填充单元, 用于在所述消息为不携带数据緩冲区的信号消息时, 在 所述消息控制块的消息体中填充消息数据; 或者, 在所述消息为携带数据緩 冲区的緩冲区消息时, 在所述消息控制块的消息体中填充数据緩冲区指针、 消息数据的位置和长度。 作为装置, 第二填充单元可以包括用于在所述消息 为不携带数据緩冲区的信号消息时 , 在所述消息控制块的消息体中填充消息 数据的实体和用于在所述消息为携带数据緩冲区的緩冲区消息时, 在所述消 息控制块的消息体中填充数据緩冲区指针、 消息数据的位置和长度的实体中 的任意一种或二者的组合。  a second filling unit, configured to fill message data in a message body of the message control block when the message is a signal message that does not carry a data buffer; or, in the message, a data buffer When the message is buffered, the data buffer pointer, the position and length of the message data are filled in the message body of the message control block. As a device, the second padding unit may include an entity for filling message data in a message body of the message control block when the message is a signal message not carrying a data buffer, and for the message being When a buffer message carrying a data buffer is carried, any one or a combination of the data buffer pointer, the location of the message data, and the length of the entity are filled in the message body of the message control block.
一个实施例中, 第二产生模块 1402可以包括:  In an embodiment, the second generating module 1402 can include:
第三填充单元, 用于将所述消息映像的消息控制块指针指向所述消息控 制块;  a third padding unit, configured to point a message control block pointer of the message image to the message control block;
第四填充单元, 用于在所述消息映像填充宿任务标识、 同步应答标志、 链表指针。  And a fourth filling unit, configured to populate the sink task identifier, the synchronization response flag, and the linked list pointer in the message image.
一个实施例中, 添加模块 1403还可以用于: 在所述消息为核内消息时, 直接将所述消息映像添加到宿任务消息映像 队列; 或者 In an embodiment, the adding module 1403 can also be used to: When the message is an intra-core message, the message image is directly added to the sink task message image queue; or
在所述消息为核间消息时, 将所述消息映像经宿任务所属内核的核间消 息映像队列中转至宿任务消息映像队列。  When the message is an inter-core message, the message image is transferred to the sink task message image queue via the inter-core message image queue of the kernel to which the sink task belongs.
作为装置, 添加模块 1403可以包括用于在所述消息为核内消息时, 直 接将所述消息映像添加到宿任务消息映像队列的实体和用于在所述消息为核 间消息时, 将所述消息映像经宿任务所属内核的核间消息映像队列中转至宿 任务消息映像队列的实体的任意一种或二者的组合。  As an apparatus, the adding module 1403 may include an entity for directly adding the message image to a sink task message image queue when the message is an intra-core message and for when the message is an inter-core message, Any one or a combination of two of the entities in the inter-core message image queue of the kernel to which the message is to be hosted to the task message image queue.
一个实施例中, 若所述消息为同步消息, 则图 14所示的多核处理器消息 调度器还可以包括:  In an embodiment, if the message is a synchronization message, the multi-core processor message scheduler shown in FIG. 14 may further include:
阻塞模块, 用于在所述添加模块将所述同步消息的消息映像添加到宿任 务消息映像队列之后, 将源任务置于阻塞状态, 待收到来自宿任务的同步应 答消息后继续运行源任务。  a blocking module, configured to: after the adding module adds the message image of the synchronization message to the sink task message image queue, placing the source task in a blocking state, and continuing to run the source task after receiving the synchronization response message from the sink task .
若所述消息为同步应答消息, 则所述添加模块 1403还可以用于将所述 同步应答消息的消息映像添加到宿任务消息映像队列的队首; 所述多核处理 器消息调度器还可以包括:  If the message is a synchronization response message, the adding module 1403 may be further configured to add a message image of the synchronization response message to a head of the sink task message image queue; the multi-core processor message scheduler may further include :
阻塞解除模块, 用于在所述添加模块将所述消息映像添加到宿任务消息 映像队列的队首之后, 解除宿任务的阻塞状态。  The blocking release module is configured to cancel the blocking state of the sink task after the adding module adds the message image to the head of the sink task message image queue.
如图 15所示, 本发明实施例中多核处理器消息调度器可以包括: 摘取模块 1501 , 用于从宿任务消息映像队列中摘取消息的消息映像; 反馈模块 1502, 用于根据所述消息映像指向的消息控制块, 向宿任务反 馈所述消息的描述信息及调度控制信息。  As shown in FIG. 15, the multi-core processor message scheduler in the embodiment of the present invention may include: an extracting module 1501, configured to extract a message image of a message from a sink task message image queue; and a feedback module 1502, configured to The message control block pointed to by the message image feeds back the description information and the scheduling control information of the message to the sink task.
一个实施例中, 反馈模块 1502可以包括:  In one embodiment, the feedback module 1502 can include:
第一反馈单元, 用于反馈源任务标识、 消息类型和消息名;  a first feedback unit, configured to feed back a source task identifier, a message type, and a message name;
第二反馈单元, 用于在所述消息为不携带数据緩冲区的信号消息时, 反 馈消息数据; 或者, 在所述消息为携带数据緩冲区的緩冲区消息时, 反馈数 据緩冲区指针、 消息数据的位置和长度。  a second feedback unit, configured to: when the message is a signal message that does not carry a data buffer, feed back the message data; or, when the message is a buffer message carrying a data buffer, the feedback data buffer The area pointer, the location and length of the message data.
一个实施例中, 图 15所示的多核处理器消息调度器还可以包括: 第一释放模块, 用于释放所述消息映像的内存资源; 第二释放模块 , 用于在所述消息为不携带数据緩冲区的信号消息且没有 其他的宿任务时, 释放所述消息控制块的内存资源; 或者, 在所述消息为携 带数据緩冲区的緩冲区消息且没有其他的宿任务时 , 释放所述消息控制块及 数据緩冲区的内存资源。 In an embodiment, the multi-core processor message scheduler shown in FIG. 15 may further include: a first release module, configured to release a memory resource of the message image; a second release module, configured to release a memory resource of the message control block when the message is a signal message that does not carry a data buffer, and if there is no other sink task; or, the message is a portable data buffer When the zone's buffer message and there are no other sink tasks, the memory resources of the message control block and the data buffer are released.
本发明实施例中, 构成消息队列的消息映像和对消息进行描述和控制的 消息控制块分离, 在发送消息时, 无需复制消息控制块和数据緩冲区, 而仅 需产生消息映像、 将消息映像添加到对应宿任务的消息映像队列; 在接收消 息时, 仅需从宿任务消息映像队列中摘取消息的消息映像, 根据消息映像指 向的消息控制块, 向宿任务反馈消息的描述信息及调度控制信息; 因而在消 息收发过程无需进行重复的数据拷贝操作, 即可实现消息的高速传输, 且无 需使用额外内存, 可以节省内存开销, 提高消息传递的效率。  In the embodiment of the present invention, the message image constituting the message queue is separated from the message control block for describing and controlling the message. When the message is sent, it is not necessary to copy the message control block and the data buffer, but only the message image and the message are generated. The image is added to the message image queue of the corresponding sink task; when receiving the message, only the message image of the message needs to be extracted from the sink task message image queue, and the description information of the message is fed back to the sink task according to the message control block pointed to by the message image and Scheduling control information; thus, in the messaging process, high-speed transmission of messages can be realized without repeated data copying operations, and no additional memory is needed, which can save memory overhead and improve message transmission efficiency.
本发明实施例的多核处理器消息调度方法、 调度器可实现各种场景下的 高速消息传递 , 大大降低消息调度功能的时间开销。  The multi-core processor message scheduling method and the scheduler in the embodiment of the invention can implement high-speed message delivery in various scenarios, and greatly reduce the time overhead of the message scheduling function.
一、 对于携带信息量较少的信号消息, 将消息数据复制进消息控制块进 行传递; 对于携带信息量较多的緩冲区消息, 通过消息控制块直接传递数据 緩冲区的指针以及消息数据在緩冲区的位置和长度。 因此, 无论在同一内核 任务间还是在不同内核任务间, 消息发送和接收过程都不存在大量的数据拷 贝, 实现高速传递。  1. For a signal message carrying less information, copy the message data into the message control block for transmission; for a buffer message carrying a large amount of information, directly passing the pointer of the data buffer and the message data through the message control block The position and length of the buffer. Therefore, no matter whether there are a large number of data copies in the message sending and receiving process between the same kernel task or between different kernel tasks, high-speed delivery is realized.
二、 构成消息队列的消息映像和对消息进行描述和控制的消息控制块分 离, 在消息广播的情况下, 仅把多个消息映像分别添加到对应宿任务的消息 映像队列, 而无需复制消息控制块和数据緩冲区, 从而实现高速消息广播。  Second, the message image that constitutes the message queue and the message control block that describes and controls the message are separated. In the case of message broadcast, only multiple message images are added to the message image queue of the corresponding sink task without copying the message control. Block and data buffers for high-speed message broadcast.
三、 在消息转发的情况下, 只需重新产生接收消息的消息映像, 也无需 复制消息控制块和数据緩冲区, 从而时间高速消息转发。  Third, in the case of message forwarding, it is only necessary to regenerate the message image of the received message, and it is not necessary to copy the message control block and the data buffer, thereby time-high-speed message forwarding.
本发明实施例的多核处理器消息调度方法、 调度器在上述各种场景下, 对于信息量较多的情况直接传递承载消息数据的緩冲区, 对于信息量较少的 情况用消息控制块传递消息数据, 都不使用额外内存。 因此也可以大大降低 消息调度功能的内存开销。  In the above various scenarios, the multi-core processor message scheduling method and the scheduler of the embodiment of the present invention directly transmit a buffer that carries message data for a case where there is a large amount of information, and transmits a message control block for a case where the amount of information is small. Message data, no extra memory is used. Therefore, the memory overhead of the message scheduling function can also be greatly reduced.
本发明实施例的多核处理器消息调度方法、 调度器无需设置消息携带的 最大数据量以及消息队列的长度限制, 可以支持变长消息和变长消息队列。 本发明实施例尤其适用于片内内存容量有限且对实时性有极高要求的多 核 DSP软件。 The multi-core processor message scheduling method and the scheduler of the embodiment of the present invention can support variable length messages and variable length message queues without setting the maximum amount of data carried by the message and the length limit of the message queue. The embodiments of the present invention are particularly applicable to multi-core DSP software with limited on-chip memory capacity and extremely high real-time requirements.
以上所述的具体实施例, 对本发明的目的、 技术方案和有益效果进行了 进一步详细说明, 所应理解的是, 以上所述仅为本发明的具体实施例而已, 并不用于限定本发明的保护范围, 凡在本发明的原则之内, 所做的任何修改、 等同替换、 改进等, 均应包含在本发明的保护范围之内。  The above described specific embodiments of the present invention are further described in detail, and are intended to be illustrative of the embodiments of the present invention. The scope of the protection, any modifications, equivalent substitutions, improvements, etc., which are within the scope of the invention, are intended to be included within the scope of the invention.

Claims

权 利 要 求 书 Claim
1、 一种多核处理器消息调度方法, 其特征在于, 该方法包括: 产生消息的消息控制块 , 所述消息控制块记录所述消息的描述信息及调 度控制信息;  A multi-core processor message scheduling method, the method comprising: generating a message control block of a message, wherein the message control block records description information and scheduling control information of the message;
产生所述消息的消息映像, 所述消息映像指向所述消息控制块; 将所述消息映像添加到所述消息对应的宿任务消息映像队列。  Generating a message image of the message, the message image pointing to the message control block; adding the message image to a sink task message image queue corresponding to the message.
2、 如权利要求 1所述的方法, 其特征在于, 所述消息控制块记录所述消 息的描述信息及调度控制信息, 包括:  2. The method according to claim 1, wherein the message control block records the description information and the scheduling control information of the message, including:
所述消息控制块填充有消息类型、 源任务标识和消息名;  The message control block is populated with a message type, a source task identifier, and a message name;
若所述消息为不携带数据緩冲区的信号消息, 所述消息控制块的消息体 中填充有消息数据, 或者,  If the message is a signal message that does not carry a data buffer, the message body of the message control block is filled with message data, or
若所述消息为携带数据緩冲区的緩冲区消息 , 所述消息控制块的消息体 中填充有数据緩沖区指针、 以及消息数据的位置和长度。  If the message is a buffer message carrying a data buffer, the message body of the message control block is filled with a data buffer pointer and the position and length of the message data.
3、如权利要求 1或 2所述的方法, 其特征在于, 所述消息映像指向所述消 息控制块, 包括:  The method of claim 1 or 2, wherein the message image points to the message control block, comprising:
所述消息映像的消息控制块指针指向所述消息控制块。  The message control block pointer of the message map points to the message control block.
4、如权利要求 1至 3中任一项所述的方法, 其特征在于, 所产生的所述消 息的消息映像填充有宿任务标识、 同步应答标志和链表指针。  The method according to any one of claims 1 to 3, characterized in that the generated message image of the message is filled with a sink task identifier, a synchronization response flag and a linked list pointer.
5、如权利要求 1至 4中任一项所述的方法, 其特征在于, 将所述消息映像 添加到所述消息对应的宿任务消息映像队列, 包括:  The method according to any one of claims 1 to 4, wherein the adding the message image to the sink task message image queue corresponding to the message comprises:
所述消息为核内消息时, 直接将所述消息映像添加到宿任务消息映像队 列; 或者  When the message is a nuclear message, the message image is directly added to the queue message message image queue; or
所述消息为核间消息时 , 将所述消息映像经宿任务所属内核的核间消息 映像队列中转至宿任务消息映像队列。  When the message is an inter-core message, the message image is transferred to the sink task message image queue via the inter-core message image queue of the kernel to which the sink task belongs.
6、 如权利要求 1至 5任一项所述的方法, 其特征在于,  6. A method according to any one of claims 1 to 5, characterized in that
若所述消息为同步消息, 则在将所述消息映像添加到所述同步消息对应 的宿任务消息映像队列之后, 还包括: 将所述同步消息对应的源任务置于阻 塞状态, 待收到来自所述同步消息对应的宿任务的同步应答消息后继续运行 源任务; 或者 若所述消息为同步应答消息 , 则将所述消息映像添加到所述同步应答消 息对应的宿任务消息映像队列的队首, 并解除所述同步应答消息对应的宿任 务的阻塞状态。 If the message is a synchronization message, after the message image is added to the sink task message image queue corresponding to the synchronization message, the method further includes: placing the source task corresponding to the synchronization message in a blocking state, to be received The source task is resumed after the synchronization response message from the sink task corresponding to the synchronization message; or If the message is a synchronization response message, the message image is added to the head of the sink task message image queue corresponding to the synchronization response message, and the blocking state of the sink task corresponding to the synchronization response message is released.
7、 如权利要求 1至 6任一项所述的方法, 其特征在于, 该方法还包括: 从所述消息对应的宿任务消息映像队列中摘取所述消息的消息映像; 根据所述消息映像指向的消息控制块, 向宿任务反馈所述消息的描述信 息及调度控制信息。  The method according to any one of claims 1 to 6, wherein the method further comprises: extracting a message image of the message from a sink task message image queue corresponding to the message; The message control block pointed to by the image feeds back the description information and the scheduling control information of the message to the sink task.
8、 如权利要求 7所述的方法, 其特征在于, 根据所述消息映像指向的消 息控制块, 向宿任务反馈所述消息的描述信息及调度控制信息, 包括:  The method according to claim 7, wherein the message description information and the scheduling control information are fed back to the sink task according to the message control block pointed to by the message image, including:
反馈源任务标识、 消息类型和消息名;  Feedback source task ID, message type, and message name;
若所述消息为不携带数据緩冲区的信号消息, 反馈消息数据, 或者, 若所述消息为携带数据緩冲区的緩冲区消息, 反馈数据緩冲区指针、 以 及消息数据的位置和长度。  If the message is a signal message that does not carry a data buffer, feedback message data, or if the message is a buffer message carrying a data buffer, feedback data buffer pointer, and location and location of the message data length.
9、 一种多核处理器消息调度方法, 其特征在于, 该方法包括: 从宿任务消息映像队列中摘取消息的消息映像;  A multi-core processor message scheduling method, the method comprising: extracting a message image of a message from a sink task message image queue;
根据所述消息映像指向的消息控制块 , 向宿任务反馈所述消息的描述信 息及调度控制信息。  And according to the message control block pointed to by the message image, the description information of the message and the scheduling control information are fed back to the sink task.
10、如权利要求 9所述的方法, 其特征在于, 根据所述消息映像指向的消 息控制块, 向宿任务反馈所述消息的描述信息及调度控制信息, 包括:  The method according to claim 9, wherein the message description information and the scheduling control information are fed back to the sink task according to the message control block pointed to by the message image, including:
反馈源任务标识、 消息类型和消息名;  Feedback source task ID, message type, and message name;
若所述消息为不携带数据緩冲区的信号消息, 反馈消息数据, 或者, 若所述消息为携带数据緩冲区的緩冲区消息, 反馈数据緩冲区指针、 以 及消息数据的位置和长度。  If the message is a signal message that does not carry a data buffer, feedback message data, or if the message is a buffer message carrying a data buffer, feedback data buffer pointer, and location and location of the message data length.
11、 如权利要求 9或 10所述的方法, 其特征在于, 还包括:  The method according to claim 9 or 10, further comprising:
释放所述消息映像的内存资源;  Freeing the memory resources of the message image;
若所述消息为不携带数据緩冲区的信号消息, 所述消息没有其他的宿任 务, 则释放所述消息控制块的内存资源, 或者,  If the message is a signal message that does not carry a data buffer, and the message has no other sink tasks, the memory resource of the message control block is released, or
若所述消息为携带数据緩冲区的緩冲区消息, 所述消息没有其他的宿任 务, 则释放所述消息控制块及数据緩冲区的内存资源。 If the message is a buffer message carrying a data buffer, and the message has no other sink tasks, the memory resources of the message control block and the data buffer are released.
12、 一种多核处理器消息调度器, 其特征在于, 包括: 12. A multi-core processor message scheduler, comprising:
第一产生模块, 用于产生消息的消息控制块, 所述消息控制块记录所述 消息的描述信息及调度控制信息;  a first generation module, a message control block for generating a message, where the message control block records description information and scheduling control information of the message;
第二产生模块, 用于产生所述消息的消息映像, 所述消息映像指向所述 消息控制块;  a second generating module, configured to generate a message image of the message, where the message image points to the message control block;
添加模块, 用于将所述消息映像添加到所述消息对应的宿任务消息映像 队列。  And adding a module, configured to add the message image to a sink task message image queue corresponding to the message.
13、 如权利要求 12所述的多核处理器消息调度器, 其特征在于, 所述第 一产生模块包括:  The multi-core processor message scheduler according to claim 12, wherein the first generation module comprises:
第一填充单元, 用于在所述消息控制块填充消息类型、 源任务标识和消 息名;  a first padding unit, configured to fill in a message type, a source task identifier, and a message name in the message control block;
第二填充单元, 用于在所述消息为不携带数据緩冲区的信号消息时, 在 所述消息控制块的消息体中填充消息数据, 或者, 用于在所述消息为携带数 据緩冲区的緩冲区消息时 , 在所述消息控制块的消息体中填充数据緩冲区指 针、 以及消息数据的位置和长度。  a second filling unit, configured to fill message data in a message body of the message control block when the message is a signal message that does not carry a data buffer, or to buffer the message in the message When the buffer message of the area is filled, the data buffer pointer and the position and length of the message data are filled in the message body of the message control block.
14、 如权利要求 12或 13所述的多核处理器消息调度器, 其特征在于, 所 述第二产生模块包括:  The multi-core processor message scheduler according to claim 12 or 13, wherein the second generation module comprises:
第三填充单元, 用于将所述消息映像的消息控制块指针指向所述消息控 制块;  a third padding unit, configured to point a message control block pointer of the message image to the message control block;
第四填充单元, 用于在所述消息映像填充宿任务标识、 同步应答标志和 链表指针。  And a fourth filling unit, configured to populate the sinking task identifier, the synchronization response flag, and the linked list pointer in the message image.
15、 如权利要求 12至 14任一项所述的多核处理器消息调度器, 其特征在 于, 所述添加模块进一步用于:  The multi-core processor message scheduler according to any one of claims 12 to 14, wherein the adding module is further configured to:
在所述消息为核内消息时, 直接将所述消息映像添加到所述消息对应的 宿任务消息映像队列; 或者  When the message is an intra-core message, the message image is directly added to the sink task message image queue corresponding to the message; or
在所述消息为核间消息时, 将所述消息映像经宿任务所属内核的核间消 息映像队列中转至所述消息对应的宿任务消息映像队列。  When the message is an inter-core message, the message image is transferred to the inter-core message image queue corresponding to the message by the inter-core message image queue of the kernel to which the sink task belongs.
16、 如权利要求 12至 15任一项所述的多核处理器消息调度器, 其特征在 于, 若所述消息为同步消息, 则所述多核处理器消息调度器还包括: 阻塞模块, 用于在所述添加模块将所述消息映像添加到所述同步消息对 应的宿任务消息映像队列之后 ,将所述同步消息对应的源任务置于阻塞状态 , 或者, 16. The multi-core processor message scheduler according to any one of claims 12 to 15, wherein: If the message is a synchronization message, the multi-core processor message scheduler further includes: a blocking module, configured to: after the adding module adds the message image to a sink task message image queue corresponding to the synchronization message, Putting the source task corresponding to the synchronization message into a blocking state, or
若所述消息为同步应答消息, 则所述添加模块进一步用于将所述消息映 像添加到所述同步应答消息对应的宿任务消息映像队列的队首 , 所述多核处 理器消息调度器还包括:  If the message is a synchronization response message, the adding module is further configured to add the message image to a head of a sink task message image queue corresponding to the synchronization response message, where the multi-core processor message scheduler further includes :
阻塞解除模块, 用于在所述添加模块将所述消息映像添加到所述同步应 答消息对应的宿任务消息映像队列的队首之后, 解除所述同步应答消息对应 的宿任务的阻塞状态。  The blocking release module is configured to release the blocking state of the sink task corresponding to the synchronization response message after the adding module adds the message image to the queue head of the sink task message image queue corresponding to the synchronization response message.
17、 如权利要求 12至 16任一项所述的多核处理器消息调度器, 其特征在 于, 还包括  The multi-core processor message scheduler according to any one of claims 12 to 16, further comprising
摘取模块, 用于从宿任务消息映像队列中摘取消息的消息映像; 反馈模块, 用于根据所述消息映像指向的消息控制块, 向宿任务反馈所 述消息的描述信息及调度控制信息。  An extracting module, configured to extract a message image of the message from the sink task message image queue; a feedback module, configured to feed back, according to the message control block pointed by the message image, the description information and the scheduling control information of the message to the sink task .
18、 如权利要求 17所述的多核处理器消息调度器, 其特征在于, 所述反 馈模块包括:  The multi-core processor message scheduler according to claim 17, wherein the feedback module comprises:
第一反馈单元, 用于反馈源任务标识、 消息类型和消息名;  a first feedback unit, configured to feed back a source task identifier, a message type, and a message name;
第二反馈单元, 用于在所述消息为不携带数据緩冲区的信号消息时, 反 馈消息数据, 或者, 在所述消息为携带数据緩冲区的緩冲区消息时, 反馈数 据緩冲区指针、 以及消息数据的位置和长度。  a second feedback unit, configured to: when the message is a signal message that does not carry a data buffer, feed back the message data, or when the message is a buffer message carrying a data buffer, the feedback data buffer The area pointer, as well as the location and length of the message data.
19、 一种多核处理器消息调度器, 其特征在于, 包括:  19. A multi-core processor message scheduler, comprising:
摘取模块, 用于从宿任务消息映像队列中摘取消息的消息映像; 反馈模块, 用于根据所述消息映像指向的消息控制块, 向宿任务反馈所 述消息的描述信息及调度控制信息。  An extracting module, configured to extract a message image of the message from the sink task message image queue; a feedback module, configured to feed back, according to the message control block pointed by the message image, the description information and the scheduling control information of the message to the sink task .
20、 如权利要求 19所述的多核处理器消息调度器, 其特征在于, 所述反 馈模块包括:  The multi-core processor message scheduler according to claim 19, wherein the feedback module comprises:
第一反馈单元, 用于反馈源任务标识、 消息类型和消息名; 第二反馈单元, 用于在所述消息为不携带数据緩冲区的信号消息时, 反 馈消息数据, 或者, 在所述消息为携带数据緩冲区的緩冲区消息时, 反馈数 据緩冲区指针、 以及消息数据的位置和长度。 a first feedback unit, configured to feed back a source task identifier, a message type, and a message name; a second feedback unit, configured to: when the message is a signal message that does not carry a data buffer, feed back the message data, or when the message is a buffer message carrying a data buffer, the feedback data buffer The area pointer, as well as the location and length of the message data.
21、 如权利要求 19或 20所述的多核处理器消息调度器, 其特征在于, 还 包括:  The multi-core processor message scheduler according to claim 19 or 20, further comprising:
第一释放模块, 用于释放所述消息映像的内存资源;  a first release module, configured to release a memory resource of the message image;
第二释放模块, 用于在所述消息为不携带数据緩冲区的信号消息且没有 其他的宿任务时, 释放所述消息控制块的内存资源, 或者, 在所述消息为携 带数据緩冲区的緩冲区消息且没有其他的宿任务时 , 释放所述消息控制块及 数据緩冲区的内存资源。  a second release module, configured to release a memory resource of the message control block when the message is a signal message that does not carry a data buffer, and if there is no other sink task, or When the zone's buffer message and there are no other sink tasks, the memory resources of the message control block and the data buffer are released.
PCT/CN2010/076335 2009-08-25 2010-08-25 Scheduling method and scheduler for multi-core processor messages WO2011023106A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN200910171233.7 2009-08-25
CN2009101712337A CN101634956B (en) 2009-08-25 2009-08-25 Dispatching method and dispatcher of information of polynuclear processor

Publications (1)

Publication Number Publication Date
WO2011023106A1 true WO2011023106A1 (en) 2011-03-03

Family

ID=41594153

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2010/076335 WO2011023106A1 (en) 2009-08-25 2010-08-25 Scheduling method and scheduler for multi-core processor messages

Country Status (2)

Country Link
CN (1) CN101634956B (en)
WO (1) WO2011023106A1 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101634956B (en) * 2009-08-25 2012-08-08 华为技术有限公司 Dispatching method and dispatcher of information of polynuclear processor
CN102255794B (en) * 2010-05-17 2014-07-30 塔塔咨询服务有限公司 Remote message transmit-receive handling capacity and waiting time shortening system and method
CN111177636B (en) * 2020-01-07 2023-11-03 北京同有飞骥科技股份有限公司 Recursive scheduling method and system for webpage request
CN112887196B (en) * 2021-01-20 2023-03-24 远景智能国际私人投资有限公司 Message sending method, system, device, equipment and readable storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5931915A (en) * 1997-05-13 1999-08-03 International Business Machines Corporation Method for processing early arrival messages within a multinode asynchronous data communications system
US20030135575A1 (en) * 2002-01-14 2003-07-17 Richard Marejka Self-monitoring and trending service system with cascaded pipeline linking numerous client systems
US20050155041A1 (en) * 2004-01-12 2005-07-14 International Business Machines Corporation Random access for processing messages in a message queue
CN101634956A (en) * 2009-08-25 2010-01-27 华为技术有限公司 Dispatching method and dispatcher of information of polynuclear processor

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1222882C (en) * 2002-12-05 2005-10-12 华为技术有限公司 Realization method for communication between tasks
CN1312577C (en) * 2003-05-07 2007-04-25 中兴通讯股份有限公司 Method for realizing communication process zero copy information queue
CN100458757C (en) * 2005-07-28 2009-02-04 大唐移动通信设备有限公司 Inter core communication method and apparatus for multi-core processor in embedded real-time operating system
CN101504617B (en) * 2009-03-23 2011-05-11 华为技术有限公司 Data transmitting method and device based on processor sharing internal memory

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5931915A (en) * 1997-05-13 1999-08-03 International Business Machines Corporation Method for processing early arrival messages within a multinode asynchronous data communications system
US20030135575A1 (en) * 2002-01-14 2003-07-17 Richard Marejka Self-monitoring and trending service system with cascaded pipeline linking numerous client systems
US20050155041A1 (en) * 2004-01-12 2005-07-14 International Business Machines Corporation Random access for processing messages in a message queue
CN101634956A (en) * 2009-08-25 2010-01-27 华为技术有限公司 Dispatching method and dispatcher of information of polynuclear processor

Also Published As

Publication number Publication date
CN101634956B (en) 2012-08-08
CN101634956A (en) 2010-01-27

Similar Documents

Publication Publication Date Title
US7549151B2 (en) Fast and memory protected asynchronous message scheme in a multi-process and multi-thread environment
CN101504617B (en) Data transmitting method and device based on processor sharing internal memory
EP0543512B1 (en) Multiprocessor system
US8112559B2 (en) Increasing available FIFO space to prevent messaging queue deadlocks in a DMA environment
JP2007079789A (en) Computer system and event processing method
KR20140069126A (en) System and method for providing and managing message queues for multinode applications in a middleware machine environment
TW201237632A (en) Buffer management scheme for a network processor
CN103200128A (en) Method, device and system for network package processing
JPH11175455A (en) Communication method in computer system and device therefor
CN104094235A (en) Multithreaded computing
CN112491426B (en) Service assembly communication architecture and task scheduling and data interaction method facing multi-core DSP
CN111404931B (en) Remote data transmission method based on persistent memory
WO2011023106A1 (en) Scheduling method and scheduler for multi-core processor messages
CN115543219B (en) Method, device, equipment and medium for optimizing host IO processing
JP2009123201A (en) Server-processor hybrid system for processing data
CN107025184A (en) A kind of data managing method and device
WO2021008257A1 (en) Coprocessor and data processing acceleration method therefor
CN101189579B (en) Method and device for using semaphores for multi-threaded processing
WO2021147877A1 (en) Data exchange system for statically distributed computing architecture, and method therefor
EP2899644A1 (en) Device and method for inter-core communication in multi-core processor
CN114064316A (en) Synchronization method and system for multi-path collected data
CN110955461A (en) Processing method, device and system of computing task, server and storage medium
CA2382728A1 (en) Efficient event waiting
CN109032818B (en) Method for synchronization and communication between cores of homogeneous system
CN113076189B (en) Data processing system with multiple data paths and virtual electronic device constructed using multiple data paths

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: 10811266

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 10811266

Country of ref document: EP

Kind code of ref document: A1