futures when this runs we can see that the futures for ab and all run concurrently but must wait until one of the others finishesstarting abcacbcabcbabcacbacabcbacabcbadddddddddd future result() all done the main thread also waits for future to finish as it requests the result which is blocking call that will only return once the future has completed and generates result againto use processes rather than threads all we need to do is to replace the threadpoolexecutor with the processpoolexecutorfrom concurrent futures import processpoolexecutor print('starting 'pool processpoolexecutor( future pool submit(worker' 'future pool submit(worker' 'future pool submit(worker' 'future pool submit(worker' 'print('\nfuture result():'future result()print('all done'waiting for all futures to complete it is possible to wait for all futures to complete before progressing in the previous section it was assumed that future would be the last future to completebut in many cases it may not be possible to know which future will be the last to complete in such situations it is very useful to be able to wait for all the futures to complete before continuing this can be done using the concurrent futures wait function this function takes collection of futures and optionally timeout and return_when indicator wait(fstimeout=nonereturn_when=all_completedwheretimeout can be used to control the maximum number of seconds to wait before returning timeout can be an int or float if timeout is not specified or nonethere is no limit to the wait time return_when indicates when this function should return it must be one of the following constantsfirst_completed the function will return when any future finishes or is cancelled