Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Design and write is meant to mean pseudo code. You are to use C or C++ as youre the basis of your pseudo code. Your

Design and write is meant to mean pseudo code. You are to use C or C++ as youre the basis of your pseudo code. Your pseudo code should be written at level such that it might compile, however you are not expected to actually get a clean compile. Keep focused on the concepts, and not so much the exact function names or pristine syntax.

image text in transcribed

Task 1: Design and write2 a multithreaded single process 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 Thrting 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 4.20 Original List 7,12, 19,3, 18, 4, 2, &,15,8 Sorting Thread 7,12,19, 3, 18 4,2,6,15,8 Merge Thread 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 2, 3,4,6,7,8, 12, 15, 18,19 Figure 4.20 Multithreaded sorting. Task 2: Repeat Task 1, but instead of a multithreaded single process, design and write2 the program as multiple processes, each being single threaded. You are to apply the IPC concepts discussed in Chapter 3 Task 3: Now that you have explored a couple of options to solve this type of problem, which option would you choose as a mission critical production system? Explain and defend your selection Task 1: Design and write2 a multithreaded single process 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 Thrting 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 4.20 Original List 7,12, 19,3, 18, 4, 2, &,15,8 Sorting Thread 7,12,19, 3, 18 4,2,6,15,8 Merge Thread 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 2, 3,4,6,7,8, 12, 15, 18,19 Figure 4.20 Multithreaded sorting. Task 2: Repeat Task 1, but instead of a multithreaded single process, design and write2 the program as multiple processes, each being single threaded. You are to apply the IPC concepts discussed in Chapter 3 Task 3: Now that you have explored a couple of options to solve this type of problem, which option would you choose as a mission critical production system? Explain and defend your selection

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part 3 Lnai 8726

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448440, 978-3662448441

More Books

Students also viewed these Databases questions