Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance livelock example #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

KLarpen
Copy link

@KLarpen KLarpen commented Feb 14, 2023

In the video chapter related to 3-livelock.js example there is no clear evidence what livelock is and how you may notice it by that example. Had noticed in the comment section that I'm not the only one who mention that.

Current 3-livelock.js example in this repository contains looping recursion that useless by code itself. In other words there is no state that you may compare as normal working processes in difference to livelock.

I propose to extend usage example. It becomes more complex but clear to notice livelock and test the difference:

  • 7 threads
  • 6 of it executes high frequency loop (the same as in the current repository state)
  • last 7th thread executes low frequency loop with long running process (being long running isn't necessary but that way more easy to notice the complete execution of it)
  • initial 10 times frequency difference do not lead to livelock (at least on the level between high and low frequency processes, excluding the possibility of livelock among 6 high frequency ones)
  • comment with proposal to make frequency difference 100 times higher which will lead to livelock on both levels (possible highFrequencyLoop inconsistency and starvation of the lowFrequencyLoop).

Please review my proposal because I'm not an expert in parallel programming. The articles on the topic of livelock in the internet are quite confusing and controversial. The most well explained that I've found is Deadlock, Livelock and Starvation. I'm trying to figure out how to make more clear and evident test but realizes that my understanding might be wrong.

More complex but clear to notice livelock test:
- 7 threads
- 6 of it executes high frequency loop
- last 7th thread executes low frequency loop with long running process
- initial 10 times frequency difference do not lead to livelock
- comment with proposal to make frequency difference 100 times higher
which will lead to livelock

Signed-off-by: Vladyslav Karpenko <klarpen@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant