inter thread/process synchronisation both these queue classes are thread and process safe that is they work appropriately (using internal locksto manage data access from concurrent threads or processes an example of using queue to exchange data between worker process and the main process is shown below the worker process executes the worker(function sleepingfor before putting string 'hello worldon the queue the main application function sets up the queue and creates the process the queue is passed into the process as one of its arguments the process is then started the main process then waits until data is available on the queue via the (blockingget(methods once the data is available it is retrieved and printed out before the main process terminates from multiprocessing import processqueue from time import sleep def worker(queue)print('worker going to sleep'sleep( print('worker woken up and putting data on queue'queue put('hello world'def main()print('main starting'queue queue( process(target=workerargs=[queue]print('main starting the process' start(print('main waiting for data'print(queue get()print('main done'if __name__ ='__main__'main(the output from this is shown belowmain starting main starting the process main wait for data worker going to sleep worker woken up and putting data on queue hello world main done howeverthis does not make it that clear how the execution of the two processes interweaves the following diagram illustrates this graphically