Question: In C: In this assignment you will learn and practice developing a multithreaded application using C with pthreads The application you are asked to implement

In C:

In C: In this assignment you will learn and practice developing a

In this assignment you will learn and practice developing a multithreaded application using C with pthreads The application you are asked to implement is from our textbook (SGG) chaper 4, namely Multithreaded Sorting Application Here is the description of it for convenince: Write a multithreaded sorting program that works as follows: A list of integers is divided into two smaller lists of equal size. Two separate threads (which we will term sorting threads) sort each sublist using a sorting algorithm of your choice. The two sublists are then merged by a third thread (i.e., merging thread) which merges the two sublists into a single sorted list Your program should take take an integer (say N) from the command line. This number N represents the size of the array that needs to be sorted. Accordingly, you should create an array of N double values and randomly select the values from the range of [1.0, 100.0]. Then sort them using multhithreading as described above and measure how long does it take to finish this sorting task.. For the comparision purposes, you are also asked to simply call your sort function to sort the whole array and measure how long does it take if we do not use multuthreading (basically one (the main) thread is doing the sorting job) Here is how your program should be executed and a sample output prog 1000 Sorting is done in 10.0ms when two threads are used Sorting is done in 20.0ms when one thread is used You need to figure out how to implement this program in C (Pthreads)! You need to be carefull about how to pass parameters to threads. For example, in C, because global data are shared cross all threads, perhaps the easiest way to set up the data is to create a global array. Each sorting thread will work on one half of this array. A second global array of the same size as the unsorted integer array will also be established. The merging thread will then merge the two sublists into this second array. This programming project will require passing parameters to each of the sorting threads. In particular, it will be necessary to identify the starting and ending index for the part of the arrays each thread is to begin sorting. Please do not use readily available sort functions/methods, you need to implement a simple one by yourself! Part 1 Write your program in C with Pthreads Part 2 Test both programs with different values of N (1000, 10000, 100000, 1000000) and see how they perform Comment on your results under two threads vs. no threading Make a table of vour results and include it in vour REPORT.txt In this assignment you will learn and practice developing a multithreaded application using C with pthreads The application you are asked to implement is from our textbook (SGG) chaper 4, namely Multithreaded Sorting Application Here is the description of it for convenince: Write a multithreaded sorting program that works as follows: A list of integers is divided into two smaller lists of equal size. Two separate threads (which we will term sorting threads) sort each sublist using a sorting algorithm of your choice. The two sublists are then merged by a third thread (i.e., merging thread) which merges the two sublists into a single sorted list Your program should take take an integer (say N) from the command line. This number N represents the size of the array that needs to be sorted. Accordingly, you should create an array of N double values and randomly select the values from the range of [1.0, 100.0]. Then sort them using multhithreading as described above and measure how long does it take to finish this sorting task.. For the comparision purposes, you are also asked to simply call your sort function to sort the whole array and measure how long does it take if we do not use multuthreading (basically one (the main) thread is doing the sorting job) Here is how your program should be executed and a sample output prog 1000 Sorting is done in 10.0ms when two threads are used Sorting is done in 20.0ms when one thread is used You need to figure out how to implement this program in C (Pthreads)! You need to be carefull about how to pass parameters to threads. For example, in C, because global data are shared cross all threads, perhaps the easiest way to set up the data is to create a global array. Each sorting thread will work on one half of this array. A second global array of the same size as the unsorted integer array will also be established. The merging thread will then merge the two sublists into this second array. This programming project will require passing parameters to each of the sorting threads. In particular, it will be necessary to identify the starting and ending index for the part of the arrays each thread is to begin sorting. Please do not use readily available sort functions/methods, you need to implement a simple one by yourself! Part 1 Write your program in C with Pthreads Part 2 Test both programs with different values of N (1000, 10000, 100000, 1000000) and see how they perform Comment on your results under two threads vs. no threading Make a table of vour results and include it in vour REPORT.txt

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 Databases Questions!