Multithreaded Bubble - Systems Programming - Quiz, Exercises of System Programming

Main points of this documents are: Multithreaded, Bubble, Merge, Sort, Numbers, Variables, Semaphores, Temporary, Files.

Typology: Exercises

2011/2012

Uploaded on 10/24/2012

gaggan
gaggan 🇮🇳

4.4

(51)

111 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Systems Programming
Assignment #2
Q1: Write a program that implements a multithreaded bubble—
merge sort. Have the initial process generate 10,000 random
numbers—writing the numbers in groups of 1,000 each to 10
separate temporary files. Then create 10 threads and pass
each a reference to one of the temporary files and a common
bubble-sorting routine. As each thread finishes, its sorted
results should be returned to the initial thread that
performs a merge of sorted results (i.e., the temporary
1,000 number file) with a final, fully sorted file. Where
appropriate, use semaphores and/or mutexes or condition
variables to coordinate activities. Run your solution
several times to be sure it works correctly. Once all the
data is ordered, display every 100th value in the final
data set to attempt to establish if the data was truly
sorted. All temporary files and other data structures
should be removed once processing is complete.
Your program will take two command-line arguments: the
number of values to sort and the number of files
Docsity.com

Partial preview of the text

Download Multithreaded Bubble - Systems Programming - Quiz and more Exercises System Programming in PDF only on Docsity!

Systems Programming

Assignment

Q1: Write a program that implements a multithreaded bubble— merge sort. Have the initial process generate 10,000 random numbers—writing the numbers in groups of 1,000 each to 10 separate temporary files. Then create 10 threads and pass each a reference to one of the temporary files and a common bubble-sorting routine. As each thread finishes, its sorted results should be returned to the initial thread that performs a merge of sorted results (i.e., the temporary 1,000 number file) with a final, fully sorted file. Where appropriate, use semaphores and/or mutexes or condition variables to coordinate activities. Run your solution several times to be sure it works correctly. Once all the data is ordered, display every 100th value in the final data set to attempt to establish if the data was truly sorted. All temporary files and other data structures should be removed once processing is complete.

Your program will take two command-line arguments: the number of values to sort and the number of files

Docsity.com