# Exercises: Running a SIGMA Simulation

The models referred to in these exercises are SIGMA models.

## A Semi-Random Walk

Build a simulation of a semi-random walk. The location of the walker on the line is given by the variable, X. Every step is in an opposite direction and has an expected step length equal to 4 feet. However, the steps to the right are uniformly distributed between 3 and 5 while steps to the left are exactly 4 feet long. Would you expect the location of the walker to change much over time?

## Stopping a Run Based on Event Counts

Run CARWASH.MOD until 10 customers LEAVE the system.

## Time Scaling

Without changing the run stopping criterion in the Run Options dialog box, double the effective run duration of CARWASH.MOD. (Hint: Rescale the unit for measuring time from minutes to half-minutes.)

## Event List Dynamics

Twenty jobs were run through a computer system with one CPU. They all had one of three priorities (lowest number has higher priority and is executed first). A historical data file of these jobs is as follows:

```Job     Time job        Job        CPU time
Number  was submitted   priority   used by the job
```
```1	    .00             1       .02
2	    .00             2       .01
3           .01             3       .02
4           .02             2       .04
5           .04             3       .02
6           .05             2       .01
7           .07             1       .01
8	    .12	            1	    .01
9	    .14	            2	    .02
10	    .15	            1	    .01
11	    .15	            2	    .01
12	    .17	            1	    .02
13	    .18	            3	    .04
14	    .21	            1	    .03
15	    .22	            2	    .05
16	    .23	            1	    .02
17	    .23	            1	    .01
18	    .26	            1	    .03
19	    .33	            2	    .02
20	    .34	            1	    .03
```
1. By hand, schedule the job submission and job completion events as they would occur if all jobs had the same priority; assume that nothing else changes except the priorities. Schedule only the next job submission and next job completion event, not all future job submissions (that is, at most two events will be scheduled at any given time). At time 0.25 what is the state of the system, i.e., the number of jobs in the queue, the status of the CPU (busy/idle), and the events that are scheduled to occur in the future (and when they are scheduled)?
2. Do part (a) with the execution priorities enforced.
3. Assume that a second identical CPU has been installed and that the two processors operate in parallel on the same single queue of jobs. A single CPU will finish a complete job before taking the next job in the queue. With job priorities enforced, plot the queue size and number of idle CPU's every .01 time units.

## A Theater with Limited Seating Capacity

Suppose that customers arrive at a movie theater at a uniform rate of one every 10 to 25 seconds and each is served in constant time of 20 seconds. There is limited seating in the theater, so the ticket window closes after it has sold 100 tickets. Model this queue.

## A Restaurant

A popular restaurant, which does not accept reservations, serves parties in the order that they arrive. For dinner, parties arrive with a rate uniformly distributed between 5 and 15 minutes. Parties range in size from 2 to 6 people, each with the same probability of arrival. Service time for each party, regardless of size, is 2 hours. Assume the restaurant has a capacity for 12 parties. Model this system.