Assignment 2 : Casino Royale Gambling Problem

Given on: 23rd Feb, 2007

Due Date: 10th  March, 2007

Assignment can be done in pair of two

Introduction

In this assignment, you will use UNIX pthreads (“POSIX threads”) in an implementation of the synchronization problem.

Visitors (who need fun) go to MGM Grand in Las Vegas, may have to wait before they get a chance to gamble. Inside the casino there are ‘n’ XYZ machines meant for individual gambling. If all the machines are occupied the visitors have to wait in the waiting lounge. The waiting lounge has a restaurant along with poker tables where people can be entertained before they turn to big time gambling. When the visitor are finished with their gambling they go to the token counter to collect/pay money in exchange for tokens, following which they leave the casino immediately.

The Casino Royale Gambling problem is a classical IPC (inter process communication) problem that models waiting queues (e.g., a telephone service call center).

Details

In this assignment, you will instrument and experiment with the performance of a working implementation of the Casino Royale Gambling problem. The implementation is to be written in C and uses pthreads to implement the visitor, gambling and restaurant processes.  

Following are specific instructions on what to do.

Parameters

·          The arrival rate in the casino is a poison process with mean arrival rate = 1 person per minute.

·          The time to make a move on a poker table is an exponential process with mean of 20 seconds.

·          The playing time of visitors on ‘XYZ’ machines is assumed to be exponentially distributed with mean playing time equals 15 minutes.

·          The time spent on the token counter is a deterministic process and it takes 2 minute per person for the token exchange. For security purposes the personnel at the counter changes their shift after every 90 minutes. The changing time is 5 minutes.

·          ‘m’ = 8

·          ‘L’ = 100

·          ‘n’ = 25

·          The probability of playing poker i.e. ‘p’ = .21

 

Analysis

Prove the correctness of your algorithm with respect to the following-:

1)      Mutual Exclusion

2)      Progress

3)      Deadlocks

4)      Bounded Waiting

Analyze the variation of the following quantities with time -:

1)      Number of visitors who had left the system after gambling

2)      Number of visitors who left the system without gambling

3)      Number of players in poker queue

4)      Number of visitors playing poker

5)      Number of poker moves

6)      Number of Customers served in the restaurant

7)      Turn Around Time

8)      Wait time

 

Notes-:

  1. The programming language to be used is C.
  2. Proper directory structure has to be maintained and coding standards have to be followed.
  3. Function and variable names should be intuitive.
  4. Use of Makefile is a must (no scripting allowed).
  5. Include a Readme file, explaining the basic structure of the code.
  6. The code should be modular, self-explanatory and well commented.