Real-Time Systems: Notes

Example Discrete Event Simulation in C

 

The example is comprised of the following modules:

prog4 (main program)

prog4.c is the only file; it depends on all the other modules; it calls the initialization functions of each of the other modules and then calls the simulator.

simulator (a generic discrete event simulator)

simulator.h is the interface;
simulator.c is the implementation;
it depends directly on module debug.

events ("guts" of the particular simulation)

events.h is the interface;
events.c is the implementation;
it depends directly on modules simulator, random, and debug; it uses the simulator interface to register callback handlers for events, and to schedule events, and the random interface to get timings.

random (probability model for the simulation)

random.h is the interface;
events.c is the implementation;
It also includes some miscellaneous other code, for debugging support and reading command line arguments.

© 2003 T. P. Baker. No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means without written permission.
$Id