You need to sign in or sign up before continuing.×
Beta
Threading: Boolean Flags Aren't Enough
28bp1222
Description:
Threading: Boolean flags aren't enough for synchronization
Summary
When starting off with threading sometimes it would seem that using boolean flags to protect critical sections should be enough. That's not always the case, as demonstrated with this Kata. Your task is to fix the bug so that we won't get into the critical section more than once.
Issue
The kata presents a solution, wherein your have threadCode
which is executed in some number of threads. In this code you make a call to a critical section, which should only be called by one thread at a time. The example provided is subject to a race condition which needs to be mitigated to ensure we're calling the critical section in only one thread at a time. The critical_section
may be performing significant work.
Threads
Debugging
Similar Kata:
Stats:
Created | Mar 6, 2020 |
Published | Nov 10, 2020 |
Warriors Trained | 163 |
Total Skips | 29 |
Total Code Submissions | 120 |
Total Times Completed | 28 |
C Completions | 28 |
Total Stars | 2 |
% of votes with a positive feedback rating | 71% of 12 |
Total "Very Satisfied" Votes | 6 |
Total "Somewhat Satisfied" Votes | 5 |
Total "Not Satisfied" Votes | 1 |
Total Rank Assessments | 9 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 4 kyu |
Lowest Assessed Rank | 7 kyu |