[Solved]Goal Assignment Gain Understanding Semaphores Use Pthreads Designing Implementing Multi Th Q37272219
The goal of this assignment is to gain an understanding ofsemaphores through the use of pthreads by designing andimplementing a multi-threaded application. A secondary goal is tounderstand how semaphores are used in operating systems andapplications.
You are to write both a producer and a consumer Cprograms that uses pthreads to process and synchronizeconcurrent file activities.
The Details
Your solution must include the following:
- The Consumer
Submits processing requests to the producer by supplying afile name, its location and a character. It also outputs thecontents of the file provided by the producer to the standardoutput. - The Producer
Accepts multiple consumer requests and processes eachrequest by creating the following four threads.- The reader thread will read an input file, oneline at a time. It will pass each line of input to the characterthread through a queue of messages.
- The character thread component will scan theline and replace each blank character by the character supplied bythe client. It will then pass the line to the toUpper threadthrough another queue of messages.
- The toUpper thread component will scan theline and convert all lower case letters to upper case. It will thenpass the converted line to the writer thread through another queueof messages.
- The writer thread will write the line to anoutputfile.
The producer will also return both the file name as well as itslocation to the consumer when the end of input file is reached.
Implementation Details
- You should develop a module that implements a queue ofcharacter string buffers.
- This structure will be an array of pointers to strings withintegers to indicate the head and tail of the list.
- The maximum size of the buffer array will be 10.
- Buffers will be created by the reader thread and destroyed bythe writer thread.
- Threads should terminate when end of input file isreached.
Expert Answer
Answer to The goal of this assignment is to gain an understanding of semaphores through the use of pthreads by designing and imple… . . .
OR

