Changeset 5d81edb for doc/theses/colby_parsons_MMAth/text
- Timestamp:
- May 31, 2023, 8:45:46 AM (22 months ago)
- Branches:
- ast-experimental, master
- Children:
- 8421d3f
- Parents:
- d8d9c115
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified doc/theses/colby_parsons_MMAth/text/channels.tex ¶
rd8d9c115 r5d81edb 300 300 Implementing a barrier is interesting because threads are both producers and consumers on the barrier-internal channels, @entryWait@ and @barWait@. 301 301 The outline for the barrier implementation starts by initially filling the @entryWait@ channel with $N$ tickets in the barrier constructor, allowing $N$ arriving threads to remove these values and enter the barrier. 302 After @entryWait@ is empty, arriving threads block when removing from @entryWait@.302 After @entryWait@ is empty, arriving threads block when removing. 303 303 However, the arriving threads that entered the barrier cannot leave the barrier until $N$ threads have arrived. 304 Hence, the entering threads block on the @barWait@ channel until the $N$th arriving thread inserts $N-1$ elements into @barWait@ to unblock the $N-1$ threads calling @remove@ on the @barWait@ channel.304 Hence, the entering threads block on the empty @barWait@ channel until the $N$th arriving thread inserts $N-1$ elements into @barWait@ to unblock the $N-1$ threads calling @remove@. 305 305 The race between these arriving threads blocking on @barWait@ and the $N$th thread inserting values into @barWait@ does not affect correctness; 306 306 \ie an arriving thread may or may not block on channel @barWait@ to get its value. 307 Finally, the last thread to remove from @barWait@ with ticket $N-2$, refills channel @entryWait@ with $N$ values to start the next group into the barrier. 307 308 308 309 Now, the two channels makes termination synchronization between producers and consumers difficult.
Note: See TracChangeset
for help on using the changeset viewer.