Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

=+6. How do automatic stabilizers work?

Answered: 1 week ago