WO2023246042A1 - Scheduling method and apparatus, chip, electronic device, and storage medium - Google Patents

Scheduling method and apparatus, chip, electronic device, and storage medium Download PDF

Info

Publication number
WO2023246042A1
WO2023246042A1 PCT/CN2022/141062 CN2022141062W WO2023246042A1 WO 2023246042 A1 WO2023246042 A1 WO 2023246042A1 CN 2022141062 W CN2022141062 W CN 2022141062W WO 2023246042 A1 WO2023246042 A1 WO 2023246042A1
Authority
WO
WIPO (PCT)
Prior art keywords
message
interrupt
queue
processed
message queue
Prior art date
Application number
PCT/CN2022/141062
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 WO2023246042A1 publication Critical patent/WO2023246042A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4812Task transfer initiation or dispatching by interrupt, e.g. masked
    • G06F9/4825Interrupt from clock, e.g. time of day
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/548Queue
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the present application relates to the technical field of task scheduling, and in particular to a scheduling method, a scheduling device, a chip, an electronic device and a non-volatile computer-readable storage medium.
  • the operation processes of real-time operating systems based on software implementation and task scheduling include: operating system clock cycle maintenance, task polling, ready table operations, task scheduling and interrupt response.
  • the scheduling function based on hardware multi-threading is implemented in hardware. Due to the ability to generate independent instruction streams at the same time, compared with a real-time operating system based on software, the system reduces the number of ready table operations, task polling and tasks. Scheduled operations.
  • the embodiments of the present application provide a scheduling method, a scheduling device, a chip, an electronic device, and a non-volatile computer-readable storage medium.
  • This embodiment of the present application provides a scheduling method.
  • the scheduling method includes: when receiving a message to be processed, sending the message to be processed to the corresponding target service message queue, so that the interrupt controller generates an interrupt of the interrupt source corresponding to the target service message queue. Signal; determine the processing strategy of the message to be processed according to the first interrupt priority of the interrupt source corresponding to the interrupt signal and the second interrupt priority of the interrupt source corresponding to the current service message queue currently being processed.
  • the embodiment of the present application provides a scheduling device.
  • the scheduling device includes a sending module and a determining module.
  • the sending module is configured to, when receiving a message to be processed, send the message to be processed to the corresponding target service message queue, so that the interrupt controller generates an interrupt from the interrupt source corresponding to the target service message queue. signal;
  • the determination module is configured to determine the processing of the message to be processed based on the first interrupt priority of the interrupt source corresponding to the interrupt signal and the second interrupt priority of the interrupt source corresponding to the current service message queue currently being processed. Strategy.
  • An embodiment of the present application provides a chip, which is connected to an interrupt controller of an electronic device.
  • the chip When receiving a message to be processed, the chip is used to send the message to be processed to the corresponding target service message queue.
  • the interrupt controller generates an interrupt signal of an interrupt source corresponding to the target service message queue; and according to the first interrupt priority level of the interrupt source corresponding to the interrupt signal and the interrupt source corresponding to the current service message queue currently being processed
  • the second interrupt priority level determines the processing strategy of the message to be processed.
  • An embodiment of the present application provides an electronic device.
  • the electronic device includes a processor, and the processor is configured to, when receiving a message to be processed, send the message to be processed to a corresponding target service message queue, so that the interrupt controller generates a message corresponding to the target service message.
  • the interrupt signal of the interrupt source corresponding to the queue determine the message to be processed according to the first interrupt priority of the interrupt source corresponding to the interrupt signal and the second interrupt priority of the interrupt source corresponding to the current service message queue currently being processed. processing strategies.
  • Embodiments of the present application provide a non-volatile computer-readable storage medium on which a computer program is stored.
  • the computer program implements the scheduling method when executed by the processor.
  • the scheduling method includes: when receiving a message to be processed, sending the message to be processed to the corresponding target service message queue, so that the interrupt controller generates an interrupt of the interrupt source corresponding to the target service message queue. Signal; determine the processing strategy of the message to be processed according to the first interrupt priority of the interrupt source corresponding to the interrupt signal and the second interrupt priority of the interrupt source corresponding to the current service message queue currently being processed.
  • Figure 1 is a schematic flowchart of a scheduling method in some embodiments of the present application.
  • Figure 2 is a schematic flowchart of a scheduling method in some embodiments of the present application.
  • Figure 3 is a schematic flowchart of a scheduling method in some embodiments of the present application.
  • Figure 4 is a schematic flowchart of a scheduling method in some embodiments of the present application.
  • Figure 5 is a schematic diagram of the principle of a scheduling method in some embodiments of the present application.
  • Figure 6 is a schematic flowchart of a scheduling method in some embodiments of the present application.
  • Figure 7 is a schematic flowchart of a scheduling method in some embodiments of the present application.
  • Figure 8 is a schematic diagram of the principle of a scheduling method in some embodiments of the present application.
  • Figure 9 is a schematic module diagram of a scheduling device in some embodiments of the present application.
  • Figure 10 is a schematic plan view of an electronic device according to certain embodiments of the present application.
  • Figure 11 is a schematic diagram of the interaction between a non-volatile computer-readable storage medium and a processor in some embodiments of the present application.
  • the scheduling method of this application includes, when receiving a message to be processed, sending the message to be processed to the corresponding target service message queue, so that the interrupt controller generates an interrupt signal of the interrupt source corresponding to the target service message queue; according to the interrupt
  • the first interrupt priority level of the interrupt source corresponding to the signal and the second interrupt priority level of the interrupt source corresponding to the current service message queue currently processed determine the processing strategy of the message to be processed.
  • determining the processing strategy for the message to be processed according to the first interrupt priority of the interrupt source corresponding to the interrupt signal and the second interrupt priority of the interrupt source corresponding to the currently processed message includes: If the priority is greater than the second interrupt priority, suspend the messages in the current service message queue and process the messages in the target service message queue; if the first interrupt priority is less than or equal to the second interrupt priority, continue processing Messages currently serving the message queue.
  • determining the processing strategy for the message to be processed based on the first interrupt priority of the interrupt source corresponding to the interrupt signal and the second interrupt priority of the interrupt source corresponding to the current service message queue currently being processed also includes: The processing strategy for the message to be processed is determined based on the first interrupt priority, the second interrupt priority and whether the interrupt source corresponding to the current service message queue supports preemption.
  • the processing strategy for the message to be processed is determined based on the first interrupt priority, the second interrupt priority and whether the interrupt source corresponding to the current service message queue supports preemption, including: when the first interrupt priority is greater than the When the second interrupt priority is and the interrupt source corresponding to the current service message queue supports preemption, the messages in the current service message queue are suspended and the messages in the target service message queue are processed; when the first interrupt priority is less than or equal to the second interrupt priority level or the interrupt source corresponding to the current service message queue prohibits preemption, continue to process messages in the current service message queue.
  • suspending messages in the current service message queue includes: pushing the current service message queue onto the stack.
  • the method before sending the message to be processed to the target service message queue, the method further includes: obtaining the message descriptor corresponding to the message to be processed from the idle message queue; sending the message to be processed to the corresponding target service message queue. , including: sending the pending message with the message descriptor to the corresponding target service message queue.
  • the message to be processed includes description information and a message body.
  • the idle message queue includes a message descriptor queue and a message body queue.
  • Obtaining the message descriptor corresponding to the message to be processed from the idle message queue includes: from the message description
  • the descriptor queue obtains the address of the message descriptor to store the description information; when the content of the message body is not empty, the message body address is obtained from the message body queue to store the message body; the address of the message descriptor and the message body are encapsulated address to generate a message descriptor.
  • the scheduling method further includes initializing the address of each message descriptor in the message descriptor queue and the address of each message body in the message body queue.
  • the message descriptor includes a message identifier and a message body address
  • processing the message in the target service message queue includes: sending the message to be processed with the message descriptor to the corresponding message processing entity, so that the message processing entity Obtain the preset processing function corresponding to the message identifier and the message body corresponding to the message body address, and process the message body according to the preset processing function.
  • the scheduling method also includes receiving a message sent by the message processing entity to the destination service message queue when the message processing entity processes the message body according to the preset processing function, so that the interrupt controller generates a message related to the destination service message.
  • the interrupt signal of the interrupt source corresponding to the queue.
  • processing messages in the target service message queue also includes: when the messages to be processed are processed, releasing the messages to be processed with the message descriptors to the idle message queue.
  • the scheduling method also includes: when no pending message is received, sequentially sending the messages of the service message queue to the corresponding message processing according to the interrupt priority of the interrupt source corresponding to each service message queue. Processing is performed in the entity, and the message processing entity corresponds to at least one service message queue.
  • the scheduling device of this application includes a sending module and a determining module.
  • the sending module is used to send the to-be-processed message to the corresponding target service message queue when receiving the message to be processed, so that the interrupt controller generates an interrupt signal of the interrupt source corresponding to the target service message queue;
  • the determining module is used to The processing strategy of the message to be processed is determined according to the first interrupt priority level of the interrupt source corresponding to the interrupt signal and the second interrupt priority level of the interrupt source corresponding to the current service message queue currently being processed.
  • the chip of this application is connected to the interrupt controller of the electronic device.
  • the chip When receiving a message to be processed, the chip is used to send the message to be processed to the corresponding target service message queue, so that the interrupt controller generates a message that is in contact with the target service message queue.
  • the interrupt signal of the corresponding interrupt source and determining the processing strategy of the message to be processed according to the first interrupt priority of the interrupt source corresponding to the interrupt signal and the second interrupt priority of the interrupt source corresponding to the current service message queue currently being processed.
  • the electronic device of the present application includes a processor.
  • the processor When receiving a message to be processed, the processor is configured to send the message to be processed to the corresponding target service message queue, so that the interrupt controller generates an interrupt source corresponding to the target service message queue.
  • the interrupt signal determine the processing strategy of the message to be processed according to the first interrupt priority of the interrupt source corresponding to the interrupt signal and the second interrupt priority of the interrupt source corresponding to the current service message queue currently being processed.
  • the processor is also configured to suspend messages in the current service message queue and process messages in the target service message queue when the first interrupt priority is greater than the second interrupt priority; If the priority is less than or equal to the second interrupt priority, continue processing the messages in the current service message queue.
  • the processor is also configured to determine a processing strategy for the message to be processed based on the first interrupt priority, the second interrupt priority, and whether the interrupt source corresponding to the current service message queue supports preemption.
  • the processor is also configured to suspend messages in the current service message queue and process them when the first interrupt priority is greater than the second interrupt priority and the interrupt source corresponding to the current service message queue supports preemption. Messages in the target service message queue; when the first interrupt priority is less than or equal to the second interrupt priority or the interrupt source corresponding to the current service message queue prohibits preemption, continue processing the messages in the current service message queue.
  • the processor is also configured to push the current service message queue onto the stack.
  • the processor before sending the message to be processed to the target service message queue, is also configured to obtain the message descriptor corresponding to the message to be processed from the idle message queue; Sent to the corresponding target service message queue.
  • the message to be processed includes description information and a message body.
  • the idle message queue includes a message descriptor queue and a message body queue.
  • the processor is also configured to obtain the address of the message descriptor from the message descriptor queue to store the description. Information; when the content of the message body is not empty, obtain the message body address from the message body queue to store the message body; encapsulate the address of the message descriptor and the message body address to generate a message descriptor.
  • the processor is further configured to initialize the address of each message descriptor in the message descriptor queue and the address of each message body in the message body queue.
  • the message descriptor includes a message identifier and a message body address
  • the processor is also configured to send the message to be processed with the message descriptor to the corresponding message processing entity, so that the message processing entity obtains the message corresponding to the message identifier.
  • Default processing function and message body corresponding to the message body address and process the message body according to the default processing function.
  • the processor is also configured to receive the message sent by the message processing entity to the destination service message queue when the message processing entity processes the message body according to the preset processing function, so that the interrupt controller generates a message related to the destination service.
  • the interrupt signal of the interrupt source corresponding to the message queue.
  • the processor is also configured to release the pending message with the message descriptor to the idle message queue when the pending message is processed.
  • the processor is also configured to sequentially send messages from the service message queue to the corresponding message processor according to the interrupt priority of the interrupt source corresponding to each service message queue when no pending message is received. Processing is performed in the entity, and the message processing entity corresponds to at least one service message queue.
  • the non-volatile computer-readable storage medium of the present application includes a computer program.
  • the computer program is executed by one or more processors, the scheduling method of any of the above embodiments is implemented.
  • a message is a piece of business logic. By processing the message, specific operations of the system can be completed.
  • the message includes description information and a message body.
  • the description information is used to parse and process the message, and the message body contains the actual content of the message.
  • the control process in a complex system consists of a set of tasks, and the running of the tasks is completed through the processor and task scheduler.
  • the system can be a complex communication system, industrial control system or automobile central control system.
  • the control process includes the execution of tasks with different functions. These tasks are responsible for processing messages related to the transaction operation of the system. That is, the processing of each task represents the processing of one or more messages related to the task. deal with.
  • Service message queue corresponds to the system's tasks. For example, one service message queue corresponds to one task.
  • the service message queue is used to store messages and is completed by sending messages from the service message queue to the corresponding message processing entity for processing in turn. Task.
  • Message processing entity An object used to process messages in a processor.
  • a processor can have one or more message processing entities, and multiple message processing entities can process multiple messages at the same time.
  • Interrupt controller After the message is sent to the service message queue, it can trigger the interrupt signal of the interrupt source corresponding to the service message queue and route the interrupt signal to the corresponding processor. The processor will prioritize the interrupt of the interrupt source corresponding to the interrupt signal. level, determine whether to interrupt the currently processed service message queue to process the service message queue corresponding to the interrupt signal.
  • Interrupt priority In order for the system to respond to and handle all interrupts that occur in a timely manner, the system divides interrupt sources into several levels based on the importance and urgency of the event causing the interrupt, called interrupt priority.
  • Step 011 When receiving a message to be processed, send the message to be processed to the corresponding target service message queue, so that the target service message queue generates an interrupt signal from the corresponding interrupt source in the interrupt controller.
  • each task will be performed.
  • the system will continuously send messages and complete specific tasks by processing each message.
  • the pending message will first be sent to the target service message queue corresponding to the task to which it belongs. It can be understood that each message has a corresponding target service message queue according to the task to which it belongs. .
  • the corresponding interrupt source of the target service message queue in the interrupt controller After the message to be processed is sent to the target service message queue, the corresponding interrupt source of the target service message queue in the interrupt controller generates an interrupt signal, that is, there is a corresponding relationship between the service message queue and the interrupt source, and each service message queue can correspond to At least one interrupt source, that is, multiple messages in the service message queue can serve different interrupt sources respectively, and the service message queue is bound and associated with the interrupt source.
  • the priority of the service message queue is determined based on the interrupt priority of the interrupt source bound to the service message queue. It can be understood that the interrupt priority of one or more interrupt sources bound to the service message queue is the same to ensure that one When serving the message queue, it can be processed sequentially according to the queue order to prevent the same service message queue from having messages corresponding to interrupt sources with different interrupt priorities, thereby avoiding the situation where messages with low interrupt priority are processed preferentially.
  • the interrupt source corresponding to the message among the multiple interrupt sources bound to the target service message queue can be triggered to generate an interrupt signal; or, because at least one interrupt source corresponding to the service message queue
  • the interrupt priorities are the same, and this application schedules tasks based on the interrupt priority. Therefore, after the pending message is sent to the target service message queue, it only needs to trigger multiple interrupt sources bound to the target service message queue.
  • Task scheduling can be realized by generating an interrupt signal from any interrupt source. For example, by operating the interrupt pending status register corresponding to the interrupt source in the interrupt controller, the corresponding interrupt signal is directly triggered and generated without relying on external interrupt signal triggering.
  • Step 012 Determine the processing strategy for the message to be processed based on the first interrupt priority of the interrupt source corresponding to the interrupt signal and the second interrupt priority of the interrupt source corresponding to the current service message queue currently being processed.
  • step 012 may include:
  • Step 0121 When the first interrupt priority is greater than the second interrupt priority, suspend the messages in the current service message queue and process the messages in the target service message queue;
  • Step 0122 If the first interrupt priority is less than or equal to the second interrupt priority, continue processing the messages of the current service message queue.
  • the size of the first interrupt priority corresponding to the message to be processed and the second interrupt priority corresponding to the current service message queue can be determined.
  • the first interrupt priority is greater than In the case of the second interrupt priority, it means that the pending message needs to be processed first. Therefore, the current service message queue can be suspended at this time, and then the target service message queue where the pending message is located can be processed.
  • suspending the current service message queue refers to pausing the processing of the current service message queue and saving the context information of the current service message queue, so as to facilitate the resumption of the processing of the current service message queue after the target service message queue is processed.
  • Saving the context information of the current service message queue can be achieved by pushing the register of the current service message queue onto the stack, that is, pushing the relevant context information of the processor that processes the current service message queue onto the stack. Since this application uses existing hardware, The scheduler function designed and implemented based on interrupt controller technology eliminates the software's management of task context. Therefore, compared with traditional software-based real-time operating system schedulers, both task scheduling overhead and interrupt response latency are reduced. few. Please refer to Table 1. When pushing the stack in this application, only the processor register is pushed onto the stack, and there is no need to push the entire operating system context onto the stack. This reduces the overhead of stack pushing.
  • Interrupt signal reaches processor 3 clock cycles
  • Processor gets first instruction 8cycles
  • Processor register push 15cycles
  • Operating system context push 40cycles
  • the processor when there are multiple pending messages in the service message queue at the same time, the processor will not linearly accumulate hardware overhead.
  • the hardware overhead generated by the service message queue for interrupt events is one-time, that is, the service message
  • the messages to be processed in the queue are pushed or popped out of the stack at one time until all messages in the service message queue are processed and exited.
  • the first interrupt priority is less than or equal to the second interrupt priority, it means that the pending message does not need to be processed first, so it is necessary to wait for the message processing of the current service message queue to be completed before the pending message can be processed. At this time, let the messages to be processed wait in the target service message queue and continue to process the messages in the current service message queue, thereby realizing task scheduling through the interrupt priority corresponding to the service message queue.
  • step 012 may include:
  • Step 0123 Determine the processing strategy for the message to be processed based on the first interrupt priority, the second interrupt priority and whether the interrupt source corresponding to the current service message queue supports preemption.
  • each interrupt source has the following attributes:
  • Interrupt priority target processor Whether to support preemption Destination service message queue Destination message processing entity
  • the interrupt priority is used to indicate the priority of the interrupt source when interrupting.
  • the target processor indicates that the message corresponding to the interrupt source should be processed by the corresponding processor of the electronic device. Whether preemption is supported indicates the service message corresponding to the interrupt source.
  • the destination service message queue represents the identification information of the service message queue bound to the interrupt source.
  • Each service message queue has unique identification information
  • the destination message processing entity is Represents the identification information of the message processing entity used to process the service message queue corresponding to the interrupt source.
  • the message processing entity also has unique identification information.
  • the interrupt source corresponding to the current service message queue (or specifically the message currently being processed) supports preemption. If it supports preemption, In the case of , it is judged whether the first interrupt priority is greater than the second interrupt priority, so that if the first interrupt priority is greater than the second interrupt priority, the messages in the current service message queue are suspended and the target service message queue is processed. message; and when the first interrupt priority is less than or equal to the second interrupt priority or the interrupt source corresponding to the current service message queue (or specifically the message currently being processed) prohibits preemption, continue to process the current service message queue. information.
  • the high-priority service message queue (that is, the interrupt source bound to the service message queue has a higher interrupt priority) will be prohibited from preempting the service message queue currently being processed, thus To protect the consistency of resources in the system.
  • the scheduling method before sending the pending message to the target service message queue, the scheduling method also includes:
  • Step 010 Obtain the message descriptor corresponding to the message to be processed from the idle message queue.
  • the message descriptor includes the message identifier and the message body address;
  • Step 011 Send the pending message to the corresponding target service message queue, including:
  • Step 0111 Send the pending message with the message descriptor to the corresponding target service message queue.
  • the messages distributed by the system require message application to allocate corresponding resources (such as memory, etc.) for the specific information of the message.
  • the message application process mainly involves applying for the message descriptor and message body of the message.
  • the message descriptor contains description information used to describe the overall information of the message. The description information is used to correctly parse and process the message.
  • the message body is used to store the actual content of the message, which can include specific data content passed between tasks in the control system.
  • an idle message queue is designed specifically for storing message descriptors and message bodies.
  • the idle message queue may include a message descriptor queue and a message body queue.
  • the message descriptor queue is used to store message descriptors (message descriptor N in Figure 5 (N is an integer and greater than 3 )), the message body queue is used to store the message body (message body M in Figure 5 (M is an integer and greater than 3)).
  • message descriptor N corresponds to descriptor address N.
  • the content of the message body of the message can be empty. In this case, there is no need to apply for the message body.
  • the message descriptor can be obtained by directly encapsulating the address of the message descriptor, thereby sending the pending message with the message descriptor to the corresponding target.
  • the service message queue can be processed.
  • the process of applying for the message body is the process of storing the specific data content of the message into the memory address corresponding to the message body.
  • message body M corresponds to message body address M.
  • the address of the message descriptor and the message body address can be encapsulated to obtain the message descriptor, so that the pending message with the message descriptor can be sent to the corresponding target service.
  • Message queue to facilitate the processing of pending messages by message processing entities.
  • the information in the message descriptor can facilitate the message processing entity to parse and process the message.
  • the message identifier is used by the message processing entity to find the processing function that processes the specific data content in the message body address.
  • the message size and type are The basic information of the message, the message source address and the message destination address can point to different service message queues respectively, thereby realizing communication between different service message queues.
  • the address information of the message body in the memory (i.e., the message body address in Table 3) will be maintained in the message descriptor, thereby flexibly supporting the copying and sending of the message body in the system.
  • the system can apply for multiple message descriptors.
  • the multiple message descriptors may only have different message destination addresses.
  • the body address is the same, thereby reducing the performance degradation caused by sending the same message content multiple times in a real-time system and needing to copy the specific data content of the message body multiple times.
  • the idle message queue in this application can initialize the address of each message descriptor in the message descriptor queue and the address of each message body in the message body queue after the system is started. That is to say, the address and message body address of each message descriptor in the message descriptor are allocated resources in advance, so there is no need to allocate memory resources every time a message is requested, which is beneficial to improving The efficiency of message application, thereby improving the efficiency of message sending.
  • the idle message queue of this application is stored in the first queue register of the electronic device, and the service message queue is stored in the second queue register.
  • the service message queue is stored in the second queue register.
  • step 0121 Process messages in the target service message queue, including:
  • Step 01211 Send the message to be processed with the message descriptor to the corresponding message processing entity, so that the message processing entity obtains the preset processing function corresponding to the message identifier and the message content corresponding to the message body address, and processes it according to the preset processing function Message content.
  • the interrupt controller After sending the pending message with the message descriptor to the target service message queue, the interrupt controller generates an interrupt signal of the interrupt source corresponding to the target service message queue, and at the interrupt source corresponding to the interrupt signal
  • the first interrupt priority is greater than the second interrupt priority of the interrupt source corresponding to the current service message queue currently being processed, the messages in the current service message queue can be suspended and the messages in the target service message queue can be processed.
  • the message processing entity first obtains the message identifier in the message descriptor according to the address of the message descriptor, thereby obtaining the preset processing function bound to the message identifier, and then obtains the message body address in the message descriptor. , and obtain the specific data content of the message body, and finally process the specific data content according to the preset processing function, thereby completing the processing of the message to be processed.
  • the message descriptor can contain the message source address and the message destination address to respectively represent the source service message queue for sending the message and the destination service message queue for receiving the message, thereby realizing communication between different service message queues. Therefore, when the message processing entity processes the message body according to the preset processing function, if it needs to communicate with the destination service message queue, the message processing entity sends a message to the destination service message queue, so that the interrupt controller generates a message related to the destination service message.
  • the interrupt signal of the interrupt source corresponding to the queue is used to process the interrupt and realize communication between service message queues.
  • tasks corresponding to different service message queues are not isolated.
  • the execution of one task may require other tasks to be executed first. For example, when processing message 1 of the current service message queue (i.e., the source service message queue), additional tasks are required.
  • a destination service message queue processes message 2 first. Therefore, the current service message queue can apply for message 2 and send it to the destination service message queue to trigger an interrupt to process message 2 first. After completing the processing of message 2, exit the interrupt again. Process message 1.
  • step 0121 Process messages in the target service message queue, including:
  • Step 01212 After the pending message is processed, release the pending message with the message descriptor to the idle message queue.
  • the message descriptor of the message to be processed should no longer occupy system resources.
  • the message descriptor of the message to be processed needs to be released from the target service message queue to the idle message queue again. , releasing the message descriptor of the pending message to the idle message queue.
  • the information stored in the descriptor address in the message descriptor and the information stored in the message body address are deleted to free up memory space, and the message is The descriptor is pushed to the idle message queue again, for example, the address of the message descriptor is pushed to the end of the message descriptor queue, and the message body address is pushed to the end of the message body queue. In this way, the idle message queue can realize the message application, distribution and recycling.
  • messages in the service message queue are sent to the corresponding message processing entity for processing in sequence.
  • the message processing entity Corresponds to at least one service message queue.
  • the number of message processing entities in the processor is limited, and the number of service message queues can be determined according to the interrupt priority setting of the system.
  • the number of service message queues is generally much larger than the number of message processing entities.
  • service message queues 1-Z are arranged according to interrupt priority from low to high.
  • Service message queues 1 and 2 correspond to message processing entities.
  • Service message queues 3 to Z (Z is an integer and greater than 3) correspond to service message entity 2.
  • the message processing entity 1 processing service message queues 1 and 2 as an example. If no pending messages are received, the messages in service message queues 2 and 1 will be sent to the corresponding message processing in order from high to low according to the interrupt priority. Processing is performed in entity 1, so that message processing entity 1 first processes messages in service message queue 2, and then processes messages in service message queue 1. After receiving a message to be processed and triggering an interrupt, it will be determined whether the interrupt priority of the target service message queue corresponding to the message to be processed is greater than the interrupt priority of the current service message queue currently being processed. For example, the current service message queue is service message queue 1, and the target service message queue is service message queue 2. Since the interrupt priority of service message queue 2 is greater than the interrupt priority of service message queue 1, message processing entity 1 will hang. Service message queue 1, thereby processing the target service message queue.
  • the scheduling method of the embodiment of the present application realizes task scheduling by using the system's own interrupt controller, which greatly reduces the system cost. While consuming software and hardware overhead, it simplifies system design and improves system reliability.
  • the scheduler design in this application can support priority preemption and communication between service message queues; priority preemption is prohibited to achieve resource consistency protection; and can realize scheduling functions such as application, allocation and release of message resources, and at the same time Since the messages to be processed in the service message queue of this application are pushed or popped out of the stack at one time, the proportion of system runtime overhead will decrease as the frequency of message interaction between internal control tasks in the system increases.
  • the embodiment of the present application also provides a scheduling device 10.
  • the scheduling device 10 may include:
  • the sending module 11 is configured to, when receiving a message to be processed, send the message to be processed to the corresponding target service message queue, so that the target service message queue generates an interrupt signal at the corresponding interrupt source in the interrupt controller;
  • the determination module 12 is configured to determine the processing strategy of the message to be processed based on the first interrupt priority of the interrupt source corresponding to the interrupt signal and the second interrupt priority of the interrupt source corresponding to the current service message queue currently being processed.
  • Determine module 12 is specifically used for:
  • Determining module 12 is also specifically used for:
  • the processing strategy for the messages to be processed is determined based on the first interrupt priority, the second interrupt priority and whether the interrupt source corresponding to the current service message queue supports preemption.
  • Determining module 12 is also specifically used for:
  • the determination module 12 is also used to push the current service message queue onto the stack.
  • the scheduling device 10 also includes:
  • the acquisition module 13 is used to obtain the message descriptor corresponding to the message to be processed from the idle message queue;
  • the sending module 11 is specifically configured to send the pending message with the message descriptor to the corresponding target service message queue.
  • Obtain module 13 is specifically used for:
  • the scheduling device 10 also includes:
  • the initialization module 14 is used to initialize the address of each message descriptor in the message descriptor queue and the address of each message body in the message body queue.
  • Determining module 12 is also specifically used for:
  • the scheduling device 10 also includes:
  • the receiving module 15 is configured to receive the message sent by the message processing entity to the destination service message queue when the message processing entity processes the message body according to the preset processing function, so that the interrupt controller generates an interrupt source corresponding to the destination service message queue. interrupt signal.
  • the scheduling device 10 also includes:
  • the release module 16 is used to release the pending message with the message descriptor to the idle message queue when the pending message is processed.
  • the scheduling device 10 also includes:
  • the processing module 17 is configured to sequentially send messages from the service message queue to the corresponding message processing entity for processing according to the interrupt priority of the interrupt source corresponding to each service message queue when no message to be processed is received.
  • the processing entity corresponds to at least one service message queue.
  • Each module in the above-mentioned scheduling device 10 can be implemented in whole or in part by software, hardware, and combinations thereof.
  • Each of the above modules may be embedded in or independent of the processor of the computer device in the form of hardware, or may be stored in the memory of the computer device in the form of software so that the processor can call and execute operations corresponding to the above modules.
  • the chip 40 according to the embodiment of the present application is disposed in the electronic device 100 and connected to the interrupt controller 50 of the electronic device 100 .
  • the chip 40 is used to execute the scheduling method in any of the above embodiments. For the sake of simplicity, details will not be described again here.
  • the electronic device 100 includes a processor 30 .
  • the processor 30 is configured to execute the scheduling method in any of the above embodiments. For the sake of simplicity, details will not be described again here.
  • the electronic device 100 may be a mobile phone, a smart phone, a personal digital assistant (PDA), a tablet computer and a video game device, a portable terminal (such as a notebook computer), or a larger-sized device (such as a desktop computer and a computer). television).
  • PDA personal digital assistant
  • a tablet computer and a video game device
  • portable terminal such as a notebook computer
  • a larger-sized device such as a desktop computer and a computer. television.
  • the embodiment of the present application also provides a computer-readable storage medium 300 on which a computer program 310 is stored.
  • a computer program 310 is stored on which a computer program 310 is stored.
  • the scheduling of any of the above embodiments is implemented.
  • the steps of the method will not be repeated here.
  • Computer program 310 includes computer program code.
  • Computer program code can be in the form of source code, object code, executable file or some intermediate form, etc.
  • Computer-readable storage media can include: any entity or device that can carry computer program code, recording media, USB flash drives, mobile hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM, Read-Only Memory), random access memory Access memory (RAM, Random Access Memory), and software distribution media, etc.

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)

