🔒🎓 Mutex - Critical Section [HS]

by Hub Space

Version 5 (November 5, 2016)

Download (996 downloads)

Mutex - also known as binary semaphore - blocks resources and restrict the access to one process within a critical section.

Example flow: hit the start button multiple times and you will see the result. All fibers will proceed one by one. Until their critical section is done.

You could add this algorithm in any flow to enable parallel launch.
For example when you have a flow that keeps the music volume set to a user defined value/level. Two flows with different values will result in a race condition. You need to prioritize one. This could be done by mutex. One fiber will take ownership of the volume set block and the second flow needs to wait the first is done and release the lock.

I will add this to my keep volume manager and link it here. But it need advanced algorithm, because we have multiple output types and each should get its own lock. That is not possible (not practicable) unless the C&S block support dictionary. Developer will investigate.

- Version 3 has no additional functionality but comes with a refactoring to remove the give/take block.
- Version 4 rearrange the fork connections. The critical section is the 'main' fiber now. That enables us to add a 'deconstructor'.
- Version 5 deconstructor removed. Irrelevant, not needed for mutex. Please see http://llamalab.com/automate/community/flows/7917 if interested.

5.0 average rating from 3 reviews

5 stars
3
4 stars
0
3 stars
0
2 stars
0
1 star
0
Reports
0

Rate and review within the app in the Community section.