multithreaded sorting program.CPP

multithreaded sorting program

Write a multithreaded sorting program that works as follows: A list of integersis divided into two smaller lists of equal size. Two separate threads (which wewill term sorting threads) sort each sublist using a sorting algorithm of yourchoice. The two sublists are then merged by a third thread—a merging thread—which merges the two sublists into a single sorted list.Because global data are shared cross all threads, perhaps the easiest wayto set up the data is to create a global array. Each sorting thread will work onone half of this array. A second global array of the same size as the unsortedinteger array will also be established. The merging thread will then mergethe two sublists into this second array. Graphically, this program is structuredaccording to Figure 4.20.This programming project will require passing parameters to each of thesorting threads. In particular, it will be necessary to identify the starting indexfrom which each thread is to begin sorting. Refer to the instructions in Project1 for details on passing parameters to a thread.The parent thread will output the sorted array once all sorting threads haveexited.
Powered by