- 作业标题:CSCI 3120 - Assignment 3- Multithreaded Sorting
- 课程名称:Dalhouse University CSCI 3120 Operating Systems
- 完成周期:1天
1. Assignment Overview
In this assignment, you need to design and implement a C program that utilizes
multithreading to accomplish the task of integer sorting.
2. Important Note
There is a zero-tolerance policy on academic offenses such as plagiarism or inappropriate
collaboration. By submitting your solution for this assignment, you acknowledge that the
code submitted is your own work. You also agree that your code may be submitted to a
plagiarism detection software (such as MOSS) that may have servers located outside Canada
unless you have notified me otherwise, in writing, before the submission deadline. Any
suspected act of plagiarism will be reported to the Faculty’s Academic Integrity Officer in
accordance with Dalhousie University’s regulations regarding Academic Integrity. Please
note that:
The assignments are individual assignments. You can discuss the problems with your
friends/classmates, but you need to write your program by yourself. There should not be
much similarity in terms of coding.When you refer to some online resources to complete your program, you need to
understand the mechanism, then write your own code. Your code should not be similar to
the online resources. In addition, you should cite the sources via comments in your program.
3. Detailed Requirements
- Overview: In this assignment, you need to design and implement a C program that utilizes
multithreading to accomplish the task of integer sorting. Specifically, a list of integers should
be divided into two sub-lists of integers by your program. The size of the sub-lists should be
the same (note that when the total number of integers is odd, the integer in the middle of the
list should only be included one of the sub-lists). Then two separate threads (which are called
“sorting threads”) are created. Each of them sorts a sub-list using a sorting algorithm of your
choice. Finally, the sorted sub-lists are merged into a single sorted list by a third thread
(which is called “merging thread”).
Because global data are shared across all threads, perhaps the easiest way to store the initial
list of integers is to create a global array. Each sorting thread could work on one half of this
array. A second global array (whose size is the same as that of the unsorted integer array)
could also be established. The merging thread could then merge the sorted sub-lists into this
second array. Graphically, the operation flow of your C program could be illustrated using
the following figure:
。。。