The purpose is to let you distribute the work of executing agents
over some given number of threads without having to manage the details of
multi-threading. The example program shows how to use both classes to achieve the same result. The test program is invoked from the test project directory with the command line:
Output is attached. The script needs editing for individual machines as it needs to set LD_LIBRARY_PATH.
The example program takes input arguments so you can play around
various parameters. While it works well enough it is not perfect.
If you give
it calculations which finish extremely quickly, then the
distributer has trouble joining the threads and hangs. It will take some
time to work out why this is happening, but for long calculations it
works well enough. Setting the thread priority to max. has very little
execution time but I thought i would give that option too.
In the attached output you will notice a small variation in the output result of the
integral between the single and multi-threaded example. The reason for this is
that with a `term_count' of 52, the
sine wave is extremely dense, so even a slight variation in
the x_delta count make a difference to the integral. With small
values for `term_count' the difference is very tiny, 0.0000000001.
The integrals are calculated with these
The new classes are in https://github.com/finnianr/Eiffel-Loop but are not yet part of any release.
If someone has the time to implement this distribution class using the SCOOP model, I would be most interested to see it.