computablee / DotMP

A collection of powerful abstractions for parallel programming in .NET with an OpenMP-like API.
https://computablee.github.io/DotMP/
GNU Lesser General Public License v2.1
29 stars 7 forks source link

Rewrite `Parallel.Sections` #38

Closed computablee closed 1 year ago

computablee commented 1 year ago

There are two big things that can be done to improve how sections are currently implemented.

  1. Move the dequeue logic out of DotMP.Parallel.Sections and into the DotMP.SectionsContainer class
  2. Change the internal data structure from a Queue<T> to a ConcurrentBag<T>

The former will improve code organization, and the latter should remove an otherwise necessary lock. Additionally, a bag is a better data structure than a queue anyway.