I’m currently writing a small framework for demand-driven workflows. The API is now stable and I am working on improving tests. It’s easy to show that computations are correct (which is a good start), however, the main interest of the framework is to launch subtasks in parallel (when needed and possible).
Is there a way to test automatically that two different pieces of code do run in a parallel/concurrent fashion ? I prefer not relying on execution time (speed-up) measurments.
The framework is written in scala, and relies a lot on Akka Futures.
EDIT:
Here is an example:
val foo = step {
//... defines an arbitrary task
}
// Runs 5 times the code inside step foo
val foos = repeat( 5 )( foo )
I would like to be sure that the code inside foo is executed 5 times in parallel.
I don’t see a way to do this without changing tasks (i.e. when you need to test that two specific tasks run in parallel). But if you can change the tasks, just add an actor to the system. Make every task send messages to this actor when starting or ending work. If the actor receives two
Startingmessages in a row, the tasks should be running in parallel (or at least in different threads).