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

  Packets of her favourite washing powder

She want to write a programme to determine which one of the packets is the best buy (most economical). Do the calculations and display which packet for all three packet.

  Write a function to compute the volume of a cone

write a function to compute the volume of a cone by using the base radius r and the height h of the cone as the parameters of the function Vcone = xr^2h/3

  Write function that improve the performance of your program

Write another function that improve the performance of your program by using another sorting algorithm, discuss the Big O of the new algorithm use.

  The reverse of each word, and a palindrome checker

give us the first letter of each word, the first half of each word, the reverse of each word, and a palindrome checker to see if the word is a palindrome.

  Prepare program to check the syntax of the english language

Determine the form of the output dependent on the coefficients being input. Print and evaluate with peers in class."

  Demonstrates steps to analyze the problem

Demonstrates your thought process and steps used to analyze the problem. Be sure to include the required input and output and how you will obtain the required output from the given input

  Explain how to convert c program to mips program

Convert the following C program to MIPS program. Assuming that i, j, k, f, are stored in registers $s0, $s1, $s2, $s3 already.

  Application shows a user friendly message

The software fails to respond to user inputs, if there is a connectivity problem with the database. Add the code snippet that the development team should use to ensure that the application shows a user- friendly message, if such a situation arises..

  Write a method that accepts a string

Write a method that accepts a String object as an argument and displays its contents backward. For instance, if the string argument is "gravity" the method should display - "ytivarg". Demonstrate the method in a program that asks the user to input..

  Program to print out invalid number to character

The integer must contain 3 distinct non-zero number, or the program will print out invalid number.it should print out invalid query.

  Write two short c programs and solve exam-style problem

Write two short C programs and solve four exam-style problems.

  Use the getint and getintwithinrange methods

Use the getInt and getIntWithinRange methods to validate that each score ranges from 1 through 100 and add code that discards any extra entries at the prompt that asks if you want to enter another score to the application below.

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