Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re^2: Code brewing for the upcoming MCE 10 year anniversaryby marioroy (Prior) |
on Nov 04, 2022 at 06:53 UTC ( [id://11147959]=note: print w/replies, xml ) | Need Help?? |
I have always wanted a Barrier module to complement MCE::Child, MCE::Hobo, or threads. The module works on Unix, Cygwin, including Windows. Tonight, I enhanced MCE::Simple to support the spawn loop syntax.
Which is transposed to the following. The ident argument defaults to blank '' if omitted.
At this moment, the code is 100% completed in MCE::Barrier, MCE::Semaphore, and MCE::Simple. It's a relief. I tested MCE::Barrier on Linux with 4,000 workers, trying to break it :). All the one's come first, the two's, followed by three's and so on. Workers wait for all parties to reach the barrier.
The sync implementation in MCE is two stages; sync and unsync. MCE::Barrier's implementation is one stage with alternating semaphores (1 or 2) k = 3 - k. A limiter prevents many workers attempting read IO concurrently or simultaneously. The result is a fast implementation no matter the number of parties.
In Section
Meditations
|
|