Producer - consumer synchronization, Operating System

Assignment Help:

This assignment is based on Programming Project 6.40 in Silbershatz. Implement the ProducerXConsumer program according to the instructions for Project 6.40 for both Linux and Win32 threads. (1) However BEFORE you add any synchronization to your code use sleep()/usleep() calls to force your code to produce as many different types of synchronization bugs as possible.  Use the output produced by your program and for your Linux implementation only also use 'strace -f' to explain how and where in your code the synchronization bugs occur.  Be sure to use the command line argument for strace - see the man pages for details on this Each of your threads should fprint out a line of output to stderr when it is first started, and again when each buffer of input/output is processed.  

Submit code and annotated  test output for these experiments explaining where the race conditions occur.

NEXT, modify your code by adding appropriate synchronization (mutex locks and/or signal semaphores and/or count semaphores) so that it always executes correctly.   Use diff on Linux & comp on Windows to verify that the input & output files are identical by annotating your trace output clearly and concisely and using diff/comp to compare the contents of the input & output files.  Explain the logic of how you synchronized your code in your design documentation by submitting high level pseudocode with semaphore synchronization (init, p(), v()) and an explanation of the logic that you used; (2)  submit wellXcommented source code and annotated output (including strace listings) to demonstrate that your code is executing correctly, despite the sleep/usleep commands from the previous part.

Run your final program with 3 buffers (each of which is 13 bytes long),  6 producers, 3 consumers and a file that contains about 200 bytes; annotate & submit this output. (3) For the third part of this assignment, modify your synchronization so that a deadlock condition occurs, and document this situation by explaining in your design documentation how deadlock was produced in your code and how it can be avoided.


Related Discussions:- Producer - consumer synchronization

Synchronization, What is the different between basic synchronization and hi...

What is the different between basic synchronization and high level synchronization

#title:cs604, Consider a scenario of post mailbox, there are two processes ...

Consider a scenario of post mailbox, there are two processes named sender S and receiver R. Both processes can communicate with each other by name along with message. You need to I

Explain the communications of request or response interface, Explain the Co...

Explain the Communications of Request or Response Interface The inter-application communication must provide four specific interface to the CSInterface() components. A client m

Explain the concept of process, Q. Explain the Concept of Process? A pr...

Q. Explain the Concept of Process? A process is sequential program in execution. A process states the basic unit of computation for the computer. Components of process are:

Dual mode operation, WHAT ARE THE ADVANTAGES AND DISADVANTAGES OF DUAL MODE...

WHAT ARE THE ADVANTAGES AND DISADVANTAGES OF DUAL MODE OPERATION OF OPERATING SYSTEM>?

What are the characteristics of srs, What are the characteristics of SRS? ...

What are the characteristics of SRS? i. Correct - The SRS should be made up to date when appropriate requirements are identified. ii. Unambiguous - When the requirements are

Fundamental of operating system, An operating system provides the environme...

An operating system provides the environment within that programs are executed. Internally operating systems differ greatly in their makeup because they are organized along many di

Why system calls have to be implementing by a interpreter, Q. What system c...

Q. What system calls have to be implementing by a command interpreter or shell in order to start a new process? Answer: In the UNIX systems a fork system call followed by an ex

What is an operating system process, What is an operating system process? H...

What is an operating system process? How is it different from a program? Why do we need the concept of a process, rather than simply talk about programs running in memory? The e

Explain the resource ownership and control, Explain the Resource Ownership ...

Explain the Resource Ownership and Control Operating systems are required to handle many different types of resources. CPU , memory, and I/O devices  are some of the varied sys

Write Your Message!

Captcha
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