CS457 - System Performance Evaluation - Winter 2008


Questions and Comments

  1. Results of A1 and midterm.

Lecture 19 - Simulation Architecture Examples


Event Scheduling Program

* marks parts that do not vary from program to program

Highest Level Description

initialize( ); //*
while ( ( event = event-set.next( ) ) != nil ) process( event );
log.output( ); //*

Initialization

initialize( ) {
  clock.init( ); //*
  state.init( ); //*
  event-set.init( ); //*
  log.init( ); //*
  queue.init( ); //*
}

Event Processing

process( event ) {
  clock = event.time; //*
  log.update( event ); //*
  switch( event.type ) { //*
    case ARRIVAL: arrive( event ); //*
    case DEPARTURE: depart( event ); //*
  }
}

Important difference between then and now

Once upon a time

Now

Server with One Queue

Sequence of events

Response variables

Factors

Assumptions

  1. Some things are independent of everything else
  2. FCFS scheduling
  3. System starts empty
  4. Infinite population (open model)

State variuables

Initialization

clock.init( ) { time = 0 } //*
state.init( ) { n = 0; status = IDLE }
log.init( ) { /* open output channel */ }
event-set.init( ) { event-set.insert( new-arr-event( ) ) }
queue.init( ) { queue.empty( ) }

Arrival event

arrive( event ) { log.update( event ); n++; queue.insert( event ); if( status == IDLE ) start-service( event ) }

Departure event

depart( event ) { log.update( event ); status = IDLE; if( --n ) start-service( event ) }

Utility routines

event new-arr-event( ) { this.time = clock + SCALE * random( ); this.type = ARRIVAL }
event new-dep-event( event ) { this.time = clock + event.serv-time; this.type = DEPARTURE }
start-service( event ) { log.update( ); job = queue.next( ); state.status = BUSY; event-set.insert( new-dep-event( event ) ) }

Left as exercises for the reader

  1. Trace through the samples and make certain that it all goes as you expect.
  2. Find out the slightly different termination condition than the example in the notes.
  3. Think about what should go in all the updates of the log.

More Examples

Parallel servers

State variable is number-busy

Finite waiting room

Finite Population Model

Tandem Queue

Processor Sharing

Broadcast Delivery


Return to: