Question: You will create a program creating/handling multiple processes. Each process is to sort an integer list in an increasing order. The list is a shared

 You will create a program creating/handling multiple processes. Each process is

You will create a program creating/handling multiple processes. Each process is to sort an integer list in an increasing order. The list is a shared variable (global) among all processes; it is initialized randomly with [050] at the beginning of thread in process. The list size is 20. Alter initialization, the process will sort the array without any interrupt. At the end, you will release the list for other processes to use. You should use a semaphore to synchronize between the threads. A. The size of list is 20. B. The number of processes is 5. C. Your output should include each sorted list (in a single line). D. Your output should report the start/end time of each process. You can calculate the execution time, perhaps using the python module like 'tirneit' (httpsWdocspython.orgiZflibrary/timeithtml). Task 1. Create 5 sorting processes, run them, and print output like the example below. Your output may be incorrect, not sorted correctly (meaning that there is no synchronization among the processes). Please refer to https:f/pymotw.comf2/multiprocessing/basicshtml for multiprocessing module (Python 3 module is also ne). The lename should be 'sort _process_taskl.py' Task 2. Using multiprocessinglockO inction (it's equivalent to semaphore) to control access to critical section. You allow only one process at a time. The nal output should have all 10 lists correctly sorted. The lename should be 'sort grocessitask2 .py' EXAMPLE: >> .fsort_process_task2.py ##### Process #1 started ##### Process #2 started [1]_>0123456789... 0.00?sec [2]-> 10 11 12 13 14 15 16 17 18 19 0.00? sec

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!