Question: Task #1 Multithreaded Sorting Application Write a multithreaded sorting program that works as follows: A list of integers is divided into two smaller lists of
Task #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 threada merging thread which merges the two sublists into a single sorted list. NOTE : 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 as follow: 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.
Task #2- CPU Scheduling Simulator Write a program to simulate following CPU scheduling algorithms: 1) First Come First Serve (FCFS) 2) Shortest Job First (SJF) 3) Preemptive Priority Scheduling 4) Round Robin (RR) The task information will be read from an input file (input.txt) with the following format: Pid Arrival_Time Burst_Time Priority All of fields are integer type where Pid is a unique numeric process ID Arrival_Time is the time when the task arrives in the unit of milliseconds Burst_Time is the CPU time requested by a task, in the unit of milliseconds Priority is the priority associated with each task with low numbers representing high priority. Note: for RR algorithm you need to define a Time_quantum.
What to do?
Create a simple user interface to ask user for input.txt file, a scheduling algorithm and Time_quantum if RR is chosen.
Print progress of task every unit time (millisecond).
Once all tasks are completed, the program should compute and print : Average waiting time, Average response time, Average turnaround time, CPU utilization rate
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
