Message Transmission via Notification in Shared Memory
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
In automatic vehicle systems, the current method of data message transmission through shared memory causes idling of polling threads and resource wastage due to constant polling by subscription tasks, especially when multiple tasks subscribe to the same data message.
Innovation Solution
Implementing a message transmission method where an issuing task determines and outputs a data message, stores it in a preset storage space, and sends an issuing notification message, allowing a subscription task to read the data message from the storage space based on the notification, thereby eliminating the need for constant polling.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If subscription tasks use constant polling to check for new data messages in shared memory, then data messages can be retrieved, but polling threads idle and resources are wasted
Solution Approach 1:
The issuing task performs preliminary action by actively notifying subscription tasks when data messages are stored in shared memory. The notification mechanism is established in advance, so subscription tasks don't need to continuously poll - they are alerted only when data is actually available, eliminating idle resource consumption while ensuring reliable message retrieval
Solution Approach 2:
A feedback mechanism is introduced where the issuing task sends notification messages to subscription tasks when data messages are produced. This feedback loop allows subscription tasks to respond only when necessary (upon receiving notification), transforming the continuous polling approach into an event-driven approach that reduces resource wastage while maintaining data retrieval reliability
2Adaptability or versatility
If multiple subscription tasks poll the shared memory simultaneously, then all tasks can access data messages, but resource wastage increases significantly
Solution Approach 1:
The notification mechanism provides selective feedback to multiple subscription tasks based on actual data availability. Instead of all tasks polling simultaneously and consuming resources, only tasks that receive notifications will access the shared memory, reducing resource wastage while maintaining the ability of multiple tasks to access data messages when needed
Solution Approach 2:
The issuing task performs preliminary notification to specific subscription tasks before they need to access data. This preliminary action allows multiple subscription tasks to be coordinated efficiently - they are activated only when data is available, rather than continuously consuming resources through simultaneous polling
Data Source
AI summary
The present application provides a message transmission method and apparatus, a device and a medium. The method includes: determining and outputting, by an issuing task, a data message, storing the data message in a preset storage space, and sending an issuing notification message; and reading, by a subscription task, the data message from the preset storage space according to the issuing notification message. With embodiments of the present disclosure, transmission efficiency of the data message between the issuing task and the subscription task may be improved, and source occupancy may be reduced.

