forked from labouseur/AlanBBOS2013
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglobals.js
127 lines (86 loc) · 2.97 KB
/
globals.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/* ------------
Globals.js
Global CONSTANTS and _Variables.
(Global over both the OS and Hardware Simulation / Host.)
This code references page numbers in the text book:
Operating System Concepts 8th edition by Silberschatz, Galvin, and Gagne. ISBN 978-0-470-12872-5
------------ */
//
// Global CONSTANTS
//
var APP_NAME = "jOS F"; // 'cause I was at a loss for a better name.
var APP_VERSION = "1.00"; // What did you expect?
var CPU_CLOCK_INTERVAL = 100; // This is in ms, or milliseconds, so 1000 = 1 second.
var TIMER_IRQ = 0; // Pages 23 (timer), 9 (interrupts), and 561 (interrupt priority).
// NOTE: The timer is different from hardware/host clock pulses. Don't confuse these.
var KEYBOARD_IRQ = 1;
var ModeSwitch = 2;
// Schedules
var RR = "rr";
var FCFS = "fcfs";
var PRIORITY = "priority";
// Schedler Default
var DEFAULT_SCHEDULE = RR;
// Quantum for Round Robin
var DEFAULT_QUANTUM = 6;
// Default Priority
var DEFAULT_PRIORITY = 5;
// File System
var MBR_KEY = "[0,0,0]";
var NULL_TSB = "[-1,-1,-1]";
// Memory Defaults
var TOTAL_MEMORY = 768;
var MEM_BLOCK_SIZE = 255;
// PCB States
var PROCESS_NEW = 0; // Process newly created
var PROCESS_LOADED = 1; // Process loaded in memory
var PROCESS_READY = 2; // Process added to ready queue awaiting execution
var PROCESS_RUNNING = 3; // Process currently executing
var PROCESS_TERMINATED = 4; // Process finished executing
var DISK_PROCESS = 5;
//
// Global Variables
//
var _UsedQuantum = DEFAULT_QUANTUM; // Currently Being used quantum
var _PID = 0;
var _CPU = null;
var _Memory = null;
var _MemoryManager = null;
var _CurrentProcess = null;
var _ReadyQueue = null;
var _ProcessList = null;
var _Scheduler = null;
var _CycleCount = 1;
var _MemoryTableCells = null;
var _DiskTableCells = null;
var _OSclock = 0; // Page 23.
var _Mode = 1; // 0 = Kernel Mode, 1 = User Mode. See page 21.
var _Canvas = null; // Initialized in hostInit().
var _TaskbarCanvas = null; // Initialized in hostInit().
var _DrawingContext = null; // Initialized in hostInit().
var _TaskbarContext = null; // Initialized in hostInit().
var _DefaultFontFamily = "sans"; // Ignored, I think. The was just a place-holder in 2008, but the HTML canvas may have use for it.
var _DefaultFontSize = 13;
var _FontHeightMargin = 4; // Additional space added to font size when advancing a line.
// Default the OS trace to be on.
var _Trace = true;
// OS queues
var _KernelInterruptQueue = null;
var _KernelBuffers = null;
var _KernelInputQueue = null;
var _ShellList = null;
// Standard input and output
var _StdIn = null;
var _StdOut = null;
var _Date = null;
// UI
var _Console = null;
var _OsShell = null;
var _SystemStatus = "Running";
// At least this OS is not trying to kill you. (Yet.)
var _SarcasticMode = false;
// Global Device Driver Objects - page 12
var krnKeyboardDriver = null;
var krnFileSystemDriver = null;
// For testing...
var _GLaDOS = null;