![]() |
![]() |
![]() |
![]() |
![]() |
Implementation of the Model
Mapping of Queue Models to SDL
A queuing network model may easily be described in SDL. Appropriate mapping rules are, for example:
- A server is implemented as a process and the queue as a variable in the server process.
- Jobs are described as data objects, that is, as passive entities that can be inserted into queues.
- Job generators are implemented as processes.
- Signals, with jobs as parameters, are used to send the jobs from job generators to servers and from servers to other servers.
Abstract Data Types for Queues and Random Numbers
In the implementation of the model there will be extensive use of queues and jobs and of queue manipulations, for example inserting a job into a queue. The The ADT Library provides an abstract data type specially designed for this purpose. See Abstract Data Types for List Processing.
The ADT library also contains an abstract data type that can be used to generate random numbers. This data type can, for example, be used to draw job lengths and inter-arrival times according to a given distribution. See Abstract Data Type for Random Numbers.
Random numbers are, in most situations in a performance simulation, used to model time intervals (for example service time required for a job) or to model a number of something (the number of jobs to be generated by a job generator at a certain time). The abstract data type for random numbers therefore contains the possibility to generate random numbers according to distributions returning non-negative values, for example:
- Negative exponential distribution
- Erlang distribution
- Hyperexponential distribution
- Uniform distribution
- Poisson distribution.
Implementation of Job Generators and Servers
To give a better understanding of job generators and servers, two process graphs are presented in Figure 565 and Figure 566, showing simple but typical processes.
A job generator sets a timer, and when the timer time expires, it generates a new job, sends it into the queuing system and sets the timer again. The time value in the set statements is usually Now + some random time interval. Note that the data types Queue and ObjectInstance are defined in the abstract data types for queue handling that are included in the ADT library (see Abstract Data Types for List Processing).
The most important observation concerning the server process, is that the act of giving service is modeled by letting the server process wait in the state Busy. It is thus only the time needed for the service that is modeled. Otherwise the process is rather straight forward. The variable Job is used to refer to the job that is currently given service and the variable Q is used to store other jobs waiting for service. The queuing discipline will be implemented in the details in the tasks "Next to be served in Q", "Insert Job in Q" and "Remove Job from Q".
I/O and Performance Simulations
A performance simulation uses I/O mainly for two things:
A specially designed abstract data type for the purpose of simplifying I/O is included in the ADT library (see Abstract Data Type for File Manipulations and I/O). With this data type it is possible to open files and to perform read and write operations in SDL.
It is, of course, interesting to parameterize a performance simulation on, for example, seed values for random generators, mean values for inter-arrival times and service times.
These values should be read at simulation start-up time. In SDL the concept of external synonyms can be used for such a purpose. As synonyms can only be defined in processes, not in instances, it is difficult to handle cases when the process instances should have different values for a certain simulation parameter. In such cases the abstract data type for I/O operations can be useful.
The second category of I/O mentioned above is printing of measurement data. There are basically two different types of measurements that have to be handled in a performance simulation.
- Data concerning jobs such as waiting times.
It is usually best to store this type of data in the job itself, until the job leaves the system, when the appropriate values are printed on a file.- Queue lengths and other related data.
Such data is easiest to handle by introducing measurement processes that with regular time intervals print the queue lengths on file.The best way to obtain the queue lengths is, in most situations, to let the measurement process view (or import) the appropriate queue variables. Otherwise a signal interface must be implemented only for measurement purposes.
The reason for printing all measurement data on file is that it is difficult to compute the relevant statistical entities at simulation time. If only the mean values are of interest, these are simple to compute, but if variances and confidence intervals are to be computed it is better to let a professional statistical tool perform the job.
Note that data series produced from a simulation contains dependent data. If, for example, a job has been subject to a long waiting time, then the probability is high that the next job will also have a long waiting time.
Exit from a Simulation
The appropriate way to terminate the execution of a performance simulation is to call the function SDL_Halt(). It is best performed by introducing the call in a #CODE directive in a task symbol (see Including C Code in Task - Directive #CODE). SDL_Halt is a function in the run-time library with the following prototype:
void SDL_Halt (void);Execution with the Library Performance Simulation
As mentioned earlier, you may use the library PerformanceSimulation to speed up the execution of a performance simulation. This library has the same properties as the library Simulation, except that it does not contain the monitor system, which may increase the execution speed by a factor of 10 to 15.
Use the library Simulation to debug and verify the simulation model. Then select the library PerformanceSimulation in the make dialog in the Organizer (see Make) and press the button Make. The thereby generated performance simulation may be executed from the OS as an ordinary program.
http://www.ibm.com/rational |
![]() |
![]() |
![]() |
![]() |