This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: CMSC 216 Project #6 Fall 2011 Multithreaded Mergesort Due: December 13, 2011, 6:00PM Mergesort is an algorithm that can be easily adapted to use multithreading to speed up the sorting. In this project, you will write two mergesort implementations: one without multithreading, and one that uses a shared task queue to operate with any number of threads. You will also write a program to aid in testing and timing your mergesort implementations. 1 Procedure 1.1 Obtain the project files We have supplied two files for your use in this project: (a) .submit , needed for submitting your project; and (b) mergesort.h , a header file that contains prototypes for the two functions you must write. Addi- tionally, we include resource.h and bresource.h . Your mergetest.c should include resource.h instead of sys/resource.h . These files are compressed and contained in ~/216public/project6/project6.tgz . Your code for this project should be contained in your ~/216/project6 subdirectory, which is created by extracting files from the tarball you copied. 1.2 Create a Makefile As with some previous projects, you are asked to create a Makefile that we will use to build your programs. §2.1 lists the targets you are required to implement, as well as any other requirements for your Makefile . 1.3 Write and test a non-threaded mergesort implementation First, you must implement a mergesort that does not take advantage of multithreading. You must then write a program to store random numbers in an array, and then time how long it takes your mergesort implementation to sort this array. 1.4 Write and test the multithreaded mergesort You also must write a multithreaded mergesort function that allows a user to sort an array using any number of threads. This multithreaded mergesort should use the non-threaded mergesort to do much of the actual sorting work. You must then add to your testing program calls to your multithreaded mergesort to time the sort using different numbers of threads. 1.5 Answer questions about your mergesort’s operation In a plain text file named REPORT , we also require you to place the answers to several questions about the performance of your mergesort implementations. The questions are specified in §2.7. 2 Specifications 2.1 Makefile Your Makefile should be set up so that all programs are built using separate compilation (i.e., source files are turned into object files, which are then linked together in a separate step). All object files should be built using the-ansi ,-pedantic-errors ,-Wall , and-Werror flags with gcc . You must have the following targets present in your Makefile : 1. all : make all executables 2. clean : delete all object files and executables 3. mergesort.o and mergetest.o , the object files for your mergesort code and your testing program 1 4. mergetest : the executable testing program created by linking the two object files We will use the Makefile you provide to build and execute your public tests on the submit server; if there is...
View Full Document
This note was uploaded on 01/13/2012 for the course CMSC 216 taught by Professor Plane during the Spring '11 term at Maryland.
- Spring '11