Starting from:
$35

$29

Project 2 Shared Memory and Synchronization solution

## Description

This assignment is to write a program that runs in parallel on Linux using threads (pthreads) and synchronization. The program will have four threads that run as such:




**Reader** will read from standard input, one line at a time. Reader will take the each line of the input and pass it to thread Munch1 through a queue of character strings.




**Munch1** will scan the line and replace each space character (not tabs or newlines) with an asterisk ("*") character. It will then pass the line to thread Munch2 through another queue of character strings.




**Munch2** will scan the line and convert all lower case letters to upper case (e.g., convert "a" to "A"). It will then pass the line to thread Writer though yet another queue of character strings.




**Writer** will write the line to standard output.




## Included Files

main.c

This is the main routine of the program. In this file the main function is invoked which creates all three queues. Each of the four threads is then created and run to completion before the main function continues. After this the main function prints out the

queue stats for each StringQueue.




string_queue.c

This file creates a StringQueue and then enqueues and dequeues strings as called.




string_queue.h

This is the header file for string_queue.c that contains the method arguments and the StringQueue structure initialization.




Makefile

This file, invoked with the command 'make', compiles all the preceding files into one executable named 'prodcomm'.




## Usage

The program can be invoked with the command 'prodcomm'.

More products