* create 16 child processes, each process consequently picks up a bank and sorts it as in the step 1 above. The banks are sorted in place, in *increasing* order.
* for this step call the function void inplace_sort(int *vector, int size) that sorts the bank starting from pointer vector and ending at pointer vector+size-1. Use your own implementation for this function.
* start step 2 and aggregate every 2 banks into one bank using all 16 processes. Do this until the number of sorted banks is equal to 16. Use the function void inplace_merge(char *vector, int size) that merges the bank from pointer vector to vector+size/2-1 with the bank from vector+size/2 to vector+size-1. Use your own implementation for this function.
* the parent process waits until all the array is sorted then verifies the correctness of the sorting with the function int verify_interval(const int* vector, int size). This function is to return 0 in the case of success or any non-null value otherwise.
* the parent process prints the time spent during sorting.
Since the synchronization in choosing the banks involves shared variables stored in the shared memory area, each read/write access may cause race conditions. In order to correctly write your program, you should protect each access using semaphores.
**Part 2: Thread-based sorting using a work queue**
You are required to write a program, called *sortt.c*, that sorts an array of data using exactly 16 threads. The program divides the array into exactly 128 banks. Execution command should be: prompt> ./sortt <n>where <n> stands for the size of the array to be sorted. (Ex: ./sortp 262144 sorts an 262144 size array of characters, starting with 16 threads and 128 banks. The initial size of the bank will be 2048 characters).
1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.
2) Installation package that will install the software (in ready-to-run condition) on the platform(s) specified in this bid request.
3) Exclusive and complete copyrights to all work purchased. (No GPL, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site).
unix SunOs 5.8