home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-02-20 | 2.8 KB | 88 lines |
-
- package examples.computer;
-
-
- import simula.* ;
- import simula.random.* ;
- import simula.simset.* ;
- import simula.simset.simulation.* ;
-
- /**
- * Multiprogrammed computer system
- * @author Andrea Poltronieri
- * @version 1.0 12 Feb 1998
- */
-
- public class ComputerSimulation extends Simulation{
- // Global vars declaration ;
- /** Simulation length */
- public double simperiod ;
- /** Number of jobs arrived */
- public int result=0 ;
- /** Active jobs queue */
- public Head inner=null ;
- /** Waiting jobs queue */
- public Head outer=null ;
-
- /** Seed for random generators */
- public int seed ;
-
- /** Free pages available */
- public int free ;
-
- /** Process tha performs jobs scheduling and serving */
- public Server server ;
-
- // Simulation parameters
- /** Arrivals frequency */
- public double arr ;
- /** Total pages of memory */
- public int m ;
- /** Lower bound for number of pages requested */
- public int m1 ;
- /** Upper bound for number of pages requested */
- public int m2 ;
- /** Size for a quanta of service */
- public double s ;
- /** Probability of service request */
- public double q ;
- /** time of last event */
- public double lastevent = 0;
-
-
-
- /**
- * Print credits on standar error.
- */
- private static void credits ( ) {
- System.err.println("***********************************************************") ;
- System.err.println("* Example for Korretto *") ;
- System.err.println("* Multiprogrammed computer system *") ;
- System.err.println("* see 'Simulation techiniques for discrete event systems' *") ;
- System.err.println("* I. Mitrani -- Cambridge University press *") ;
- System.err.println("* ex 3.3 *") ;
- System.err.println("***********************************************************") ;
- System.err.println("* author : Andrea Poltronieri *") ;
- System.err.println("* Verona University *") ;
- System.err.println("* e-mail : poltro@arena.sci.univr.it *") ;
- System.err.println("* http://arena.sci.univr.it/~poltro *") ;
- System.err.println("***********************************************************") ;
- return;
- }
- /**
- * Start the simualtion, instantiating a new Simulation and launching the main program
- * @param args[] Ignored
- * @see simula.simset.simulation.Simulation
- * @see simula.simset.simulation.SimulationMain
- */
- public static void main(String args[]) {
- try {
- credits() ;
- ComputerSimulation sim = new ComputerSimulation();
- ComputerMain main = new ComputerMain(sim);
- } catch (Exception e) {
- System.err.println ("Exception caught while lanching Computer :\n"+e) ;
- }
- return;
- }
- }