0% found this document useful (0 votes)
33 views

Multithreading Sorting Assignment

The document provides instructions for a programming assignment to create a multithreaded sorting application that divides a list of integers into two sublists, uses two sorting threads to independently sort each sublist, and a merging thread to merge the sorted sublists into a single sorted list; students must implement the program in Java using threads and write a report comparing the execution time of multithreaded and single-threaded versions of the program.

Uploaded by

Tan BunChhay
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

Multithreading Sorting Assignment

The document provides instructions for a programming assignment to create a multithreaded sorting application that divides a list of integers into two sublists, uses two sorting threads to independently sort each sublist, and a merging thread to merge the sorted sublists into a single sorted list; students must implement the program in Java using threads and write a report comparing the execution time of multithreaded and single-threaded versions of the program.

Uploaded by

Tan BunChhay
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Royal University of Phnom Penh Subject: Operating System

Faculty of Engineering Lecturer: Kor Sokchea


Department of IT Engineering Assignment: Multithreading

Programming Assignment

1. Multithreaded Sorting Application


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—a merging thread —which merges the two sublists into a single sorted list. 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. Graphically, this program is structured according
to Figure 1. This programming project will require passing parameters to each of the sorting
threads. In particular, it will be necessary to identify the starting index from which each thread is
to begin sorting. Refer to the instructions in Project 1 for details on passing parameters to a
thread. The parent thread will output the sorted array once all sorting threads have exited.

Figure 1: Multithreaded Sorting


Royal University of Phnom Penh Subject: Operating System
Faculty of Engineering Lecturer: Kor Sokchea
Department of IT Engineering Assignment: Multithreading

Note: In this exercise, you will need to implement using Java Thread. In this exercise, you have
to implement two versions of program including multithreaded and single threaded program.
Then, please writing the report about your profiling of the execution time of program that you
solve the above problems with multithreaded and single threaded program.

Report

1. Introduction
2. Objective
3.
3.1. Sorting algorithm
4. Result (please provide the graph about computation time of single or
multithreaded program of each problem)
5. Conclusion

You might also like