The difference between task, event and message in OSAL

OSAL (Operating System Abstraction Layer Operating System Abstraction Layer) (the above is my personal opinion) In OSAL, three concepts of tasks, events, and messages are proposed. The relationship between them is as follows:

  1. event: An event is an action triggered in the current system, such as pressing a button, receiving a message from another node, etc.
  2. message: The message is an encapsulation of the received event and event content. For example, if an event occurs (a message sent by another node is received), then the event number corresponding to the event and the received data will be encapsulated into The message is put into the message queue for processing by the event processing function.
  3. task: A task is a collection of functions for processing events, generally implemented by an event processing function (ProcessEvents). The protocol stack is composed of various layers. Each layer must handle various events, so an event processing function is defined for each layer. We can understand this processing function as a task, and the task extracts messages from the message queue. Extract the specific events that occurred from the message and call the corresponding specific event processing functions, such as key processing functions and so on.

To sum it up:

Process: After the event occurs –> it is packaged as a message –> stored in the message queue –> the event processing function takes out the message and performs corresponding operations.
A message is an encapsulation of data and instructions at each level.
A task is the specific details of what needs to be done.

Guess you like

Origin blog.csdn.net/weixin_44280688/article/details/103144242