Write a program with a concurrent pipeline architecture

Assignment Help Computer Engineering
Reference no: EM131952440

Program Assignment: Pipelined Tasks

Write a program with a concurrent pipeline architecture that has three steps: 1) threads that produce 1000 random integers, 2) threads that filter out multiples of 3 from the integers produced in step 1, and 3) threads that groups the integers from step 2 into one of 10 files, as explained below. (See the figure after the next paragraph.) The first two steps are similar to what is in wait5.cpp. Place everything in a class named Pipeline, making sure that items related to thread communication are static members.

For the third step, create exactly 10 threads that retrieve integers from the second queue populated by the threads in Step 2, and group the numbers by their modulus (remainder) base 10. Each of these 10 "grouper" threads will only remove a number from the front of the queue if its modulus corresponds to theirs. For example, grouper thread 0 will check to see if the first number in the queue ends in a 0 (i.e., it is congruent to 0 (mod 10)). If so, it will remove it from the queue and write it to its file (see below). Otherwise it does nothing. If the number at the front of the queue does not end with the proper digit, the thread leaves it in the queue for the appropriate thread to process. Each grouper thread does likewise for its respective remainder mod 10. The following diagram represents the architecture of this program.

589_Architecture-Diagram.jpg

When you are done, print out a report like the following (your numbers will vary):

Group 7 has 271 numbers Group 1 has 244 numbers Group 9 has 264 numbers Group 4 has 278 numbers Group 0 has 275 numbers Group 5 has 267 numbers Group 8 has 285 numbers Group 3 has 279 numbers Group 2 has 268 numbers Group 6 has 242 numbers

Note that the order of the group reports varies on the order that the grouper threads terminate. Use 4 producer threads and 3 filter threads.

Collect your 10 output text files and your source code, along with the execution output like what you see above, into a zip file for submission.

Note: my solution to this program runs on all platforms, but it is HORRIBLY SLOW (wait 2 minutes, but it works) on Visual Studio 2015. It runs instantaneously on clang, g++, MinGW, and Visual Studio 13.

FYI, my program is 91 lines of actual code, much of which is copied from/based on wait5.cpp.

Attachment:- Wait.rar

Reference no: EM131952440

Questions Cloud

Develop an oc curve using a sample size : Develop an OC curve using a sample size of 100, and the following p values: 0.01, 0.02, 0.03, 0.05, 0.07, 0.09, 0.11, 0.13, 0.15, 0.17, 0.19, 0.21.
How would you leverage big data : How would you leverage big data to help the company achieve this strategy? You can select any unit, such as any brand or function
Compute limits for a median chart : Using the data from Problem, compute limits for a median chart. Is the process in control? The following data are for a component used in the space shuttle.
How does this source influence your overall thesis statement : Analyze your sources critically so that you can build stronger research papers. Most successful writers are great readers and can take great notes.
Write a program with a concurrent pipeline architecture : Write a program with a concurrent pipeline architecture that has three steps: 1) threads that produce 1000 random integers.
Discuss type I and type II error : For the data in Problem, if the process target is 50.25 with spec limits +/-5, describe statistically the problems that would occur.
Managing a large-scale corporate project : Describe a project you implemented. You may use any project- potty training your child or managing a large-scale corporate project.
Determining the strong brands : Several companies use their brand as a competitive advantage. Given your knowledge about the global economy, identify three brands
Given that ei starts with self-awareness : Given that EI starts with self-awareness, how likely is someone with a low EI to be able to judge the level of their own EI or someone else's? Explain.

Reviews

Write a Review

Computer Engineering Questions & Answers

  What technologies must be used to secure those areas

The employees have hopes of making the breakthrough and bringing the company public in next two years. You have been hired as a security consultant to assess the company's needs.

  Create a memo that outlines the advantages of each approach

Create a memo that outlines the advantages and disadvantages of each approach, and give your recommendation.

  How to modify the product program to use a gui

create the product Program to use a GUI. The GUI should display the information one product at a time, including the item number, the name of the product, the number of units in stock, the price of each unit, and the value of the inventory of that..

  The employee and the weekly pay amount

make a non-GUI based Java application that calculates weekly pay for an employee. The application should display text that requests the user input the name of the employee, the hourly rate, and the number of hours worked for that week.

  Create the illusion that each user has a dedicated machine

CS-155 Concepts of Computer Science - Which of the following tracks the progress of a program during execution and create the illusion that each user has a dedicated machine?

  What the best approach to integrating domain-specific needs

What is the best approach to integrating domain-specific needs? Why is this approach better than others? What makes today's technological environment a Digital World? What is the future of human-computer interactions

  Make a list that includes at least three people you did like

Make a list that includes at least three people you'd like to invite to dinner. Then use your list to print a message to each person, inviting them to dinner.

  Assume that we are using the given checksum scheme add up

a. suppose computers a b c and d are connected to an ethernet cable similar to the setup shown in lecture. computer a

  Distinguish between traditional asp and provider of software

Distinguish between a traditional ASP and a provider of software as a service. What are the pros and CMS of each solution approach?

  What are some of the problems that you have experienced

what are some of the problems that you have experienced when writing or receiving poorly perhaps hastily written

  Assume that we are looking in a programming language

suppose that we are looking in a programming language that allows underscore (_) in variable names. When a scanner sees a character string such as AB_CD, is it more likely to identify this string as the single five-character token AB_CD or as thre..

  Define the project in terms of the selected framework

System Architecture and Intergration IT- Define the project in terms of the selected framework. Discuss advantages for using the selected framework.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd