CSE – Programming Assignment 2 Solution

$30.00 $24.00

Please read these instructions carefully. You will be graded based upon meeting all requirements stated in this assign-ment. Background We now have a working serial producer/consumer program. Congratulations! We also have it benchmarked for runtime so that we can compare its relative performance. Problem Statement: parallel producer – consumer A natural way to parallelize producer-consumer…

5/5 – (1 vote)

You’ll get a: zip file solution

 

Description

5/5 – (1 vote)

Please read these instructions carefully. You will be graded based upon meeting all requirements stated in this assign-ment.

Background

We now have a working serial producer/consumer program. Congratulations! We also have it benchmarked for runtime so that we can compare its relative performance.

Problem Statement: parallel producer – consumer

A natural way to parallelize producer-consumer is to create one thread for the producer module and a second thread for the consumer. Using your existing serial program as a base, create this natural parallel version of your program using pthreads.

All relevant requirements from lab 1, unless otherwise noted, apply to this program.

Of particular note:

All input should be read from stdin (as in lab 1).

Use an array of struct work_entry as your main work queue (as in lab 1). Output should be printed on stdout and in the same format as lab 1.

The order of your output need not be the same as the order of the input data.

Per the pthreads API, you will need to encapsulate any data structures being sent to your thread routines inside a struct.

Do not use any global variable for this assignment. Use the same input data files as lab 1.

Use the same three methods for instrumenting your parallel program as were used in lab 1, i.e. time(1) (the unix command), time(2) (unix system call), and clock(3) (unix library routine).

Provide a makefile for your program that runs without parameters (i.e. typing “make” alone with successfully build your program.

Name your executable file “lab2_pthreads.”

Report Requirements

Run your parallel program against all of the test files provided, providing the following.

Report the runtimes for both your serial and parallel tests. Explain your results.

The Ohio State University

CSE 5441 – Dr. J. S. Jones

Testing & Submission Instructions

Submit your program files from an Owens login node using the OSC submit system: https://www.osc.edu/ resources/getting_started/howto/howto_submit_homework_to_repository_at_osc.

In your home directory, create a directory call “lab2” and place all of your files for submission in that directory. Submit this directory.

Include only your source code. Do not submit binary files, test data files, or results of your program runs.

submit this assignment to “lab2”

Test input files are available on Owens in the /fs/project/PAS1421 directory. Submit your report in .pdf format via Carmen.

The Ohio State University

CSE - Programming Assignment 2 Solution
$30.00 $24.00