Simulate a producer-consumer system using threads

Assignment Help C/C++ Programming
Reference no: EM131216502

CS492 Programming Assignment-

The program must be written in C or C++, and run on a linux machine.

ALL source code you submit must be well documented (documentation is an indicator of understanding!)

Programs that cannot be compiled by TA/CA will receive an automatic grade of zero (0).

The goal of this assignment is to simulate a producer-consumer system using threads, mutexes, condition variables and scheduling. You will experiment with varying the numbers of available producer and consumer threads, the number of products, and the scheduling algorithm used to schedule the consumption of products. Your program must accept the following parameters at the command prompt in the order specified:

  • P1: Number of producer threads
  • P2: Number of consumer threads
  • P3: Total number of products to be generated by all producer threads
  • P4: Size of the queue to store products for both producer and consumer threads (0 for unlimited queue size)
  • P5: 0 or 1 for type of scheduling algorithm: 0 for First-Come-First-Serve, and 1 for Round-Robin
  • P6: Value of quantum used for round-robin scheduling
  • P7: Seed for random number generator

The scheduling algorithms your program must simulate are:

  • 0: First Come, First Serve
  • 1: Round-Robin

Man pages that you may need to consult are:

  • man pthread
  • man 3 random
  • man 3 srandom
  • man 3 drand48
  • man 3 srand48
  • man 2 gettimeofday
  • man 3 clock

Attachment:- Programming Assignment.rar

Reference no: EM131216502

Questions Cloud

Examine the current pressures on the labor side : In a three-page paper detail the current pressures on the U.S. labor relations system-on the corporate side, such issues can be workplace flexibility and employment involvement. Also, examine the current pressures on the labor side, such as low un..
Find the pdf of arrival time : Consider a Poisson counting process with arrival rate λ.- Find the PDF of that arrival time..- Find the joint PDF of those two arrival times.
Description of the role of the news media in politics : Based on your research of what actually unfolded, write a 350- to 700-word summary of the events and your opinion as to whether or not CBS news should have aired the program. Defend your position based on your understanding of the social responsib..
What is the arrival rate of the sum process : A sequence of independent Poisson counting processes with arrival rates, Show that the sum of all of these Poisson processes,- What is the arrival rate of the sum process?
Simulate a producer-consumer system using threads : CS492 Programming Assignment. The goal of this assignment is to simulate a producer-consumer system using threads, mutexes, condition variables and scheduling. You will experiment with varying the numbers of available producer and consumer threads..
What is probability that at least one workstation will fail : If the mean time between failures (MTBF) is 250 days, - what is the probability that at least one workstation will fail before the end of the warranty period?
How will you will present the training and development : How will you will present the training and development? How will you will motivate employees to want to continue developing their skills (include a motivational theory in your explanation)?
What is the probability that one call arrives : What is the probability that one call arrives during the first 10-minute interval and two calls arrive during the second 10-minute interval?
Which displacement produces largest number of coincidences : Use displacements of 5 and 6. Which displacement produces the largest number of coincidences? Find the key. Find the plaintext.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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