Abstract

A scheduling method, a scheduling apparatus (10), a chip (40), an electronic device (100), and a non-volatile computer-readable storage medium (300). The method comprises: (011) when a message to be processed is received, sending said message to a corresponding target service message queue, so as to enable an interrupt controller to generate a corresponding interrupt signal; and (012) determining a processing policy for said message according to a first interrupt priority corresponding to the interrupt signal and a second interrupt priority corresponding to the current service message queue.

Description

调度方法及装置、芯片、电子设备及存储介质Scheduling methods and devices, chips, electronic equipment and storage media
优先权信息priority information
本申请请求2022年6月23日向中国国家知识产权局提交的、专利申请号为2022107244904的专利申请的优先权和权益,并且通过参照将其全文并入此处。This application requests the priority and rights of the patent application with patent application number 2022107244904, which was submitted to the State Intellectual Property Office of China on June 23, 2022, and the full text of which is incorporated herein by reference.
技术领域Technical field
本申请涉及任务调度技术领域,特别涉及一种调度方法、调度装置、芯片、电子设备及非易失性计算机可读存储介质。The present application relates to the technical field of task scheduling, and in particular to a scheduling method, a scheduling device, a chip, an electronic device and a non-volatile computer-readable storage medium.
背景技术Background technique
基于软件实现的实时操作***与任务调度相关的操作过程包括:操作***时钟周期维护,任务轮询,就绪表操作,任务调度和中断响应。基于硬件多线程的调度功能是在硬件中实现的,由于具备同时生成相互独立的指令流的能力,相比于基于软件实现的实时操作***,***中减少了就绪表操作,任务轮询和任务调度的操作。The operation processes of real-time operating systems based on software implementation and task scheduling include: operating system clock cycle maintenance, task polling, ready table operations, task scheduling and interrupt response. The scheduling function based on hardware multi-threading is implemented in hardware. Due to the ability to generate independent instruction streams at the same time, compared with a real-time operating system based on software, the system reduces the number of ready table operations, task polling and tasks. Scheduled operations.
发明内容Contents of the invention
本申请实施方式提供了一种调度方法、调度装置、芯片、电子设备及非易失性计算机可读存储介质。The embodiments of the present application provide a scheduling method, a scheduling device, a chip, an electronic device, and a non-volatile computer-readable storage medium.
本申请实施例提供一种调度方法。所述调度方法包括:在接收到待处理消息的情况下,将所述待处理消息发送到对应的目标服务消息队列,以使得中断控制器产生与所述目标服务消息队列对应的中断源的中断信号;根据所述中断信号对应的中断源的第一中断优先级和当前处理的当前服务消息队列对应的中断源的第二中断优先级,确定所述待处理消息的处理策略。This embodiment of the present application provides a scheduling method. The scheduling method includes: when receiving a message to be processed, sending the message to be processed to the corresponding target service message queue, so that the interrupt controller generates an interrupt of the interrupt source corresponding to the target service message queue. Signal; determine the processing strategy of the message to be processed according to the first interrupt priority of the interrupt source corresponding to the interrupt signal and the second interrupt priority of the interrupt source corresponding to the current service message queue currently being processed.
本申请实施方式提供一种调度装置。所述调度装置包括发送模块和确定模块。所述发送模块用于在接收到待处理消息的情况下,将所述待处理消息发送到对应的目标服务消息队列,以使得中断控制器产生与所述目标服务消息队列对应的中断源的中断信号;所述确定模块用于根据所述中断信号对应的中断源的第一中断优先级和当前处理的当前服务消息队列对应的中断源的第二中断优先级,确定所述待处理消息的处理策略。The embodiment of the present application provides a scheduling device. The scheduling device includes a sending module and a determining module. The sending module is configured to, when receiving a message to be processed, send the message to be processed to the corresponding target service message queue, so that the interrupt controller generates an interrupt from the interrupt source corresponding to the target service message queue. signal; the determination module is configured to determine the processing of the message to be processed based on the first interrupt priority of the interrupt source corresponding to the interrupt signal and the second interrupt priority of the interrupt source corresponding to the current service message queue currently being processed. Strategy.
本申请实施方式提供一种芯片,所述芯片与电子设备的中断控制器连接,所述芯片用于在接收到待处理消息的情况下,将所述待处理消息发送到对应的目标服务消息队列,以使得中断控制器产生与所述目标服务消息队列对应的中断源的中断信号;及根据所述中断信号对应的中断源的第一中断优先级和当前处理的当前服务消息队列对应的中断源的第二中断优先级,确定所述待处理消息的处理策略。An embodiment of the present application provides a chip, which is connected to an interrupt controller of an electronic device. When receiving a message to be processed, the chip is used to send the message to be processed to the corresponding target service message queue. , so that the interrupt controller generates an interrupt signal of an interrupt source corresponding to the target service message queue; and according to the first interrupt priority level of the interrupt source corresponding to the interrupt signal and the interrupt source corresponding to the current service message queue currently being processed The second interrupt priority level determines the processing strategy of the message to be processed.
本申请实施方式提供一种电子设备。所述电子设备包括处理器,所述处理器用于在接收到待处理消息的情况下,将所述待处理消息发送到对应的目标服务消息队列,以使得中断控制器产生与所述目标服务消息队列对应的中断源的中断信号;根据所述中断信号对应的中断源的第一中断优先级和当前处理的当前服务消息队列对应的中断源的第二中断优先级,确定所述待处理消息的处理策略。An embodiment of the present application provides an electronic device. The electronic device includes a processor, and the processor is configured to, when receiving a message to be processed, send the message to be processed to a corresponding target service message queue, so that the interrupt controller generates a message corresponding to the target service message. The interrupt signal of the interrupt source corresponding to the queue; determine the message to be processed according to the first interrupt priority of the interrupt source corresponding to the interrupt signal and the second interrupt priority of the interrupt source corresponding to the current service message queue currently being processed. processing strategies.
本申请实施方式提供一种非易失性计算机可读存储介质,其上存储有计算机程序。该计算机程序被处理器执行时实现调度方法。所述调度方法包括:在接收到待处理消息的情况下,将所述待处理消息发送到对应的目标服务消息队列,以使得中断控制器产生与所述目标服务消息队列对应的中断源的中断信号;根据所述中断信号对应的中断源的第一中断 优先级和当前处理的当前服务消息队列对应的中断源的第二中断优先级,确定所述待处理消息的处理策略。Embodiments of the present application provide a non-volatile computer-readable storage medium on which a computer program is stored. The computer program implements the scheduling method when executed by the processor. The scheduling method includes: when receiving a message to be processed, sending the message to be processed to the corresponding target service message queue, so that the interrupt controller generates an interrupt of the interrupt source corresponding to the target service message queue. Signal; determine the processing strategy of the message to be processed according to the first interrupt priority of the interrupt source corresponding to the interrupt signal and the second interrupt priority of the interrupt source corresponding to the current service message queue currently being processed.
本申请实施方式的附加方面和优点将在下面的描述中部分给出,部分将从下面的描述中变得明显,或通过本申请的实践了解到。Additional aspects and advantages of embodiments of the application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the application.
附图说明Description of the drawings
本申请的上述和/或附加的方面和优点可以从结合下面附图对实施方式的描述中将变得明显和容易理解,其中:The above and/or additional aspects and advantages of the present application will become apparent and readily understood from the description of the embodiments in conjunction with the following drawings, in which:
图1是本申请某些实施方式的调度方法的流程示意图;Figure 1 is a schematic flowchart of a scheduling method in some embodiments of the present application;
图2是本申请某些实施方式的调度方法的流程示意图;Figure 2 is a schematic flowchart of a scheduling method in some embodiments of the present application;
图3是本申请某些实施方式的调度方法的流程示意图;Figure 3 is a schematic flowchart of a scheduling method in some embodiments of the present application;
图4是本申请某些实施方式的调度方法的流程示意图;Figure 4 is a schematic flowchart of a scheduling method in some embodiments of the present application;
图5是本申请某些实施方式的调度方法的原理示意图;Figure 5 is a schematic diagram of the principle of a scheduling method in some embodiments of the present application;
图6是本申请某些实施方式的调度方法的流程示意图;Figure 6 is a schematic flowchart of a scheduling method in some embodiments of the present application;
图7是本申请某些实施方式的调度方法的流程示意图;Figure 7 is a schematic flowchart of a scheduling method in some embodiments of the present application;
图8是本申请某些实施方式的调度方法的原理示意图;Figure 8 is a schematic diagram of the principle of a scheduling method in some embodiments of the present application;
图9是本申请某些实施方式的调度装置的模块示意图;Figure 9 is a schematic module diagram of a scheduling device in some embodiments of the present application;
图10是本申请某些实施方式的电子设备的平面示意图;及Figure 10 is a schematic plan view of an electronic device according to certain embodiments of the present application; and
图11是本申请某些实施方式的非易失性计算机可读存储介质与处理器的交互示意图。Figure 11 is a schematic diagram of the interaction between a non-volatile computer-readable storage medium and a processor in some embodiments of the present application.
具体实施方式Detailed ways
下面详细描述本申请的实施方式,实施方式的示例在附图中示出,其中,相同或类似的标号自始至终表示相同或类似的元件或具有相同或类似功能的元件。下面通过参考附图描述的实施方式是示例性的,仅用于解释本申请的实施方式,而不能理解为对本申请的实施方式的限制。The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements with the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the embodiments of the present application and cannot be understood as limiting the embodiments of the present application.
本申请的调度方法包括在接收到待处理消息的情况下,将待处理消息发送到对应的目标服务消息队列,以使得中断控制器产生与目标服务消息队列对应的中断源的中断信号;根据中断信号对应的中断源的第一中断优先级和当前处理的当前服务消息队列对应的中断源的第二中断优先级,确定待处理消息的处理策略。The scheduling method of this application includes, when receiving a message to be processed, sending the message to be processed to the corresponding target service message queue, so that the interrupt controller generates an interrupt signal of the interrupt source corresponding to the target service message queue; according to the interrupt The first interrupt priority level of the interrupt source corresponding to the signal and the second interrupt priority level of the interrupt source corresponding to the current service message queue currently processed determine the processing strategy of the message to be processed.
在某些实施方式中,根据中断信号对应的中断源的第一中断优先级和当前处理的消息对应的中断源的第二中断优先级,确定待处理消息的处理策略,包括:在第一中断优先级大于第二中断优先级的情况下,挂起当前服务消息队列的消息,并处理目标服务消息队列的消息;在第一中断优先级小于或等于第二中断优先级的情况下,继续处理当前服务消息队列的消息。In some embodiments, determining the processing strategy for the message to be processed according to the first interrupt priority of the interrupt source corresponding to the interrupt signal and the second interrupt priority of the interrupt source corresponding to the currently processed message includes: If the priority is greater than the second interrupt priority, suspend the messages in the current service message queue and process the messages in the target service message queue; if the first interrupt priority is less than or equal to the second interrupt priority, continue processing Messages currently serving the message queue.
在某些实施方式中,根据中断信号对应的中断源的第一中断优先级和当前处理的当前服务消息队列对应的中断源的第二中断优先级,确定待处理消息的处理策略,还包括:根据第一中断优先级、第二中断优先级和当前服务消息队列对应的中断源是否支持抢占,确定待处理消息的处理策略。In some embodiments, determining the processing strategy for the message to be processed based on the first interrupt priority of the interrupt source corresponding to the interrupt signal and the second interrupt priority of the interrupt source corresponding to the current service message queue currently being processed also includes: The processing strategy for the message to be processed is determined based on the first interrupt priority, the second interrupt priority and whether the interrupt source corresponding to the current service message queue supports preemption.
在某些实施方式中,根据第一中断优先级、第二中断优先级和当前服务消息队列对应的中断源是否支持抢占,确定待处理消息的处理策略,包括:在第一中断优先级大于第二中断优先级且当前服务消息队列对应的中断源支持抢占的情况下,挂起当前服务消息队列的消息,并处理目标服务消息队列的消息;在第一中断优先级小于或等于第二中断优先级或当前服务消息队列对应的中断源禁止抢占的情况下,继续处理当前服务消息队列的消息。In some embodiments, the processing strategy for the message to be processed is determined based on the first interrupt priority, the second interrupt priority and whether the interrupt source corresponding to the current service message queue supports preemption, including: when the first interrupt priority is greater than the When the second interrupt priority is and the interrupt source corresponding to the current service message queue supports preemption, the messages in the current service message queue are suspended and the messages in the target service message queue are processed; when the first interrupt priority is less than or equal to the second interrupt priority level or the interrupt source corresponding to the current service message queue prohibits preemption, continue to process messages in the current service message queue.
在某些实施方式中,挂起当前服务消息队列的消息,包括:对当前服务消息队列进行 压栈处理。In some embodiments, suspending messages in the current service message queue includes: pushing the current service message queue onto the stack.
在某些实施方式中,在发送待处理消息到的目标服务消息队列之前,还包括:从空闲消息队列中获取待处理消息对应的消息描述符;将待处理消息发送到对应的目标服务消息队列,包括:将带有消息描述符的待处理消息发送到对应的目标服务消息队列。In some embodiments, before sending the message to be processed to the target service message queue, the method further includes: obtaining the message descriptor corresponding to the message to be processed from the idle message queue; sending the message to be processed to the corresponding target service message queue. , including: sending the pending message with the message descriptor to the corresponding target service message queue.
在某些实施方式中,待处理消息包括描述信息和消息体,空闲消息队列包括消息描述符队列和消息体队列,从空闲消息队列中获取待处理消息对应的消息描述符,包括:从消息描述符队列获取消息描述符的地址,以存储描述信息;在消息体的内容不为空的情况下,从消息体队列中获取消息体地址,以存储消息体;封装消息描述符的地址和消息体地址,以生成消息描述符。In some embodiments, the message to be processed includes description information and a message body. The idle message queue includes a message descriptor queue and a message body queue. Obtaining the message descriptor corresponding to the message to be processed from the idle message queue includes: from the message description The descriptor queue obtains the address of the message descriptor to store the description information; when the content of the message body is not empty, the message body address is obtained from the message body queue to store the message body; the address of the message descriptor and the message body are encapsulated address to generate a message descriptor.
在某些实施方式中,调度方法还包括初始化消息描述符队列中每个消息描述符的地址、及消息体队列中的每个消息体地址。In some embodiments, the scheduling method further includes initializing the address of each message descriptor in the message descriptor queue and the address of each message body in the message body queue.
在某些实施方式中,消息描述符包括消息标识和消息体地址,处理目标服务消息队列的消息,包括:发送带有消息描述符的待处理消息到对应的消息处理实体,以使得消息处理实体获取消息标识对应的预设处理函数及消息体地址对应的消息体,并根据预设处理函数处理消息体。In some embodiments, the message descriptor includes a message identifier and a message body address, and processing the message in the target service message queue includes: sending the message to be processed with the message descriptor to the corresponding message processing entity, so that the message processing entity Obtain the preset processing function corresponding to the message identifier and the message body corresponding to the message body address, and process the message body according to the preset processing function.
在某些实施方式中,调度方法还包括在消息处理实体根据预设处理函数处理消息体的情况下,接收消息处理实体发送到目的服务消息队列的消息,以使得中断控制器产生与目的服务消息队列对应的中断源的中断信号。In some embodiments, the scheduling method also includes receiving a message sent by the message processing entity to the destination service message queue when the message processing entity processes the message body according to the preset processing function, so that the interrupt controller generates a message related to the destination service message. The interrupt signal of the interrupt source corresponding to the queue.
在某些实施方式中,处理目标服务消息队列的消息,还包括:在待处理消息被处理完的情况下,释放带有消息描述符的待处理消息到空闲消息队列。In some embodiments, processing messages in the target service message queue also includes: when the messages to be processed are processed, releasing the messages to be processed with the message descriptors to the idle message queue.
在某些实施方式中,调度方法还包括:在未接收到待处理消息的情况下,根据每个服务消息队列对应的中断源的中断优先级,依次发送服务消息队列的消息到对应的消息处理实体中进行处理,消息处理实体对应至少一个服务消息队列。In some embodiments, the scheduling method also includes: when no pending message is received, sequentially sending the messages of the service message queue to the corresponding message processing according to the interrupt priority of the interrupt source corresponding to each service message queue. Processing is performed in the entity, and the message processing entity corresponds to at least one service message queue.
本申请的调度装置包括发送模块和确定模块。发送模块用于在接收到待处理消息的情况下,将待处理消息发送到对应的目标服务消息队列,以使得中断控制器产生与目标服务消息队列对应的中断源的中断信号;确定模块用于根据中断信号对应的中断源的第一中断优先级和当前处理的当前服务消息队列对应的中断源的第二中断优先级,确定待处理消息的处理策略。The scheduling device of this application includes a sending module and a determining module. The sending module is used to send the to-be-processed message to the corresponding target service message queue when receiving the message to be processed, so that the interrupt controller generates an interrupt signal of the interrupt source corresponding to the target service message queue; the determining module is used to The processing strategy of the message to be processed is determined according to the first interrupt priority level of the interrupt source corresponding to the interrupt signal and the second interrupt priority level of the interrupt source corresponding to the current service message queue currently being processed.
本申请的芯片与电子设备的中断控制器连接,芯片用于在接收到待处理消息的情况下,将待处理消息发送到对应的目标服务消息队列,以使得中断控制器产生与目标服务消息队列对应的中断源的中断信号;及根据中断信号对应的中断源的第一中断优先级和当前处理的当前服务消息队列对应的中断源的第二中断优先级,确定待处理消息的处理策略。The chip of this application is connected to the interrupt controller of the electronic device. When receiving a message to be processed, the chip is used to send the message to be processed to the corresponding target service message queue, so that the interrupt controller generates a message that is in contact with the target service message queue. The interrupt signal of the corresponding interrupt source; and determining the processing strategy of the message to be processed according to the first interrupt priority of the interrupt source corresponding to the interrupt signal and the second interrupt priority of the interrupt source corresponding to the current service message queue currently being processed.
本申请的电子设备包括处理器,处理器用于在接收到待处理消息的情况下,将待处理消息发送到对应的目标服务消息队列,以使得中断控制器产生与目标服务消息队列对应的中断源的中断信号;根据中断信号对应的中断源的第一中断优先级和当前处理的当前服务消息队列对应的中断源的第二中断优先级,确定待处理消息的处理策略。The electronic device of the present application includes a processor. When receiving a message to be processed, the processor is configured to send the message to be processed to the corresponding target service message queue, so that the interrupt controller generates an interrupt source corresponding to the target service message queue. The interrupt signal; determine the processing strategy of the message to be processed according to the first interrupt priority of the interrupt source corresponding to the interrupt signal and the second interrupt priority of the interrupt source corresponding to the current service message queue currently being processed.
在某些实施方式中,处理器还用于在第一中断优先级大于第二中断优先级的情况下,挂起当前服务消息队列的消息,并处理目标服务消息队列的消息;在第一中断优先级小于或等于第二中断优先级的情况下,继续处理当前服务消息队列的消息。In some embodiments, the processor is also configured to suspend messages in the current service message queue and process messages in the target service message queue when the first interrupt priority is greater than the second interrupt priority; If the priority is less than or equal to the second interrupt priority, continue processing the messages in the current service message queue.
在某些实施方式中,处理器还用于根据第一中断优先级、第二中断优先级和当前服务消息队列对应的中断源是否支持抢占,确定待处理消息的处理策略。In some implementations, the processor is also configured to determine a processing strategy for the message to be processed based on the first interrupt priority, the second interrupt priority, and whether the interrupt source corresponding to the current service message queue supports preemption.
在某些实施方式中,处理器还用于在第一中断优先级大于第二中断优先级且当前服务消息队列对应的中断源支持抢占的情况下,挂起当前服务消息队列的消息,并处理目标服务消息队列的消息;在第一中断优先级小于或等于第二中断优先级或当前服务消息队列对应的中断源禁止抢占的情况下,继续处理当前服务消息队列的消息。In some embodiments, the processor is also configured to suspend messages in the current service message queue and process them when the first interrupt priority is greater than the second interrupt priority and the interrupt source corresponding to the current service message queue supports preemption. Messages in the target service message queue; when the first interrupt priority is less than or equal to the second interrupt priority or the interrupt source corresponding to the current service message queue prohibits preemption, continue processing the messages in the current service message queue.
在某些实施方式中,处理器还用于对当前服务消息队列进行压栈处理。In some embodiments, the processor is also configured to push the current service message queue onto the stack.
在某些实施方式中,在发送待处理消息到的目标服务消息队列之前,处理器还用于从空闲消息队列中获取待处理消息对应的消息描述符;将带有消息描述符的待处理消息发送到对应的目标服务消息队列。In some implementations, before sending the message to be processed to the target service message queue, the processor is also configured to obtain the message descriptor corresponding to the message to be processed from the idle message queue; Sent to the corresponding target service message queue.
在某些实施方式中,待处理消息包括描述信息和消息体,空闲消息队列包括消息描述符队列和消息体队列,处理器还用于从消息描述符队列获取消息描述符的地址,以存储描述信息;在消息体的内容不为空的情况下,从消息体队列中获取消息体地址,以存储消息体;封装消息描述符的地址和消息体地址,以生成消息描述符。In some embodiments, the message to be processed includes description information and a message body. The idle message queue includes a message descriptor queue and a message body queue. The processor is also configured to obtain the address of the message descriptor from the message descriptor queue to store the description. Information; when the content of the message body is not empty, obtain the message body address from the message body queue to store the message body; encapsulate the address of the message descriptor and the message body address to generate a message descriptor.
在某些实施方式中,处理器还用于初始化消息描述符队列中每个消息描述符的地址、及消息体队列中的每个消息体地址。In some embodiments, the processor is further configured to initialize the address of each message descriptor in the message descriptor queue and the address of each message body in the message body queue.
在某些实施方式中,消息描述符包括消息标识和消息体地址,处理器还用于发送带有消息描述符的待处理消息到对应的消息处理实体,以使得消息处理实体获取消息标识对应的预设处理函数及消息体地址对应的消息体,并根据预设处理函数处理消息体。In some embodiments, the message descriptor includes a message identifier and a message body address, and the processor is also configured to send the message to be processed with the message descriptor to the corresponding message processing entity, so that the message processing entity obtains the message corresponding to the message identifier. Default processing function and message body corresponding to the message body address, and process the message body according to the default processing function.
在某些实施方式中,处理器还用于在消息处理实体根据预设处理函数处理消息体的情况下,接收消息处理实体发送到目的服务消息队列的消息,以使得中断控制器产生与目的服务消息队列对应的中断源的中断信号。In some embodiments, the processor is also configured to receive the message sent by the message processing entity to the destination service message queue when the message processing entity processes the message body according to the preset processing function, so that the interrupt controller generates a message related to the destination service. The interrupt signal of the interrupt source corresponding to the message queue.
在某些实施方式中,处理器还用于在待处理消息被处理完的情况下,释放带有消息描述符的待处理消息到空闲消息队列。In some embodiments, the processor is also configured to release the pending message with the message descriptor to the idle message queue when the pending message is processed.
在某些实施方式中,处理器还用于在未接收到待处理消息的情况下,根据每个服务消息队列对应的中断源的中断优先级,依次发送服务消息队列的消息到对应的消息处理实体中进行处理,消息处理实体对应至少一个服务消息队列。In some embodiments, the processor is also configured to sequentially send messages from the service message queue to the corresponding message processor according to the interrupt priority of the interrupt source corresponding to each service message queue when no pending message is received. Processing is performed in the entity, and the message processing entity corresponds to at least one service message queue.
本申请的非易失性计算机可读存储介质包括计算机程序,当计算机程序被一个或多个处理器执行时,实现上述任一实施方式的调度方法。The non-volatile computer-readable storage medium of the present application includes a computer program. When the computer program is executed by one or more processors, the scheduling method of any of the above embodiments is implemented.
下面首先对本申请出现的名词进行解释:The terms appearing in this application will first be explained below:
消息:消息为一段业务逻辑,通过对消息的处理,能够完成***的特定操作,消息包括描述信息和消息体,描述信息用于解析和处理消息,消息体则包含消息的实际内容。Message: A message is a piece of business logic. By processing the message, specific operations of the system can be completed. The message includes description information and a message body. The description information is used to parse and process the message, and the message body contains the actual content of the message.
复杂***中的控制过程由一组任务组成,任务的运行通过处理器和任务的调度器完成。这其中***可以是一个复杂的通信***、工业控制***或者汽车中央控制***。通常情况下,控制过程包括执行拥有不同功能的任务,这些任务负责处理与***事务操作有关的消息,也即是说,每个任务的处理,即表示对该任务有关的一个或多个消息的处理。The control process in a complex system consists of a set of tasks, and the running of the tasks is completed through the processor and task scheduler. The system can be a complex communication system, industrial control system or automobile central control system. Typically, the control process includes the execution of tasks with different functions. These tasks are responsible for processing messages related to the transaction operation of the system. That is, the processing of each task represents the processing of one or more messages related to the task. deal with.
服务消息队列:服务消息队列对应***的任务,如一个服务消息队列对应一个任务,服务消息队列用于存放消息,并通过发送服务消息队列的消息到对应的消息处理实体中依次进行处理,从而完成任务。Service message queue: The service message queue corresponds to the system's tasks. For example, one service message queue corresponds to one task. The service message queue is used to store messages and is completed by sending messages from the service message queue to the corresponding message processing entity for processing in turn. Task.
消息处理实体:为处理器中,用于处理消息的对象,一个处理器可以具有一个或多个消息处理实体,多个消息处理实体可同时处理多个消息。Message processing entity: An object used to process messages in a processor. A processor can have one or more message processing entities, and multiple message processing entities can process multiple messages at the same time.
中断控制器:能够在消息发送到服务消息队列后,触发服务消息队列对应的中断源的中断信号,并将中断信号路由到对应的处理器,由处理器根据中断信号对应的中断源的中断优先级,确定是否中断当前处理的服务消息队列,以处理中断信号对应的服务消息队列。Interrupt controller: After the message is sent to the service message queue, it can trigger the interrupt signal of the interrupt source corresponding to the service message queue and route the interrupt signal to the corresponding processor. The processor will prioritize the interrupt of the interrupt source corresponding to the interrupt signal. level, determine whether to interrupt the currently processed service message queue to process the service message queue corresponding to the interrupt signal.
中断优先级:为使***能及时响应并处理发生的所有中断,***根据引起中断事件的重要性和紧迫程度,将中断源分为若干个级别,称作中断优先级。Interrupt priority: In order for the system to respond to and handle all interrupts that occur in a timely manner, the system divides interrupt sources into several levels based on the importance and urgency of the event causing the interrupt, called interrupt priority.
请参阅图1,本申请实施方式的调度方法包括:Please refer to Figure 1. The scheduling method in the implementation of this application includes:
步骤011:在接收到待处理消息的情况下,将待处理消息发送到对应的目标服务消息队列,以使得目标服务消息队列在中断控制器中对应的中断源产生中断信号。Step 011: When receiving a message to be processed, send the message to be processed to the corresponding target service message queue, so that the target service message queue generates an interrupt signal from the corresponding interrupt source in the interrupt controller.
具体地,在***运行过程中,会执行各种不同的任务,每个任务在执行过程中,***会不断发送消息,通过处理一个个消息,完成特定的任务。在接收到一个待处理消息的情 况下,会先将待处理消息发送到所属的任务对应的目标服务消息队列中,可以理解,每个消息根据所属任务的不同,均存在对应的目标服务消息队列。Specifically, during the operation of the system, various tasks will be performed. During the execution of each task, the system will continuously send messages and complete specific tasks by processing each message. When a pending message is received, the pending message will first be sent to the target service message queue corresponding to the task to which it belongs. It can be understood that each message has a corresponding target service message queue according to the task to which it belongs. .
在待处理消息发送到目标服务消息队列之后,目标服务消息队列在中断控制器中对应的中断源即产生中断信号,即服务消息队列与中断源是存在对应关系的,每个服务消息队列可对应至少一个中断源,即服务消息队列中的多个消息可以是分别服务于不同中断源,服务消息队列与中断源绑定关联。After the message to be processed is sent to the target service message queue, the corresponding interrupt source of the target service message queue in the interrupt controller generates an interrupt signal, that is, there is a corresponding relationship between the service message queue and the interrupt source, and each service message queue can correspond to At least one interrupt source, that is, multiple messages in the service message queue can serve different interrupt sources respectively, and the service message queue is bound and associated with the interrupt source.
服务消息队列的优先级根据与服务消息队列绑定的中断源的中断优先级来确定,可以理解,服务消息队列绑定的一个或多个中断源的中断优先级是相同的,以保证处理一个服务消息队列时,能够根据队列顺序依次进行处理,防止同一个服务消息队列存在对应不同中断优先级的中断源的消息,从而避免低中断优先级的消息反而被优先处理的情况。The priority of the service message queue is determined based on the interrupt priority of the interrupt source bound to the service message queue. It can be understood that the interrupt priority of one or more interrupt sources bound to the service message queue is the same to ensure that one When serving the message queue, it can be processed sequentially according to the queue order to prevent the same service message queue from having messages corresponding to interrupt sources with different interrupt priorities, thereby avoiding the situation where messages with low interrupt priority are processed preferentially.
在待处理消息发送到目标服务消息队列后,即可触发目标服务消息队列绑定的多个中断源中,与消息对应的中断源产生中断信号;或者,由于服务消息队列对应的至少一个中断源的中断优先级是相同的,而本申请是基于中断优先级进行任务调度的,因此,在待处理消息发送到目标服务消息队列后,只需触发目标服务消息队列绑定的多个中断源中任意一个中断源产生中断信号即可实现任务调度。例如,通过操作中断控制器中与中断源对应的中断挂起状态寄存器直接触发产生相应的中断信号从而不依赖于外部的中断信号触发。After the pending message is sent to the target service message queue, the interrupt source corresponding to the message among the multiple interrupt sources bound to the target service message queue can be triggered to generate an interrupt signal; or, because at least one interrupt source corresponding to the service message queue The interrupt priorities are the same, and this application schedules tasks based on the interrupt priority. Therefore, after the pending message is sent to the target service message queue, it only needs to trigger multiple interrupt sources bound to the target service message queue. Task scheduling can be realized by generating an interrupt signal from any interrupt source. For example, by operating the interrupt pending status register corresponding to the interrupt source in the interrupt controller, the corresponding interrupt signal is directly triggered and generated without relying on external interrupt signal triggering.
步骤012:根据中断信号对应的中断源的第一中断优先级和当前处理的当前服务消息队列对应的中断源的第二中断优先级,确定待处理消息的处理策略。Step 012: Determine the processing strategy for the message to be processed based on the first interrupt priority of the interrupt source corresponding to the interrupt signal and the second interrupt priority of the interrupt source corresponding to the current service message queue currently being processed.
在产生中断信号后,即可利用***自带的中断控制器的中断机制,实现任务调度。可根据中断信号对应的中断源的第一中断优先级和当前正常进行处理的当前服务消息队列对应的中断源的第二中断优先级,从而确定待处理消息的处理策略,如是否中断当前服务消息队列的处理,以处理目标服务消息队列,或者不进行中断,继续当前服务消息队列的处理。After an interrupt signal is generated, the interrupt mechanism of the system's own interrupt controller can be used to implement task scheduling. The processing strategy of the message to be processed, such as whether to interrupt the current service message, can be determined based on the first interrupt priority of the interrupt source corresponding to the interrupt signal and the second interrupt priority of the interrupt source corresponding to the current service message queue currently being processed normally. Processing of the queue to process the target service message queue, or continue processing of the current service message queue without interruption.
请参阅图2,可选地,步骤012可包括:Referring to Figure 2, optionally, step 012 may include:
步骤0121:在第一中断优先级大于第二中断优先级的情况下,挂起当前服务消息队列的消息,并处理目标服务消息队列的消息;Step 0121: When the first interrupt priority is greater than the second interrupt priority, suspend the messages in the current service message queue and process the messages in the target service message queue;
步骤0122:在第一中断优先级小于或等于第二中断优先级的情况下,继续处理当前服务消息队列的消息。Step 0122: If the first interrupt priority is less than or equal to the second interrupt priority, continue processing the messages of the current service message queue.
具体地,在确定待处理消息的处理策略时,可判断待处理消息对应的第一中断优先级和当前服务消息队列对应的第二中断优先级彼此之间的大小,在第一中断优先级大于第二中断优先级的情况下,说明待处理消息需要优先被处理,因此,此时可挂起当前服务消息队列,然后处理待处理消息所在的目标服务消息队列。其中,挂起当前服务消息队列指的是暂停当前服务消息队列的处理,并保存当前服务消息队列的上下文信息,从而方便处理完目标服务消息队列后,再次恢复当前服务消息队列的处理。Specifically, when determining the processing strategy of the message to be processed, the size of the first interrupt priority corresponding to the message to be processed and the second interrupt priority corresponding to the current service message queue can be determined. When the first interrupt priority is greater than In the case of the second interrupt priority, it means that the pending message needs to be processed first. Therefore, the current service message queue can be suspended at this time, and then the target service message queue where the pending message is located can be processed. Among them, suspending the current service message queue refers to pausing the processing of the current service message queue and saving the context information of the current service message queue, so as to facilitate the resumption of the processing of the current service message queue after the target service message queue is processed.
保存当前服务消息队列的上下文信息可以通过将当前服务消息队列进行寄存器压栈操作来实现,即将处理当前服务消息队列的处理器的相关上下文信息进行压栈即可,由于本申请采用基于现有硬件中断控制器技术而设计实现的调度器功能,取消了软件对于任务上下文的管理,因此相比于传统基于软件实现的实时操作***的调度器,无论从任务调度开销还是中断响应时延都得以较少。请参阅表1,本申请在压栈时,只需进行处理器寄存器压栈即可,而无需进行操作***整体的上下文压栈,压栈的开销得以减小。Saving the context information of the current service message queue can be achieved by pushing the register of the current service message queue onto the stack, that is, pushing the relevant context information of the processor that processes the current service message queue onto the stack. Since this application uses existing hardware, The scheduler function designed and implemented based on interrupt controller technology eliminates the software's management of task context. Therefore, compared with traditional software-based real-time operating system schedulers, both task scheduling overhead and interrupt response latency are reduced. few. Please refer to Table 1. When pushing the stack in this application, only the processor register is pushed onto the stack, and there is no need to push the entire operating system context onto the stack. This reduces the overhead of stack pushing.
中断信号到达处理器Interrupt signal reaches processor 3时钟周期(cycles)3 clock cycles
处理器获取第一条指令Processor gets first instruction 8cycles8cycles
处理器寄存器压栈Processor register push 15cycles15cycles
操作***上下文压栈Operating system context push 40cycles40cycles
中断回调函数处理Interrupt callback function processing 处理程序有关Handler related
操作***上下文出栈Operating system context pop 40cycles40cycles
处理器寄存器出栈Processor register pop 15cycles15cycles
中断返回interrupt return 300cycles300cycles
表1 中断过程处理器开销Table 1 Interrupt process processor overhead
本申请对中断响应时延将降低(1–(3+8+15)/(3+8+15+40))*100%=66%,即减少了操作***上下文压栈的时间消耗,中断处理的处理器开销将降低(1–(3+8+15+15)/(3+8+15+15+40+40+300))*100%=90%,即减少了操作***上下文压栈和出栈、以及中断返回所需的时间,调度就绪任务需要的处理器开销将降低(1–(3+8+15+15)/300)=86%。更进一步地,本申请对于服务消息队列中同时存在多个待处理消息的情况下,处理器将不会线性累计硬件开销,服务消息队列针对中断事件产生的硬件开销是一次性的,即服务消息队列中的待处理消息一次性压栈或出栈,直至服务消息队列里的全部消息处理完成后中断退出。随着***内部控制任务的消息交互的频率越高,所能节省的硬件开销也就越大。The interrupt response delay of this application will be reduced by (1–(3+8+15)/(3+8+15+40))*100%=66%, that is, the time consumption of operating system context stacking is reduced, and the interrupt The processor overhead of processing will be reduced by (1–(3+8+15+15)/(3+8+15+15+40+40+300))*100%=90%, which means the operating system context pressure is reduced. The time required for stacking and popping, as well as interrupt return, and the processor overhead required for scheduling ready tasks will be reduced by (1–(3+8+15+15)/300)=86%. Furthermore, in this application, when there are multiple pending messages in the service message queue at the same time, the processor will not linearly accumulate hardware overhead. The hardware overhead generated by the service message queue for interrupt events is one-time, that is, the service message The messages to be processed in the queue are pushed or popped out of the stack at one time until all messages in the service message queue are processed and exited. The higher the frequency of message exchange between control tasks within the system, the greater the hardware overhead that can be saved.
以硬件多线程为例,为了提高线程间实时切换的性能,需要为每一个硬件线程提供一套独立的处理器专用寄存器组,用来保存硬件线程在运行过程中的上下文状态和数据。相比于单个硬件线程的技术方案,虽然在硬件线程切换过程中减少软件处理寄存器压栈出栈的开销,但却复制了一组独立的处理器专用寄存器,同时增加了处理器设计的复杂度。硬件的任务调度效率较高,但硬件的每多一个硬件线程,就需要增加一组专用的寄存器组,不仅增加了成本,而且会对***的功耗带来负面影响。Taking hardware multi-threading as an example, in order to improve the performance of real-time switching between threads, it is necessary to provide an independent set of processor-specific registers for each hardware thread to save the context status and data of the hardware thread during operation. Compared with the technical solution of a single hardware thread, although the overhead of software processing register pushing and popping is reduced during the hardware thread switching process, it duplicates a set of independent processor-specific registers and increases the complexity of the processor design. . Hardware has high task scheduling efficiency, but each additional hardware thread requires a dedicated set of registers, which not only increases the cost, but also has a negative impact on the system's power consumption.
而本申请由于采用基于现有硬件中断控制器技术而设计实现的调度器功能,不需要增加额外的专有硬件逻辑用以提高***调度性能,减少了大量的处理器资源,从而降低了芯片的面积与功耗。本申请提出的技术方案充分考虑了降低专用硬件资源与软件调度器对***产生的开销,在性能与***软硬件资源利用方面实现了更好的平衡。Since this application adopts the scheduler function designed and implemented based on the existing hardware interrupt controller technology, there is no need to add additional proprietary hardware logic to improve the system scheduling performance, reducing a large amount of processor resources, thereby reducing the chip's area and power consumption. The technical solution proposed in this application fully considers reducing the overhead caused by dedicated hardware resources and software schedulers to the system, and achieves a better balance between performance and system software and hardware resource utilization.
而在第一中断优先级小于或等于第二中断优先级的情况下,说明待处理消息并不需要优先被处理,因此需要等待当前服务消息队列的消息处理完成后,才能够处理待处理消息,此时让待处理消息在目标服务消息队列中等待,继续处理当前服务消息队列的消息即可,从而通过服务消息队列对应的中断优先级,实现任务调度。When the first interrupt priority is less than or equal to the second interrupt priority, it means that the pending message does not need to be processed first, so it is necessary to wait for the message processing of the current service message queue to be completed before the pending message can be processed. At this time, let the messages to be processed wait in the target service message queue and continue to process the messages in the current service message queue, thereby realizing task scheduling through the interrupt priority corresponding to the service message queue.
请参阅图3,可选地,步骤012可包括:Referring to Figure 3, optionally, step 012 may include:
步骤0123:根据第一中断优先级、第二中断优先级和当前服务消息队列对应的中断源是否支持抢占,确定待处理消息的处理策略。Step 0123: Determine the processing strategy for the message to be processed based on the first interrupt priority, the second interrupt priority and whether the interrupt source corresponding to the current service message queue supports preemption.
具体地,由于对于***中互斥资源的保护与原子操作的部分而言,在进行对应的任务与处理时,是不能够被打断的,因此,不同中断源需要事先定义好相关属性,请参阅表2,每个中断源均具有如下属性:Specifically, since the protection of mutually exclusive resources and atomic operations in the system cannot be interrupted when performing corresponding tasks and processing, therefore, different interrupt sources need to define relevant attributes in advance, please Referring to Table 2, each interrupt source has the following attributes:
中断优先级Interrupt priority
目标处理器target processor
是否支持抢占Whether to support preemption
目的服务消息队列Destination service message queue
目的消息处理实体Destination message processing entity
表2 中断源属性Table 2 Interrupt source attributes
其中,中断优先级用于表示中断源在进行中断时的优先级,目标处理器则表示中断源对应的消息应由电子设备的对应的处理器处理,是否支持抢占则表示中断源对应的服务消息队列在被处理时,是否能够被其他服务消息队列抢占,目的服务消息队列则表示中断源绑定的服务消息队列的标识信息,每个服务消息队列均存在唯一的标识信息,目的消息处 理实体则表示用于处理中断源对应的服务消息队列的消息处理实体的标识信息,消息处理实体也存在唯一的标识信息。Among them, the interrupt priority is used to indicate the priority of the interrupt source when interrupting. The target processor indicates that the message corresponding to the interrupt source should be processed by the corresponding processor of the electronic device. Whether preemption is supported indicates the service message corresponding to the interrupt source. When the queue is being processed, whether it can be preempted by other service message queues. The destination service message queue represents the identification information of the service message queue bound to the interrupt source. Each service message queue has unique identification information, and the destination message processing entity is Represents the identification information of the message processing entity used to process the service message queue corresponding to the interrupt source. The message processing entity also has unique identification information.
因此,在进行第一中断优先级和第二中断优先级之间的大小判断之前,可先确定当前服务消息队列(或具体为当前正在处理的消息)对应的中断源是否支持抢占,在支持抢占的情况下,判断第一中断优先级是否大于第二中断优先级,从而在第一中断优先级大于第二中断优先级的情况下,挂起当前服务消息队列的消息,并处理目标服务消息队列的消息;而在第一中断优先级小于或等于第二中断优先级或当前服务消息队列(或具体为当前正在处理的消息)对应的中断源禁止抢占的情况下,继续处理当前服务消息队列的消息。如此,通过设置中断源的是否支持抢占的属性后,高优先级服务消息队列(即服务消息队列绑定的中断源的中断优先级较高)将被禁止抢占当前正在处理的服务消息队列,从而实现对于***中资源一致性的保护。Therefore, before making a size judgment between the first interrupt priority and the second interrupt priority, you can first determine whether the interrupt source corresponding to the current service message queue (or specifically the message currently being processed) supports preemption. If it supports preemption, In the case of , it is judged whether the first interrupt priority is greater than the second interrupt priority, so that if the first interrupt priority is greater than the second interrupt priority, the messages in the current service message queue are suspended and the target service message queue is processed. message; and when the first interrupt priority is less than or equal to the second interrupt priority or the interrupt source corresponding to the current service message queue (or specifically the message currently being processed) prohibits preemption, continue to process the current service message queue. information. In this way, by setting the attribute of whether the interrupt source supports preemption, the high-priority service message queue (that is, the interrupt source bound to the service message queue has a higher interrupt priority) will be prohibited from preempting the service message queue currently being processed, thus To protect the consistency of resources in the system.
请参阅图4,在发送待处理消息到的目标服务消息队列之前,调度方法还包括:Referring to Figure 4, before sending the pending message to the target service message queue, the scheduling method also includes:
步骤010:从空闲消息队列中获取待处理消息对应的消息描述符,消息描述符包括消息标识和消息体地址;Step 010: Obtain the message descriptor corresponding to the message to be processed from the idle message queue. The message descriptor includes the message identifier and the message body address;
步骤011:将待处理消息发送到对应的目标服务消息队列,包括:Step 011: Send the pending message to the corresponding target service message queue, including:
步骤0111:将带有消息描述符的待处理消息发送到对应的目标服务消息队列。Step 0111: Send the pending message with the message descriptor to the corresponding target service message queue.
具体地,***分发的消息需要进行消息的申请,以为消息的具体信息分配对应的资源(如内存等),消息的申请流程主要是申请消息的消息描述符和消息体。消息描述符中包含用来说明消息总体信息的描述信息,描述信息用于对消息进行正确的解析和处理。消息体则是用来存放消息的实际内容,内容中可包含控制***中任务间传递的具体数据内容。Specifically, the messages distributed by the system require message application to allocate corresponding resources (such as memory, etc.) for the specific information of the message. The message application process mainly involves applying for the message descriptor and message body of the message. The message descriptor contains description information used to describe the overall information of the message. The description information is used to correctly parse and process the message. The message body is used to store the actual content of the message, which can include specific data content passed between tasks in the control system.
本申请中,设计了专门用于存放消息描述符和消息体的空闲消息队列。In this application, an idle message queue is designed specifically for storing message descriptors and message bodies.
请参阅图5,可选地,空闲消息队列可包括消息描述符队列和消息体队列,消息描述符队列用于存放消息描述符(如图5中的消息描述符N(N为整数且大于3)),消息体队列则用于存放消息体(如图5中的消息体M(M为整数且大于3))。Please refer to Figure 5. Optionally, the idle message queue may include a message descriptor queue and a message body queue. The message descriptor queue is used to store message descriptors (message descriptor N in Figure 5 (N is an integer and greater than 3 )), the message body queue is used to store the message body (message body M in Figure 5 (M is an integer and greater than 3)).
在进行消息申请时,可从消息描述符队列中申请消息描述符(如将消息描述符队列中位于队首的消息描述符出栈),消息描述符队列中的消息描述符实际为存储有描述信息的内存地址,申请消息描述符的过程即为将说明消息总体信息的描述信息存储到消息描述符对应的内存地址中的过程,如消息描述符N对应描述符地址N。When applying for a message, you can apply for a message descriptor from the message descriptor queue (such as popping the message descriptor at the head of the message descriptor queue). The message descriptor in the message descriptor queue actually stores a description. The memory address of the message. The process of applying for a message descriptor is the process of storing the description information describing the overall message information into the memory address corresponding to the message descriptor. For example, message descriptor N corresponds to descriptor address N.
消息的消息体的内容可以为空,此时则不需要申请消息体,直接将消息描述符的地址封装即可得到消息描述符,从而将带有消息描述符的待处理消息发送到对应的目标服务消息队列进行处理即可。The content of the message body of the message can be empty. In this case, there is no need to apply for the message body. The message descriptor can be obtained by directly encapsulating the address of the message descriptor, thereby sending the pending message with the message descriptor to the corresponding target. The service message queue can be processed.
而在消息的消息体存在具体数据内容时,则需要申请消息体,可从消息体队列中申请消息体,如将消息体队列中位于队首的消息体出栈,消息体队列中的消息体实际为存储有消息体具体数据内容的内存地址,因此,申请消息体的过程即为将消息的具体数据内容存储到消息体对应的内存地址中的过程,如消息体M对应消息体地址M。When the message body of the message contains specific data content, you need to apply for the message body. You can apply for the message body from the message body queue. For example, the message body at the head of the message body queue is popped from the stack, and the message body in the message body queue is popped. It is actually the memory address where the specific data content of the message body is stored. Therefore, the process of applying for the message body is the process of storing the specific data content of the message into the memory address corresponding to the message body. For example, message body M corresponds to message body address M.
在申请得到消息描述符的地址和消息体地址后,即可将消息描述符的地址和消息体地址封装得到消息描述符,从而可将带有消息描述符的待处理消息发送到对应的目标服务消息队列,从而方便消息处理实体对待处理消息的处理。After applying for the address of the message descriptor and the message body address, the address of the message descriptor and the message body address can be encapsulated to obtain the message descriptor, so that the pending message with the message descriptor can be sent to the corresponding target service. Message queue to facilitate the processing of pending messages by message processing entities.
消息描述符的具体包含的内容如下表3:The specific contents of the message descriptor are as follows in Table 3:
消息标识Message ID
消息大小message size
消息类型Message type
消息源地址Message source address
消息目的地址Message destination address
消息体地址Message body address
表3 消息描述符内容Table 3 Message descriptor content
其中,消息描述符中的信息能够方便消息处理实体进行消息的解析和处理,如其中的消息标识用于消息处理实体找到处理消息体地址中的具体数据内容的处理函数,消息大小和类型则是消息的基本信息,消息源地址和消息目标地址则可分别指向不同的服务消息队列,从而实现不同服务消息队列之间的通信。Among them, the information in the message descriptor can facilitate the message processing entity to parse and process the message. For example, the message identifier is used by the message processing entity to find the processing function that processes the specific data content in the message body address. The message size and type are The basic information of the message, the message source address and the message destination address can point to different service message queues respectively, thereby realizing communication between different service message queues.
此外,消息体在内存中的地址信息(即表3中的消息体地址)将在消息描述符中维护,从而可以灵活的支持***中对于消息体的拷贝与发送。例如,当一条消息需要被多次拷贝发送到不同的服务消息队列中处理时,***可以申请多个消息描述符,多个消息描述符可能仅是消息目的地址不同,多个消息描述符中消息体地址是相同的,从而减少实时***中由于多次发送相同消息内容,而需要多次拷贝消息体的具体数据内容而产生的性能下降。In addition, the address information of the message body in the memory (i.e., the message body address in Table 3) will be maintained in the message descriptor, thereby flexibly supporting the copying and sending of the message body in the system. For example, when a message needs to be copied multiple times and sent to different service message queues for processing, the system can apply for multiple message descriptors. The multiple message descriptors may only have different message destination addresses. The body address is the same, thereby reducing the performance degradation caused by sending the same message content multiple times in a real-time system and needing to copy the specific data content of the message body multiple times.
可选地,本申请中的空闲消息队列可以在***启动后,初始化消息描述符队列中每个消息描述符的地址、及消息体队列中的每个消息体地址。也即是说,消息描述符中的每个消息描述符的地址和消息体地址都是提前分配好资源的,从而无需在每次申请消息的时候,再进行内存资源的分配,从而有利于提高消息申请的效率,进而提高消息发送的效率。Optionally, the idle message queue in this application can initialize the address of each message descriptor in the message descriptor queue and the address of each message body in the message body queue after the system is started. That is to say, the address and message body address of each message descriptor in the message descriptor are allocated resources in advance, so there is no need to allocate memory resources every time a message is requested, which is beneficial to improving The efficiency of message application, thereby improving the efficiency of message sending.
可选地,本申请的空闲消息队列存储在电子设备的第一队列寄存器中,服务消息队列则存在第二队列寄存器中,第二队列寄存器有多个,每个第二队列寄存器存储一个或多个服务消息队列,由于寄存器是在保存在通用内存中,不会对处理器的硬件资源产生额外的开销,同时又可以提高寄存器压栈与出栈的性能。Optionally, the idle message queue of this application is stored in the first queue register of the electronic device, and the service message queue is stored in the second queue register. There are multiple second queue registers, and each second queue register stores one or more A service message queue, because the registers are stored in general memory, will not cause additional overhead on the processor's hardware resources, and at the same time can improve the performance of register pushing and popping.
请参阅图6,可选地,步骤0121:处理目标服务消息队列的消息,包括:Please refer to Figure 6. Optionally, step 0121: Process messages in the target service message queue, including:
步骤01211:发送带有消息描述符的待处理消息到对应的消息处理实体,以使得消息处理实体获取消息标识对应的预设处理函数及消息体地址对应的消息内容,并根据预设处理函数处理消息内容。Step 01211: Send the message to be processed with the message descriptor to the corresponding message processing entity, so that the message processing entity obtains the preset processing function corresponding to the message identifier and the message content corresponding to the message body address, and processes it according to the preset processing function Message content.
具体地,在将带有消息描述符的待处理消息发送到目标服务消息队列后,此时中断控制器产生与目标服务消息队列对应的中断源的中断信号,在中断信号对应的中断源的第一中断优先级大于当前正在处理的当前服务消息队列对应的中断源的第二中断优先级的情况下,可挂起当前服务消息队列的消息,并处理目标服务消息队列的消息。Specifically, after sending the pending message with the message descriptor to the target service message queue, the interrupt controller generates an interrupt signal of the interrupt source corresponding to the target service message queue, and at the interrupt source corresponding to the interrupt signal When the first interrupt priority is greater than the second interrupt priority of the interrupt source corresponding to the current service message queue currently being processed, the messages in the current service message queue can be suspended and the messages in the target service message queue can be processed.
在处理时,可根据中断源属性首先确定目标服务消息队列对应的消息处理实体,然后发送带有消息描述符的待处理消息到对应的消息处理实体进行消息处理即可。在进行消息处理时,消息处理实体首先根据消息描述符的地址,获取到消息描述符中的消息标识,从而获取与消息标识绑定的预设处理函数,然后获取消息描述符中的消息体地址,并获取到消息体的具体数据内容,最后根据预设处理函数对该具体数据内容进行处理,从而完成待处理消息的处理。During processing, you can first determine the message processing entity corresponding to the target service message queue according to the interrupt source attribute, and then send the pending message with the message descriptor to the corresponding message processing entity for message processing. When performing message processing, the message processing entity first obtains the message identifier in the message descriptor according to the address of the message descriptor, thereby obtaining the preset processing function bound to the message identifier, and then obtains the message body address in the message descriptor. , and obtain the specific data content of the message body, and finally process the specific data content according to the preset processing function, thereby completing the processing of the message to be processed.
前述已经提到消息描述符中可包含消息源地址和消息目的地址,以分别表示发送消息的源服务消息队列,以及接收消息的目的服务消息队列,从而实现不同服务消息队列之间的通信。因此,在消息处理实体根据预设处理函数处理消息体的情况下,若需要与目的服务消息队列进行通信,则消息处理实体发送消息到目的服务消息队列,以使得中断控制器产生与目的服务消息队列对应的中断源的中断信号,从而进行中断处理,实现服务消息队列之间的通信。As mentioned above, the message descriptor can contain the message source address and the message destination address to respectively represent the source service message queue for sending the message and the destination service message queue for receiving the message, thereby realizing communication between different service message queues. Therefore, when the message processing entity processes the message body according to the preset processing function, if it needs to communicate with the destination service message queue, the message processing entity sends a message to the destination service message queue, so that the interrupt controller generates a message related to the destination service message. The interrupt signal of the interrupt source corresponding to the queue is used to process the interrupt and realize communication between service message queues.
可以理解,不同服务消息队列对应的任务之间并不是孤立的,一个任务的执行可能需要其他任务先执行,例如,在处理当前服务消息队列(即源服务消息队列)的消息1时,需要另外一个目的服务消息队列先处理消息2,因此,当前服务消息队列可申请消息2并发送到目的服务消息队列中,以触发中断来先处理消息2,在完成消息2的处理后,则退出中断再次处理消息1。It can be understood that tasks corresponding to different service message queues are not isolated. The execution of one task may require other tasks to be executed first. For example, when processing message 1 of the current service message queue (i.e., the source service message queue), additional tasks are required. A destination service message queue processes message 2 first. Therefore, the current service message queue can apply for message 2 and send it to the destination service message queue to trigger an interrupt to process message 2 first. After completing the processing of message 2, exit the interrupt again. Process message 1.
请参阅图7,可选地,步骤0121:处理目标服务消息队列的消息,包括:Please refer to Figure 7. Optionally, step 0121: Process messages in the target service message queue, including:
步骤01212:在待处理消息被处理完的情况下,释放带有消息描述符的待处理消息到空闲消息队列。Step 01212: After the pending message is processed, release the pending message with the message descriptor to the idle message queue.
具体地,在待处理消息被处理完的情况下,待处理消息的消息描述符就不应该再占用***资源,如待处理消息的消息描述符需要从目标服务消息队列中再次释放到空闲消息队列,释放待处理消息的消息描述符到空闲消息队列具体可以是,将消息描述符中的描述符地址中存储的信息以及消息体地址中存储的信息均删除,以腾出内存空间,并将消息描述符再次入栈到空闲消息队列,例如将消息描述符的地址入栈到消息描述符队列的队尾,将消息体地址入栈到消息体队列的队尾,如此,空闲消息队列能够实现消息的申请、分配以及回收。Specifically, after the message to be processed is processed, the message descriptor of the message to be processed should no longer occupy system resources. For example, the message descriptor of the message to be processed needs to be released from the target service message queue to the idle message queue again. , releasing the message descriptor of the pending message to the idle message queue. Specifically, the information stored in the descriptor address in the message descriptor and the information stored in the message body address are deleted to free up memory space, and the message is The descriptor is pushed to the idle message queue again, for example, the address of the message descriptor is pushed to the end of the message descriptor queue, and the message body address is pushed to the end of the message body queue. In this way, the idle message queue can realize the message application, distribution and recycling.
可选地,在未接收到待处理消息的情况下,根据每个服务消息队列对应的中断源的中断优先级,依次发送服务消息队列的消息到对应的消息处理实体中进行处理,消息处理实体对应至少一个服务消息队列。Optionally, when no message to be processed is received, according to the interrupt priority of the interrupt source corresponding to each service message queue, messages in the service message queue are sent to the corresponding message processing entity for processing in sequence. The message processing entity Corresponds to at least one service message queue.
可以理解,处理器中的消息处理实体的数量是有限的,而服务消息队列的数量则可根据***的中断优先级的设置来确定,如本申请中,服务消息队列的数量一般远大于消息处理实体的数量,因此,一个消息处理实体可对应多个服务消息队列,如图8所示,服务消息队列1-Z按照中断优先级从低到高排列,服务消息队列1和2对应消息处理实体1,服务消息队列3到Z(Z为整数且大于3)则对应服务消息实体2。It can be understood that the number of message processing entities in the processor is limited, and the number of service message queues can be determined according to the interrupt priority setting of the system. For example, in this application, the number of service message queues is generally much larger than the number of message processing entities. The number of entities. Therefore, one message processing entity can correspond to multiple service message queues. As shown in Figure 8, service message queues 1-Z are arranged according to interrupt priority from low to high. Service message queues 1 and 2 correspond to message processing entities. 1. Service message queues 3 to Z (Z is an integer and greater than 3) correspond to service message entity 2.
以消息处理实体1处理服务消息队列1和2为例,在未接收到待处理消息的情况下,会按照中断优先级从高到低依次发送服务消息队列2和1的消息到对应的消息处理实体1中进行处理,使得消息处理实体1先处理服务消息队列2的消息,再处理服务消息队列1的消息。而在接收到待处理消息,触发中断后,则会判断待处理消息对应的目标服务消息队列的中断优先级是否大于当前处理的当前服务消息队列的中断优先级。例如,当前服务消息队列为服务消息队列1,目标服务消息队列为服务消息队列2,则由于服务消息队列2的中断优先级大于服务消息队列1的中断优先级,则消息处理实体1会挂起服务消息队列1,从而处理目标服务消息队列。Take the message processing entity 1 processing service message queues 1 and 2 as an example. If no pending messages are received, the messages in service message queues 2 and 1 will be sent to the corresponding message processing in order from high to low according to the interrupt priority. Processing is performed in entity 1, so that message processing entity 1 first processes messages in service message queue 2, and then processes messages in service message queue 1. After receiving a message to be processed and triggering an interrupt, it will be determined whether the interrupt priority of the target service message queue corresponding to the message to be processed is greater than the interrupt priority of the current service message queue currently being processed. For example, the current service message queue is service message queue 1, and the target service message queue is service message queue 2. Since the interrupt priority of service message queue 2 is greater than the interrupt priority of service message queue 1, message processing entity 1 will hang. Service message queue 1, thereby processing the target service message queue.
本申请实施方式的调度方法,相较于现有的软件操作***和硬件多线程的实时可抢占多任务处理功能而言,通过利用***自带的中断控制器实现任务调度,大量的减少了***消耗的软硬件开销的同时,简化了***设计,提高了***的可靠性。Compared with the real-time preemptible multi-task processing function of existing software operating systems and hardware multi-threads, the scheduling method of the embodiment of the present application realizes task scheduling by using the system's own interrupt controller, which greatly reduces the system cost. While consuming software and hardware overhead, it simplifies system design and improves system reliability.
且本申请中的调度器设计,可支持服务消息队列间的优先级抢占及通信;优先级抢占禁止,以实现资源一致性保护;并可以实现消息资源的申请、分配与释放等调度功能,同时由于本申请的服务消息队列中的待处理消息是一次性压栈或出栈,***运行时开销的占比将随着***内部控制任务间消息交互频率的上升而降低。Moreover, the scheduler design in this application can support priority preemption and communication between service message queues; priority preemption is prohibited to achieve resource consistency protection; and can realize scheduling functions such as application, allocation and release of message resources, and at the same time Since the messages to be processed in the service message queue of this application are pushed or popped out of the stack at one time, the proportion of system runtime overhead will decrease as the frequency of message interaction between internal control tasks in the system increases.
为便于更好的实施本申请实施例的调度方法,本申请实施例还提供一种调度装置10。请参阅图9,该调度装置10可以包括:In order to facilitate better implementation of the scheduling method in the embodiment of the present application, the embodiment of the present application also provides a scheduling device 10. Referring to Figure 9, the scheduling device 10 may include:
发送模块11,用于在接收到待处理消息的情况下,将待处理消息发送到对应的目标服务消息队列,以使得目标服务消息队列在中断控制器中对应的中断源产生中断信号;The sending module 11 is configured to, when receiving a message to be processed, send the message to be processed to the corresponding target service message queue, so that the target service message queue generates an interrupt signal at the corresponding interrupt source in the interrupt controller;
确定模块12,用于根据中断信号对应的中断源的第一中断优先级和当前处理的当前服务消息队列对应的中断源的第二中断优先级,确定待处理消息的处理策略。The determination module 12 is configured to determine the processing strategy of the message to be processed based on the first interrupt priority of the interrupt source corresponding to the interrupt signal and the second interrupt priority of the interrupt source corresponding to the current service message queue currently being processed.
确定模块12具体用于:Determine module 12 is specifically used for:
在第一中断优先级大于第二中断优先级的情况下,挂起当前服务消息队列的消息,并处理目标服务消息队列的消息;When the first interrupt priority is greater than the second interrupt priority, suspend the messages in the current service message queue and process the messages in the target service message queue;
在第一中断优先级小于或等于第二中断优先级的情况下,继续处理当前服务消息队列的消息。When the first interrupt priority is less than or equal to the second interrupt priority, continue processing the messages currently serving the message queue.
确定模块12具体还用于:Determining module 12 is also specifically used for:
根据第一中断优先级、第二中断优先级和当前服务消息队列对应的中断源是否支持抢 占,确定待处理消息的处理策略。The processing strategy for the messages to be processed is determined based on the first interrupt priority, the second interrupt priority and whether the interrupt source corresponding to the current service message queue supports preemption.
确定模块12具体还用于:Determining module 12 is also specifically used for:
在第一中断优先级大于第二中断优先级且当前服务消息队列对应的中断源支持抢占的情况下,挂起当前服务消息队列的消息,并处理目标服务消息队列的消息;When the first interrupt priority is greater than the second interrupt priority and the interrupt source corresponding to the current service message queue supports preemption, suspend the messages in the current service message queue and process the messages in the target service message queue;
在第一中断优先级小于或等于第二中断优先级或当前服务消息队列对应的中断源禁止抢占的情况下,继续处理当前服务消息队列的消息。When the first interrupt priority is less than or equal to the second interrupt priority or the interrupt source corresponding to the current service message queue prohibits preemption, the messages in the current service message queue continue to be processed.
确定模块12具体还用于对当前服务消息队列进行压栈处理。Specifically, the determination module 12 is also used to push the current service message queue onto the stack.
调度装置10还包括:The scheduling device 10 also includes:
获取模块13,用于从空闲消息队列中获取待处理消息对应的消息描述符;The acquisition module 13 is used to obtain the message descriptor corresponding to the message to be processed from the idle message queue;
发送模块11具体用于将带有消息描述符的待处理消息发送到对应的目标服务消息队列。The sending module 11 is specifically configured to send the pending message with the message descriptor to the corresponding target service message queue.
获取模块13具体用于:Obtain module 13 is specifically used for:
从消息描述符队列获取消息描述符的地址,以存储描述信息;Get the address of the message descriptor from the message descriptor queue to store the description information;
在消息体的内容不为空的情况下,从消息体队列中获取消息体地址,以存储消息体;When the content of the message body is not empty, obtain the message body address from the message body queue to store the message body;
封装消息描述符的地址和消息体地址,以生成消息描述符。Encapsulate the address of the message descriptor and the address of the message body to generate the message descriptor.
调度装置10还包括:The scheduling device 10 also includes:
初始化模块14,用于初始化消息描述符队列中每个消息描述符的地址、及消息体队列中的每个消息体地址。The initialization module 14 is used to initialize the address of each message descriptor in the message descriptor queue and the address of each message body in the message body queue.
确定模块12具体还用于:Determining module 12 is also specifically used for:
发送带有消息描述符的待处理消息到对应的消息处理实体,以使得消息处理实体获取消息标识对应的预设处理函数及消息体地址对应的消息体,并根据预设处理函数处理消息体。Send the message to be processed with the message descriptor to the corresponding message processing entity, so that the message processing entity obtains the preset processing function corresponding to the message identifier and the message body corresponding to the message body address, and processes the message body according to the preset processing function.
调度装置10还包括:The scheduling device 10 also includes:
接收模块15,用于在消息处理实体根据预设处理函数处理消息体的情况下,接收消息处理实体发送到目的服务消息队列的消息,以使得中断控制器产生与目的服务消息队列对应的中断源的中断信号。The receiving module 15 is configured to receive the message sent by the message processing entity to the destination service message queue when the message processing entity processes the message body according to the preset processing function, so that the interrupt controller generates an interrupt source corresponding to the destination service message queue. interrupt signal.
调度装置10还包括:The scheduling device 10 also includes:
释放模块16,用于在待处理消息被处理完的情况下,释放带有消息描述符的待处理消息到空闲消息队列。The release module 16 is used to release the pending message with the message descriptor to the idle message queue when the pending message is processed.
调度装置10还包括:The scheduling device 10 also includes:
处理模块17,用于在未接收到待处理消息的情况下,根据每个服务消息队列对应的中断源的中断优先级,依次发送服务消息队列的消息到对应的消息处理实体中进行处理,消息处理实体对应至少一个服务消息队列。The processing module 17 is configured to sequentially send messages from the service message queue to the corresponding message processing entity for processing according to the interrupt priority of the interrupt source corresponding to each service message queue when no message to be processed is received. The processing entity corresponds to at least one service message queue.
上述调度装置10中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各个模块可以以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行上述各个模块对应的操作。Each module in the above-mentioned scheduling device 10 can be implemented in whole or in part by software, hardware, and combinations thereof. Each of the above modules may be embedded in or independent of the processor of the computer device in the form of hardware, or may be stored in the memory of the computer device in the form of software so that the processor can call and execute operations corresponding to the above modules.
请参阅图10,本申请实施方式的芯片40设置在电子设备100内,并与电子设备100的中断控制器50连接。芯片40用于执行上述任意一种实施方式的调度方法,为了简洁,在此不再赘述。Referring to FIG. 10 , the chip 40 according to the embodiment of the present application is disposed in the electronic device 100 and connected to the interrupt controller 50 of the electronic device 100 . The chip 40 is used to execute the scheduling method in any of the above embodiments. For the sake of simplicity, details will not be described again here.
请再次参阅图10,本申请实施方式的电子设备100包括处理器30。处理器30用于执行上述任意一种实施方式的调度方法,为了简洁,在此不再赘述。Please refer to FIG. 10 again. The electronic device 100 according to the embodiment of the present application includes a processor 30 . The processor 30 is configured to execute the scheduling method in any of the above embodiments. For the sake of simplicity, details will not be described again here.
其中,电子设备100可以是移动电话,智能电话,个人数字助理(personal digital assistants,PDA),平板电脑和视频游戏设备,便携式终端(例如笔记本电脑),或较大尺寸的设备(例如台式计算机和电视)。Wherein, the electronic device 100 may be a mobile phone, a smart phone, a personal digital assistant (PDA), a tablet computer and a video game device, a portable terminal (such as a notebook computer), or a larger-sized device (such as a desktop computer and a computer). television).
请参阅图11,本申请实施方式还提供了一种计算机可读存储介质300,其上存储有计 算机程序310,计算机程序310被处理器30执行的情况下,实现上述任意一种实施方式的调度方法的步骤,为了简洁,在此不再赘述。Please refer to Figure 11. The embodiment of the present application also provides a computer-readable storage medium 300 on which a computer program 310 is stored. When the computer program 310 is executed by the processor 30, the scheduling of any of the above embodiments is implemented. For the sake of brevity, the steps of the method will not be repeated here.
可以理解,计算机程序310包括计算机程序代码。计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。计算机可读存储介质可以包括:能够携带计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、以及软件分发介质等。It will be appreciated that computer program 310 includes computer program code. Computer program code can be in the form of source code, object code, executable file or some intermediate form, etc. Computer-readable storage media can include: any entity or device that can carry computer program code, recording media, USB flash drives, mobile hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM, Read-Only Memory), random access memory Access memory (RAM, Random Access Memory), and software distribution media, etc.
在本说明书的描述中,参考术语“一个实施方式”、“一些实施方式”、“示意性实施方式”、“示例”、“具体示例”或“一些示例”等的描述意指结合所述实施方式或示例描述的具体特征、结构、材料或者特点包含于本申请的至少一个实施方式或示例中。在本说明书中,对上述术语的示意性表述不一定指的是相同的实施方式或示例。而且,描述的具体特征、结构、材料或者特点可以在任何的一个或多个实施方式或示例中以合适的方式结合。此外,在不相互矛盾的情况下,本领域的技术人员可以将本说明书中描述的不同实施例或示例以及不同实施例或示例的特征进行结合和组合。In the description of this specification, reference to the description of the terms "one embodiment," "some embodiments," "illustrative embodiments," "examples," "specific examples," or "some examples" is intended to be in conjunction with the described implementation. A specific feature, structure, material, or characteristic described in a manner or example is included in at least one embodiment or example of the present application. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, those skilled in the art may combine and combine different embodiments or examples and features of different embodiments or examples described in this specification unless they are inconsistent with each other.
流程图中或在此以其他方式描述的任何过程或方法描述可以被理解为,表示包括一个或更多个用于实现特定逻辑功能或过程的步骤的可执行指令的代码的模块、片段或部分,并且本申请的优选实施方式的范围包括另外的实现,其中可以不按所示出或讨论的顺序,包括根据所涉及的功能按基本同时的方式或按相反的顺序,来执行功能,这应被本申请的实施例所属技术领域的技术人员所理解。Any process or method descriptions in flowcharts or otherwise described herein may be understood to represent modules, segments, or portions of code that include one or more executable instructions for implementing the specified logical functions or steps of the process. , and the scope of the preferred embodiments of the present application includes additional implementations in which functions may be performed out of the order shown or discussed, including in a substantially simultaneous manner or in the reverse order, depending on the functionality involved, which shall It should be understood by those skilled in the technical field to which the embodiments of this application belong.
尽管上面已经示出和描述了本申请的实施方式,可以理解的是,上述实施方式是示例性的,不能理解为对本申请的限制,本领域的普通技术人员在本申请的范围内可以对上述实施方式进行变化、修改、替换和变型。Although the embodiments of the present application have been shown and described above, it can be understood that the above-mentioned embodiments are exemplary and cannot be construed as limitations of the present application. Those of ordinary skill in the art can make modifications to the above-mentioned embodiments within the scope of the present application. The embodiments are subject to changes, modifications, substitutions and variations.

