Hi yuecharlie,
FreeRTOS SMP handles yield requests from other cores (via portYIELD_CORE()) at the following places:
- Waiting to enter the critical section in
prvCheckForRunStateChange() - Checking
xYieldPendingswhen leaving the critical section - Asynchronous yield request through IPIs when task is not in the critical section
The first two synchronous handling mechanisms may not be affected, but the third is impacted by replacing IPIs with shared-memory xYieldRequests.
I can think about the following drawbacks:
Memory-related Issues
- As Richard mentioned, using shared-memory as IPIs should consider:
- Memory coherency problems
- Race condition concerns
Scheduler-related Issues
portYIELD_COREnow takes more time to take effect on other cores, resulting in:- Unpredictable context switch timing
- Increased priority inversion duration
- Delayed response to scheduling events
Performance Impacts
- Polling
xYieldRequestscauses system performance impacts including:- CPU overhead
- Increased power consumption
While this solution might work, you might need to carefully evaluate these trade-offs against your system’s requirements, especially regarding real-time constraints and performance needs.