CS457 - System Performance Evaluation - Winter 2010


Public Service Announcements

  1. Assignment 2.
  2. Final Examination: April 21st, 2010 at 09.00 in the PAC.
  3. Wrong dates of lecture notes page

Lecture 18 - Examples of Discrete Event Simulation II

Structure of Software for Discrete Event Simulation

Event Scheduling Components

Event Scheduling Program

Highest Level Description

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

Initialization

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

Event Processing

process-event( event ){
    log.update( /* Whatever */ ); //*
    clock = event.time; //*
    state.update( event ); //*
    // Possibly test for termination
}

Server with One Queue

Response variables

Parameters = Factors, which need to be defined

Interarrival
Times
Deterministic Stochastic
Service
Times
Deterministic Common Very unlikely
Stochastic Possible Very Common

Assumptions

  1. Stochastic things are independent of each other
  2. FCFS scheduling
  3. System starts empty
  4. Infinite population (open model)

State variables

Initialization

clock.init( ) { time = 0 } //*
state.init( ) { n = 0; status = IDLE }
log.init( ) { /* open standard output */ }
event-state.init( ) { event-set.insert( new-event( ARRIVAL, clock.time( ) ) ) }

State & Event-set Manipulation

state.update( event ) {
    switch( event.type ) {
    case ARRIVAL:
        event-set.insert( new-event( ARRIVAL, event.time ) );
        n++; queue.insert( event );
        if( status == IDLE ) start_service( );
        return;
    case DEPARTURE:
        n--; status = IDLE;
        if ( n ) start_service( );
        return;
    }
}

Explanation.

Utility routines

event new-event( type, time ) {
    this.type = type;
    switch( type ) {
    case ARRIVAL:
        this.time = event.arrival-time( time );
        return this;
    case DEPARTURE:
        this.time = time + event.service-time( );
        return this;
    }
}

start-service( event ) {
    log.update( /* Whatever */ );
    state.status = BUSY;
    event-set.insert( new-event( DEPARTURE, event.time ) ) 
}

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.

Important.

Parallel servers: one queue, multiple servers

State variables are

  1. m: number of servers that are currently busy
  2. n: number of requests in the system, including ones in the server

How should it be updated and used?

Finite Population Model

We saw this as an application of Little's Law.

Each user does the following

  1. Think
  2. Submit request
  3. Wait
  4. Receive result
  5. Goto 1.

Each request

  1. Wait in queue
  2. Receive service

Note. User's wait time is not the same as request's wait time.

State

In the event set there are always N events

Exercise for the reader. What are the conditions for starting service?

Tandem Queue

The principle is quite easy

but we would rather do this as one simulation. (Programming with signals is not fun.)

System state

The events in the event set are

What happens for each?

  1. A 1.
  2. Dn
  3. DM
  4. start-Sn

Processor Sharing

Time-slicing model: pre-emptive multi-tasking

For example, three classes of jobs

  1. Jobs with active I/O: long think times, very little processing
  2. Interactive jobs without active I/O: substantial processing that will stop and start at widely spaced times
  3. Batch jobs: which go on for very long times.

Single server, three queues, needs a scheduling algorithm (discipline)

Important state

Initialization

Arrival

Departure

Start-service

Something is unrealistic about this model. What is it?

Something is unintuitive about this model. What is it?

This is always the case.


Return to: