Clone wiki

SCons / SerialiseForSharedResources

The SCons wiki has moved to

Serialise for shared resources

Some tasks are best executed in series, either because they share resources which are more efficiently utilised in series or they share unique resources which cannot be accesed simultaniously.

A simple solution is to only invoke scons without -j N, unless N = 1.

In a build consisting of a mixture of tasks that can be executed in parallel and tasks that need to be serialised, requiring all the tasks that can be run in parallel to execute in series is non optimal.

The solution for the tasks that you know share resources is to tell scons that they create the same dummy file as a side effect. Scons will avoid executing only these tasks in parallel to avoid simultaneous acess to this dummy file.




In this case when the script is invoked with scons -j 2 we should expect only x3.out to be created in parellel, the other two tasks should be completely serialised.