Claims (27)

  1. 一种调度方法,其特征在于,包括:A scheduling method, characterized by including:
    在接收到待处理消息的情况下,将所述待处理消息发送到对应的目标服务消息队列,以使得中断控制器产生与所述目标服务消息队列对应的中断源的中断信号;When a message to be processed is received, the message to be processed is sent to the corresponding target service message queue, so that the interrupt controller generates an interrupt signal of the interrupt source corresponding to the target service message queue;
    根据所述中断信号对应的中断源的第一中断优先级和当前处理的当前服务消息队列对应的中断源的第二中断优先级,确定所述待处理消息的处理策略。The processing strategy for the message to be processed is determined according to the first interrupt priority level of the interrupt source corresponding to the interrupt signal and the second interrupt priority level of the interrupt source corresponding to the current service message queue currently being processed.
  2. 根据权利要求1所述的调度方法,其特征在于,所述根据所述中断信号对应的中断源的第一中断优先级和当前处理的消息对应的中断源的第二中断优先级,确定所述待处理消息的处理策略,包括:The scheduling method according to claim 1, wherein the determination of the interrupt source is based on the first interrupt priority of the interrupt source corresponding to the interrupt signal and the second interrupt priority of the interrupt source corresponding to the currently processed message. Processing strategies for pending messages, including:
    在所述第一中断优先级大于所述第二中断优先级的情况下,挂起所述当前服务消息队列的消息,并处理所述目标服务消息队列的消息;When the first interrupt priority is greater than the second interrupt priority, suspend the messages in the current service message queue and process the messages in the target service message queue;
    在所述第一中断优先级小于或等于所述第二中断优先级的情况下,继续处理所述当前服务消息队列的消息。If the first interrupt priority is less than or equal to the second interrupt priority, continue processing the messages of the current service message queue.
  3. 根据权利要求1所述的调度方法,其特征在于,所述根据所述中断信号对应的中断源的第一中断优先级和当前处理的当前服务消息队列对应的中断源的第二中断优先级,确定所述待处理消息的处理策略,还包括:The scheduling method according to claim 1, wherein the first interrupt priority level of the interrupt source corresponding to the interrupt signal and the second interrupt priority level of the interrupt source corresponding to the current service message queue currently processed, Determining the processing strategy for the message to be processed also includes:
    根据所述第一中断优先级、所述第二中断优先级和所述当前服务消息队列对应的中断源是否支持抢占,确定所述待处理消息的处理策略。The processing strategy for the message to be processed is determined according to the first interrupt priority, the second interrupt priority and whether the interrupt source corresponding to the current service message queue supports preemption.
  4. 根据权利要求3所述的调度方法,其特征在于,所述根据所述第一中断优先级、所述第二中断优先级和所述当前服务消息队列对应的中断源是否支持抢占,确定所述待处理消息的处理策略,包括:The scheduling method according to claim 3, characterized in that the determination of the interrupt source is based on the first interrupt priority, the second interrupt priority and whether the interrupt source corresponding to the current service message queue supports preemption. Processing strategies for pending messages, including:
    在所述第一中断优先级大于所述第二中断优先级且所述当前服务消息队列对应的中断源支持抢占的情况下,挂起所述当前服务消息队列的消息,并处理所述目标服务消息队列的消息;When the first interrupt priority is greater than the second interrupt priority and the interrupt source corresponding to the current service message queue supports preemption, the messages in the current service message queue are suspended and the target service is processed. Messages from the message queue;
    在所述第一中断优先级小于或等于所述第二中断优先级或所述当前服务消息队列对应的中断源禁止抢占的情况下,继续处理所述当前服务消息队列的消息。When the first interrupt priority is less than or equal to the second interrupt priority or the interrupt source corresponding to the current service message queue prohibits preemption, continue processing the messages of the current service message queue.
  5. 根据权利要求2或4所述的调度方法,其特征在于,所述挂起所述当前服务消息队列的消息,包括:The scheduling method according to claim 2 or 4, characterized in that the suspension of messages in the current service message queue includes:
    对所述当前服务消息队列进行压栈处理。Push the current service message queue onto the stack.
  6. 根据权利要求2或4所述的调度方法,其特征在于,在发送所述待处理消息到的所述目标服务消息队列之前,还包括:The scheduling method according to claim 2 or 4, characterized in that, before sending the message to be processed to the target service message queue, it further includes:
    从空闲消息队列中获取所述待处理消息对应的消息描述符;Obtain the message descriptor corresponding to the message to be processed from the idle message queue;
    所述将所述待处理消息发送到对应的目标服务消息队列,包括:The sending of the pending message to the corresponding target service message queue includes:
    将带有所述消息描述符的所述待处理消息发送到对应的目标服务消息队列。Send the pending message with the message descriptor to the corresponding target service message queue.
  7. 根据权利要求6所述的调度方法,其特征在于,所述待处理消息包括描述信息和消息体,所述空闲消息队列包括消息描述符队列和消息体队列,所述从空闲消息队列中获取所述待处理消息对应的消息描述符,包括:The scheduling method according to claim 6, characterized in that the message to be processed includes description information and a message body, the idle message queue includes a message descriptor queue and a message body queue, and the said message is obtained from the idle message queue. Describe the message descriptor corresponding to the message to be processed, including:
    从所述消息描述符队列获取所述消息描述符的地址,以存储所述描述信息;Obtain the address of the message descriptor from the message descriptor queue to store the description information;
    在所述消息体的内容不为空的情况下,从所述消息体队列中获取消息体地址,以存储 所述消息体;When the content of the message body is not empty, obtain the message body address from the message body queue to store the message body;
    封装所述消息描述符的地址和所述消息体地址,以生成所述消息描述符。The address of the message descriptor and the message body address are encapsulated to generate the message descriptor.
  8. 根据权利要求6所述的调度方法,其特征在于,还包括:The scheduling method according to claim 6, further comprising:
    初始化所述消息描述符队列中每个消息描述符的地址、及所述消息体队列中的每个消息体地址。Initialize the address of each message descriptor in the message descriptor queue and the address of each message body in the message body queue.
  9. 根据权利要求6所述的调度方法,其特征在于,所述消息描述符包括消息标识和消息体地址,所述处理所述目标服务消息队列的消息,包括:The scheduling method according to claim 6, wherein the message descriptor includes a message identifier and a message body address, and processing the message of the target service message queue includes:
    发送带有所述消息描述符的所述待处理消息到对应的所述消息处理实体,以使得所述消息处理实体获取所述消息标识对应的预设处理函数及所述消息体地址对应的消息体,并根据所述预设处理函数处理所述消息体。Send the message to be processed with the message descriptor to the corresponding message processing entity, so that the message processing entity obtains the preset processing function corresponding to the message identifier and the message corresponding to the message body address. body, and process the message body according to the preset processing function.
  10. 根据权利要求9所述的调度方法,其特征在于,还包括:The scheduling method according to claim 9, further comprising:
    在所述消息处理实体根据所述预设处理函数处理所述消息体的情况下,接收所述消息处理实体发送到目的服务消息队列的消息,以使得所述中断控制器产生与所述目的服务消息队列对应的中断源的中断信号。When the message processing entity processes the message body according to the preset processing function, receive the message sent by the message processing entity to the destination service message queue, so that the interrupt controller generates a message related to the destination service. The interrupt signal of the interrupt source corresponding to the message queue.
  11. 根据权利要求6所述的调度方法,其特征在于,所述处理所述目标服务消息队列的消息,还包括:The scheduling method according to claim 6, wherein the processing of messages in the target service message queue further includes:
    在所述待处理消息被处理完的情况下,释放带有所述消息描述符的所述待处理消息到所述空闲消息队列。When the pending message is processed, the pending message with the message descriptor is released to the idle message queue.
  12. 根据权利要求1所述的调度方法,其特征在于,所述调度方法还包括:The scheduling method according to claim 1, characterized in that the scheduling method further includes:
    在未接收到所述待处理消息的情况下,根据每个服务消息队列对应的中断源的中断优先级,依次发送所述服务消息队列的消息到对应的消息处理实体中进行处理,所述消息处理实体对应至少一个所述服务消息队列。When the message to be processed is not received, the messages of the service message queue are sent to the corresponding message processing entity for processing in sequence according to the interrupt priority of the interrupt source corresponding to each service message queue. The processing entity corresponds to at least one of the service message queues.
  13. 一种调度装置,其特征在于,所述装置包括:A scheduling device, characterized in that the device includes:
    发送模块,用于在接收到待处理消息的情况下,将所述待处理消息发送到对应的目标服务消息队列,以使得中断控制器产生与所述目标服务消息队列对应的中断源的中断信号;A sending module, configured to, when receiving a message to be processed, send the message to be processed to the corresponding target service message queue, so that the interrupt controller generates an interrupt signal of the interrupt source corresponding to the target service message queue. ;
    确定模块,用于根据所述中断信号对应的中断源的第一中断优先级和当前处理的当前服务消息队列对应的中断源的第二中断优先级,确定所述待处理消息的处理策略。A determining module configured to determine a processing strategy for the message to be processed based on the first interrupt priority of the interrupt source corresponding to the interrupt signal and the second interrupt priority of the interrupt source corresponding to the current service message queue currently being processed.
  14. 一种芯片,其特征在于,所述芯片与电子设备的中断控制器连接,所述芯片用于在接收到待处理消息的情况下,将所述待处理消息发送到对应的目标服务消息队列,以使得所述中断控制器产生与所述目标服务消息队列对应的中断源的中断信号;及根据所述中断信号对应的中断源的第一中断优先级和当前处理的当前服务消息队列对应的中断源的第二中断优先级,确定所述待处理消息的处理策略。A chip, characterized in that the chip is connected to an interrupt controller of an electronic device, and the chip is used to send a message to be processed to a corresponding target service message queue when receiving a message to be processed, So that the interrupt controller generates an interrupt signal of the interrupt source corresponding to the target service message queue; and according to the first interrupt priority of the interrupt source corresponding to the interrupt signal and the interrupt corresponding to the current service message queue currently processed The second interrupt priority level of the source determines the processing strategy of the message to be processed.
  15. 一种电子设备,其特征在于,包括处理器,所述处理器用于在接收到待处理消息的情况下,将所述待处理消息发送到对应的目标服务消息队列,以使得中断控制器产生与所述目标服务消息队列对应的中断源的中断信号;根据所述中断信号对应的中断源的第一中断优先级和当前处理的当前服务消息队列对应的中断源的第二中断优先级,确定所述待处理消息的处理策略。An electronic device, characterized in that it includes a processor, and the processor is configured to, when receiving a message to be processed, send the message to be processed to a corresponding target service message queue, so that the interrupt controller generates and The interrupt signal of the interrupt source corresponding to the target service message queue is determined according to the first interrupt priority of the interrupt source corresponding to the interrupt signal and the second interrupt priority of the interrupt source corresponding to the current service message queue currently being processed. Describe the processing strategy for pending messages.
  16. 根据权利要求15所述的电子设备,其特征在于,所述处理器还用于在所述第一中断优先级大于所述第二中断优先级的情况下,挂起所述当前服务消息队列的消息,并处理所述目标服务消息队列的消息;在所述第一中断优先级小于或等于所述第二中断优先级的情况下,继续处理所述当前服务消息队列的消息。The electronic device according to claim 15, wherein the processor is further configured to suspend the current service message queue when the first interrupt priority is greater than the second interrupt priority. message, and process the message of the target service message queue; when the first interrupt priority is less than or equal to the second interrupt priority, continue to process the message of the current service message queue.
  17. 根据权利要求15所述的电子设备,其特征在于,所述处理器还用于根据所述第一中断优先级、所述第二中断优先级和所述当前服务消息队列对应的中断源是否支持抢占,确定所述待处理消息的处理策略。The electronic device according to claim 15, characterized in that the processor is further configured to determine whether the interrupt source corresponding to the first interrupt priority, the second interrupt priority and the current service message queue supports Preempt to determine the processing strategy for the message to be processed.
  18. 根据权利要求17所述的电子设备,其特征在于,所述处理器还用于在所述第一中断优先级大于所述第二中断优先级且所述当前服务消息队列对应的中断源支持抢占的情况下,挂起所述当前服务消息队列的消息,并处理所述目标服务消息队列的消息;在所述第一中断优先级小于或等于所述第二中断优先级或所述当前服务消息队列对应的中断源禁止抢占的情况下,继续处理所述当前服务消息队列的消息。The electronic device according to claim 17, wherein the processor is further configured to support preemption when the first interrupt priority is greater than the second interrupt priority and the interrupt source corresponding to the current service message queue supports preemption. In the case of , suspend the messages in the current service message queue and process the messages in the target service message queue; when the first interrupt priority is less than or equal to the second interrupt priority or the current service message When the interrupt source corresponding to the queue prohibits preemption, the messages in the current service message queue continue to be processed.
  19. 根据权利要求16或18所述的电子设备,其特征在于,所述处理器还用于对所述当前服务消息队列进行压栈处理。The electronic device according to claim 16 or 18, characterized in that the processor is further configured to push the current service message queue into a stack.
  20. 根据权利要求16或18所述的电子设备,其特征在于,在发送所述待处理消息到的所述目标服务消息队列之前,所述处理器还用于从空闲消息队列中获取所述待处理消息对应的消息描述符;将带有所述消息描述符的所述待处理消息发送到对应的目标服务消息队列。The electronic device according to claim 16 or 18, characterized in that, before sending the message to be processed to the target service message queue, the processor is further configured to obtain the message to be processed from an idle message queue. The message descriptor corresponding to the message; send the pending message with the message descriptor to the corresponding target service message queue.
  21. 根据权利要求20所述的电子设备,其特征在于,所述待处理消息包括描述信息和消息体,所述空闲消息队列包括消息描述符队列和消息体队列,所述处理器还用于从所述消息描述符队列获取所述消息描述符的地址,以存储所述描述信息;在所述消息体的内容不为空的情况下,从所述消息体队列中获取消息体地址,以存储所述消息体;封装所述消息描述符的地址和所述消息体地址,以生成所述消息描述符。The electronic device according to claim 20, characterized in that the message to be processed includes description information and a message body, the idle message queue includes a message descriptor queue and a message body queue, and the processor is further configured to obtain the message from all messages. The message descriptor queue obtains the address of the message descriptor to store the description information; when the content of the message body is not empty, the message body address is obtained from the message body queue to store the message body address. the message body; encapsulating the address of the message descriptor and the message body address to generate the message descriptor.
  22. 根据权利要求20所述的电子设备,其特征在于,所述处理器还用于初始化所述消息描述符队列中每个消息描述符的地址、及所述消息体队列中的每个消息体地址。The electronic device according to claim 20, wherein the processor is further configured to initialize the address of each message descriptor in the message descriptor queue and the address of each message body in the message body queue. .
  23. 根据权利要求20所述的电子设备,其特征在于,所述消息描述符包括消息标识和消息体地址,所述处理器还用于发送带有所述消息描述符的所述待处理消息到对应的所述消息处理实体,以使得所述消息处理实体获取所述消息标识对应的预设处理函数及所述消息体地址对应的消息体,并根据所述预设处理函数处理所述消息体。The electronic device according to claim 20, wherein the message descriptor includes a message identifier and a message body address, and the processor is further configured to send the to-be-processed message with the message descriptor to a corresponding The message processing entity, so that the message processing entity obtains the preset processing function corresponding to the message identifier and the message body corresponding to the message body address, and processes the message body according to the preset processing function.
  24. 根据权利要求23所述的电子设备,其特征在于,所述处理器还用于在所述消息处理实体根据所述预设处理函数处理所述消息体的情况下,接收所述消息处理实体发送到目的服务消息队列的消息,以使得所述中断控制器产生与所述目的服务消息队列对应的中断源的中断信号。The electronic device according to claim 23, wherein the processor is further configured to receive the message body sent by the message processing entity when the message processing entity processes the message body according to the preset processing function. message to the destination service message queue, so that the interrupt controller generates an interrupt signal of an interrupt source corresponding to the destination service message queue.
  25. 根据权利要求20所述的电子设备,其特征在于,所述处理器还用于在所述待处理消息被处理完的情况下,释放带有所述消息描述符的所述待处理消息到所述空闲消息队列。The electronic device according to claim 20, wherein the processor is further configured to, when the message to be processed is completed, release the message to be processed with the message descriptor to the Describe the idle message queue.
  26. 根据权利要求15所述的电子设备,其特征在于,所述处理器还用于在未接收到所述待处理消息的情况下,根据每个服务消息队列对应的中断源的中断优先级,依次发送所述服务消息队列的消息到对应的消息处理实体中进行处理,所述消息处理实体对应至少一个所述服务消息队列。The electronic device according to claim 15, characterized in that the processor is further configured to, in the case where the message to be processed is not received, according to the interrupt priority of the interrupt source corresponding to each service message queue, sequentially Send messages from the service message queue to a corresponding message processing entity for processing, and the message processing entity corresponds to at least one of the service message queues.
  27. 一种计算机程序的非易失性计算机可读存储介质,其特征在于,当所述计算机程序被一个或多个处理器执行时,实现权利要求1-12中任一项所述的调度方法。A non-volatile computer-readable storage medium of a computer program, characterized in that when the computer program is executed by one or more processors, the scheduling method according to any one of claims 1-12 is implemented.
