What is the problem with shared resources

First of all most people believe that RTOS solve the determinism issues caused with shared resources. But, sorry for that, it doesn’t. The issue comes with the chosen scheduler in combination with interrupts. An interrupt stops the current execution and decide on who is next executing the program code. Let us consider two program/ program components, both access a shared variable A. The first program tries to change the current value from 0 to 10 ( A = A + 10) and the other from 0 to 5 (A = A + 5). If the scheduler stops the first program while adding the 10 and executes the send program which already adds 5, the result is 15. Those effects get even worser if modern HW capabilities are used e.g., MMU which maps virtual addresses to physical memory addresses (including temporary caching).

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *