CS457 - System Performance Evaluation - Winter 2008


Questions and Comments

  1. Due time for A2.

Lecture 18 - Simulation Architectures


Model Example. Routing for automated telephone support

For a more CS-like example see this pdf.


Structure of Software for Discrete Event Simulation

Two possible approaches

  1. Follow a request (job) through the system
  2. Event-scheduling approach

Event Scheduling

  1. Events
  2. Event set - queue of events, which means

    Two important operations

    1. Remove the earliest event from now.
    2. Insert an event.

    These will be done equally often (Why?)

  3. Two key assumptions
    1. Events are defined so that the system never changes state without an event occurring.
    2. Events can schedule other events, but never in the past.
      This is called causality.
  4. Defining system state is the most important aspect of abstraction.

Event Scheduling Program

* marks parts that do not vary from program to program

Highest Level Description

Initialize( ); //*
while ( ( event = GetNextEvent( event-set ) ) != nil ) { //*
    clock.time = event.time; //*
    process-event( event ); //*
}
log.output( ); //*

Initialization

clock.init( ); //*
state.init( ); //*
event-set.init( ); //*
log.init( ); //*

Event Processing

log.update( event ); //*
event-set.insert( new-event( ) ) //*
// Possibly test for termination
state.update( event ); //*

Server with One Queue

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-state.init( ) { queue.insert( new-event( ) ) }

Arrival event

log.update( event ) { /* whatever */ } 
state.update( event ) { n++; queue.insert( event ); if( status == IDLE ) start_service( ) }

Departure event

log.update( event ) { /* whatever */ } 
state.update( event ) { status = IDLE; if( --n ) { start_service( ) }

Utility routines

event new-event( ) { incr = SCALE * random( ); event.time = clock + incr, event.type = ARRIVAL }
start-service( ) {
    state.status = BUSY;

Return to: