Site Navigation


Welcome

Introduction

TCP Simulator
Operation

Running the
Simulator

Simulator
Capabilities and
Limitations

Downloads

Java Class
Documentation

Log Book

Useful Links



Email Me

TCP Simulator Operation => Simulator Engine


Simulator Engine

The simulator engine provides the TCP and Transmission Link Layers with an event scheduler that allows them to schedule events for future execution. The following is a brief description of how the engine works. For a complete explanation, please refer to Section 3.2 in the thesis.

Simulator Engine Components

The TCP simulator engine consists of 3 components.
  • Queue Event
    • Represents an event in the simulator and holds data associated with the event as well as a reference to the handler that processes the event. When an event occurs, a corresponding Queue Event is created and dispatched (immediately or later via the Event Queue) by activating its handler.

  • Event Queue
    • Schedules, stores and dispatches Queue Events scheduled for execution in the future.
  • Timer Engine
    • Keeps track of time in the simulator and triggers the execution of Queue Events stored in the Event Queue every time cycle .
Note that whereas Queue Events represent the events to be dispatched, the Event Queue and Timer Engine form the actual event scheduler.

These components interact as follows.

  1. Whenever an event is scheduled to occur in the future, a corresponding Queue Event is created and passed to the Event Queue that stores it for future execution.


  2. The actual execution of Queue Events is triggered by the Timer Engine which keeps track of time in the simulator via a counter that is periodically incremented every time cycle. During each cycle, the Event Queue is called to retrieve and sequentially dispatch all Queue Events scheduled for the current time.


  3. On completion, the Timer Engine increments its counter proceeds to the next time cycle.
The above cycle continues until the user stops the simulation. It is this continual scheduling of Queue Events on the Event Queue and the subsequent triggering of their execution by the Timer Engine that drives the TCP simulator forward.


Simulator Engine Operation Example

A practical example of how events are scheduled for future execution using the simulator engine is provided below. This example shows what occurs when a TCP Layer schedules a TCP timer (any type) expiry event.

Simulator Engine Operation Example 1

Steps 1-3 shows what occurs when the TCP Layer wishes to set a TCP timer (Step 1) of any type; a new Queue Event corresponding to that timer is created (Step 2) and placed on the Event Queue to be executed at some future time corresponding to the expiry time of the timer (Step 3).

Simulator Engine Operation Example 2

Steps 4-8 then shows how the scheduled Queue Event is subsequently dispatched; The Timer Engine advances the simulator time by incrementing the time counter (Step 4) and calling the Event Queue to dispatch any scheduled Queue Events (Step 5). When the Timer Engine's time counter reaches the TCP Timer Queue Event's scheduled execution time, the Event Queue dispatches the queue of previously scheduled Queue Events (Step 6), including the TCP Timer Queue Event (Step 7), causing the TCP Timer's handler in the TCP Layer to be activated (Step 8) to process the event.