PCT/CN2022/141062 2022-06-23 2022-12-22 Scheduling method and apparatus, chip, electronic device, and storage medium WO2023246042A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210724490.4 2022-06-23
CN202210724490.4A CN115167996A (en) 2022-06-23 2022-06-23 Scheduling method and device, chip, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
WO2023246042A1 true WO2023246042A1 (en) 2023-12-28

Family

ID=83488279

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/141062 WO2023246042A1 (en) 2022-06-23 2022-12-22 Scheduling method and apparatus, chip, electronic device, and storage medium

Country Status (2)

Country Link
CN (1) CN115167996A (en)
WO (1) WO2023246042A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115167996A (en) * 2022-06-23 2022-10-11 哲库科技(北京)有限公司 Scheduling method and device, chip, electronic equipment and storage medium
CN115426209B (en) * 2022-11-07 2023-02-10 湖南三湘银行股份有限公司 High-reliability message queue broadcast control method based on message processing
CN115981811B (en) * 2022-12-19 2024-03-15 上海新迪数字技术有限公司 Task scheduling method, system, electronic device and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030208521A1 (en) * 2002-05-02 2003-11-06 International Business Machines Corporation System and method for thread scheduling with weak preemption policy
US20050015768A1 (en) * 2002-12-31 2005-01-20 Moore Mark Justin System and method for providing hardware-assisted task scheduling
CN104915254A (en) * 2014-12-31 2015-09-16 杰瑞石油天然气工程有限公司 Embedded system multi-task scheduling method and system
CN111475312A (en) * 2019-09-12 2020-07-31 北京东土科技股份有限公司 Message driving method and device based on real-time operating system
CN114579285A (en) * 2022-04-29 2022-06-03 武汉深之度科技有限公司 Task running system and method and computing device
CN115167996A (en) * 2022-06-23 2022-10-11 哲库科技(北京)有限公司 Scheduling method and device, chip, electronic equipment and storage medium
CN115237556A (en) * 2022-06-23 2022-10-25 哲库科技(北京)有限公司 Scheduling method and device, chip, electronic equipment and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030208521A1 (en) * 2002-05-02 2003-11-06 International Business Machines Corporation System and method for thread scheduling with weak preemption policy
US20050015768A1 (en) * 2002-12-31 2005-01-20 Moore Mark Justin System and method for providing hardware-assisted task scheduling
CN104915254A (en) * 2014-12-31 2015-09-16 杰瑞石油天然气工程有限公司 Embedded system multi-task scheduling method and system
CN111475312A (en) * 2019-09-12 2020-07-31 北京东土科技股份有限公司 Message driving method and device based on real-time operating system
CN114579285A (en) * 2022-04-29 2022-06-03 武汉深之度科技有限公司 Task running system and method and computing device
CN115167996A (en) * 2022-06-23 2022-10-11 哲库科技(北京)有限公司 Scheduling method and device, chip, electronic equipment and storage medium
CN115237556A (en) * 2022-06-23 2022-10-25 哲库科技(北京)有限公司 Scheduling method and device, chip, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN115167996A (en) 2022-10-11

