/* Copyright (c) Edward Billard, 2008 */ /* This must be installed on a directory called JOS Use this class to set defaults Compile: javac JOS */ package JOS; public class JOS { // THE USER NEVER CHANGES THESE CONSTANTS // debug levels public static final int NODEBUG =0; public static final int USER =1; public static final int CONSTRUCTOR =2; public static final int IPC =3; public static final int TRANSITION =4; public static final int METHOD =5; // scheduling policies public static final int PRIORITY_POLICY = 1; public static final int FIFO_POLICY = 2; public static final int SJF_POLICY = 3; // number of blocks for JOSDISK public static final int DISKSIZE = 100; // number of buffers in buffer pool public static final int NUMBUFS = 20; // THE USER CAN TYPICALLY SET THESE VALUES // REMOTE: false, false, false, NODEBUG // cp JOS.remote JOS.class // LOCAL (with GUI): true, true, true, IPC // cp JOS.local JOS.class // set this to false for REMOTE LOGIN and get output to console. // OSmenu should not be used. Instead the user executes each // application individually, e.g., java DiningPhilosophersOK public static boolean useOutGUI = false; // set this to false for remote login if there is a readln public static boolean useInGUI = false; // if useOutGUI is false, then OSmenu will write to console // and exit with each selection. set this to true so that // OSmenu does not exit. public static boolean useOSmenu = false; // set the amount of debug public static int debugLvl = NODEBUG; // set the number of iterations for the applications public static int steps = 6; // THE USER SOMETIMES SETS THESE VALUES // set the maximum slowness of the display. large numbers mean slow. // units are in msec for each state transition (1000 = 1 sec) public static int maxSlowness = 1000; // a large number means the dots move slower. must be > 0 public static int maxdotSlowness = 100; // set the policy based on the constants above public static int schedulingPolicy = PRIORITY_POLICY; // set the alpha for the SJF formula (0..1.0) public static double alpha = 0.9; // THE USER RARELY SETS THESE VALUES // use a thread to do buffering of output public static boolean useOutController = false; // use a thread to do buffering of input public static boolean useInController = false; // set to false to avoid scheduling and let Java do it public static boolean useScheduler = true; // THE USER SHOULD NEVER MODIFY ANYTHING BELOW public static Debug dbug; public static OutProducer out; //ttyout public static InConsumer in; //ttyin public static DiskUpper disk; //disk in and out protected static Scheduler sch; public static Integer cntrl = new Integer(0); public static boolean cntrlFlag = false; protected static int slowness = maxSlowness; protected static int dotSlowness = maxdotSlowness; static { dbug = new Debug(); if (useScheduler) sch = new Scheduler(); out = new OutProducer("OutProducer"); in = new InConsumer("InConsumer"); disk = new DiskUpper("DiskUpper"); // for block I/O } }