[Solved] CSC 332 (6X) Operating Systems- Cigarette Smokers Problem

$25

File Name: CSC_332_(6X)__Operating_Systems-_Cigarette_Smokers_Problem.zip
File Size: 546.36 KB

SKU: [Solved] CSC 332 (6X) – Operating Systems- Cigarette Smokers Problem Category: Tag:
5/5 - (1 vote)

Problem Description

Consider a system with 3 smoker processes and 1 agent process. Each smoker continuously rolls a cigarette and then smokes it. The smoker needs three ingredients: tobacco, paper, and matches. One of the smokers has paper, another has tobacco, and the third has matches. The agent has an infinite supply of all three materials and (randomly) places two of the ingredients on the table each time. The smoker who has the remaining ingredient then makes and smokes a cigarette, signaling the agent on completion. The agent then puts out another two of the three ingredients, and the cycle repeats.

TO DO Write a program to synchronize the agent and smoker processes using:

  • semaphores
  • pthread libraries

Instructions

  • Please see this link for pseudocode: http://www.cs.umd.edu/~hollings/cs412/s96/synch/smokers. html
  • Though the description says the agent process can infinitely supply two of the three ingredients, you can assume that the agent places ingredients only a finite number of times, say for example 10.
  • You need to use the sem.h header file in your semaphore-based solution.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CSC 332 (6X) Operating Systems- Cigarette Smokers Problem
$25