Similar Documents

Publication Publication Date Title
WO2023246042A1 (en) Scheduling method and apparatus, chip, electronic device, and storage medium
WO2023246044A1 (en) Scheduling method and apparatus, chip, electronic device, and storage medium
EP2652615B1 (en) Graphics compute process scheduling
JP6199477B2 (en) System and method for using a hypervisor with a guest operating system and virtual processor
US8028292B2 (en) Processor task migration over a network in a multi-processor system
US8108571B1 (en) Multithreaded DMA controller
US9176795B2 (en) Graphics processing dispatch from user mode
US10242420B2 (en) Preemptive context switching of processes on an accelerated processing device (APD) based on time quanta
US20050015768A1 (en) System and method for providing hardware-assisted task scheduling
US20120229481A1 (en) Accessibility of graphics processing compute resources
US7472214B2 (en) Real-time embedded simple monitor method and computer product
JP2005235228A (en) Method and apparatus for task management in multiprocessor system
EP1769347A2 (en) Methods and apparatus for processor task migration in a multi-processor system
US20050278719A1 (en) Information processing device, process control method, and computer program
EP3770759A1 (en) Wake-up and scheduling of functions with context hints
US20120194526A1 (en) Task Scheduling
WO2022042127A1 (en) Coroutine switching method and apparatus, and device
KR101791182B1 (en) Computer system interrupt handling
US11698816B2 (en) Lock-free work-stealing thread scheduler
US10255104B2 (en) System call queue between visible and invisible computing devices
WO2023241307A1 (en) Method and apparatus for managing threads
Parikh et al. Performance parameters of RTOSs; comparison of open source RTOSs and benchmarking techniques
CN112114967B (en) GPU resource reservation method based on service priority
WO2004061663A2 (en) System and method for providing hardware-assisted task scheduling
CN114911538A (en) Starting method of running system and computing equipment

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

Country of ref document: EP

Kind code of ref document: A1