I have to implement a program using C/UNIX to sort an array A of n integers (asc
ID: 3528822 • Letter: I
Question
I have to implement a program using C/UNIX to sort an array A of n integers (ascending order) by the use of multi-threaded programming using POSIX threads and odd-even transposition sort. While implementing this algorithm, you have to synchronize the threads using barrier synchronization mechanism.
The input data should be taken from a file. The file will simply be a sequence of integers. The name of the file will be given as a command line parameter. The output should be the state of the initial array, state of the array after each round and also the final sorted array.
The output can simply be displayed on the terminal. maximum concurrency is to be achieved in the implementation. Note that as you are using only threads (not full blown processes), all the threads will have the array available to work with as the data segment is shared. You can declare the array as a global variable for this purpose. Also make sure that all your threads run the same function.