-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
190 lines (180 loc) · 9.13 KB
/
index.html
File metadata and controls
190 lines (180 loc) · 9.13 KB
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title> Banker's Algorithm Simulator </title>
<link href="https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@400;500;600;700&family=Figtree:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="style.css">
</head>
<body>
<nav class="navbar">
<button class="hamburger" id="hamburgerBtn" onclick="toggleSidebar()" aria-label="Toggle menu">
<span></span><span></span><span></span>
</button>
<a class="nav-brand" href="#">
<div class="nav-brand-icon"> ⚙ </div>
OS Resource Simulator
</a>
<div class="nav-tabs" id="navTabs">
<button class="nav-tab active"> Simulator </button>
<button class="nav-tab" onclick="scrollToSection('sim-section')"> Deadlock Analysis </button>
<button class="nav-tab" onclick="scrollToSection('rag-section')"> Graph View </button>
<button class="nav-tab" onclick="alert('Coming soon: Theory + interactive learning modules!')">Learn</button>
</div>
<div class="nav-right">
<span class="nav-badge"> v1.0 </span>
<span class="nav-badge"> Banker's Algo </span>
</div>
</nav>
<div class="page-wrap">
<section class="hero">
<div class="hero-left">
<div class="hero-eyebrow">
<span class="pulse-dot"></span>
Operating Systems · Deadlock Avoidance
</div>
<h1> Banker's <br><span> Algorithm </span><br> Simulator </h1>
<p class="hero-sub"> An interactive visualizer for safe resource allocation, deadlock detection and recovery in operating systems. </p>
<div class="hero-tags">
<span class="hero-tag"> Safety Algorithm </span>
<span class="hero-tag"> Resource Allocation </span>
<span class="hero-tag"> Deadlock Detection </span>
<span class="hero-tag"> Need Matrix </span>
<span class="hero-tag"> RAG Visualization </span>
</div>
</div>
<div class="hero-right">
<div class="stat-card">
<div class="stat-label"> Algorithm </div>
<div class="stat-value" style="font-size:16px;color:var(--indigo);"> Banker's </div>
</div>
<div class="stat-card">
<div class="stat-label"> Mode </div>
<div class="stat-value" style="font-size:16px;color:var(--teal);"> Interactive </div>
</div>
<div class="stat-card">
<div class="stat-label"> Safety Check Complexity </div>
<div class="stat-value" style="font-size:16px;color:var(--violet);"> O(n²m) </div>
</div>
</div>
</section>
<section class="concept-strip">
<div class="concept-card">
<div class="concept-num"> ➤ STEP 01 </div>
<span class="concept-icon"> ⚙️ </span>
<div class="concept-title"> Configure </div>
<div class="concept-desc"> Set processes and resource types for your system. </div>
</div>
<div class="concept-card">
<div class="concept-num"> ➤ STEP 02 </div>
<span class="concept-icon"> 📊 </span>
<div class="concept-title"> Fill Matrices </div>
<div class="concept-desc"> Enter Allocation & Maximum. Need is auto-calculated. </div>
</div>
<div class="concept-card">
<div class="concept-num"> ➤ STEP 03 </div>
<span class="concept-icon"> ▶️ </span>
<div class="concept-title"> Run Algorithm </div>
<div class="concept-desc"> Watch safety algorithm execute step by step. </div>
</div>
<div class="concept-card">
<div class="concept-num"> ➤ STEP 04 </div>
<span class="concept-icon"> ✅ </span>
<div class="concept-title"> Inspect Result </div>
<div class="concept-desc"> View safe sequence or identify deadlocked processes. </div>
</div>
</section>
<div id="sidebarOverlay" class="sidebar-overlay" onclick="closeSidebar()"></div>
<div class="app-layout">
<aside class="sidebar" id="sidebar">
<div class="sidebar-close-row">
<button class="sidebar-close-btn" onclick="closeSidebar()" aria-label="Close sidebar"> ✕ Close </button>
</div>
<section class="card">
<div class="card-title">
<span class="card-title-dot"></span>
Configuration
</div>
<div class="field">
<label class="field-label" data-tip="Number of processes in the system"> Processes (n) </label>
<input type="number" id="processes" class="field-input" min="1" placeholder="e.g. 5">
</div>
<div class="field">
<label class="field-label" data-tip="Number of distinct resource types available"> Resource Types (m) </label>
<input type="number" id="resources" class="field-input" min="1" placeholder="e.g. 3">
</div>
<button class="btn btn-primary" onclick="generateTables()">
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><rect x="3" y="3" width="7" height="7"/><rect x="14" y="3" width="7" height="7"/><rect x="14" y="14" width="7" height="7"/><rect x="3" y="14" width="7" height="7"/></svg>
Generate Tables
</button>
</section>
<section class="card" id="sim-controls-card" style="display:none; opacity:0; transform:translateY(16px); transition: opacity 0.4s var(--ease-expo), transform 0.4s var(--ease-expo);">
<div class="card-title">
<span class="card-title-dot" style="background:var(--violet);"></span>
Simulation
</div>
<div class="speed-row">
<span class="speed-label"> Speed </span>
<input type="range" id="speedControl" min="200" max="2000" value="1000" step="100">
<span id="speedValue"> 1.0s </span>
</div>
<button id="runBtn" class="btn btn-run" onclick="startSimulation()">
<svg width="12" height="12" viewBox="0 0 24 24" fill="currentColor"><path d="M5 3l14 9-14 9V3z"/></svg>
Run Safety Algorithm
</button>
<button class="btn btn-secondary" onclick="runDeadlockDetection()" style="margin-top:8px;">
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="12"/><line x1="12" y1="16" x2="12.01" y2="16"/></svg>
Detect Deadlock
</button>
<button class="btn btn-secondary" onclick="resetSimulation()" style="margin-top:8px;">
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5"><path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/></svg>
Reset
</button>
</section>
<section class="card" id="req-card" style="display:none; opacity:0; transform:translateY(16px); transition: opacity 0.4s var(--ease-expo) 0.08s, transform 0.4s var(--ease-expo) 0.08s;">
<div class="card-title">
<span class="card-title-dot" style="background:var(--violet);"></span>
Resource Request
</div>
<span class="req-label"> Process </span>
<select id="processSelect"></select>
<span class="req-label"> Request Vector </span>
<div id="requestInputs"></div>
<button class="btn btn-primary" onclick="handleRequest()" style="background:var(--violet);box-shadow:0 2px 8px rgba(124,58,237,0.25);">
Submit Request
</button>
<div id="statusBox"></div>
</section>
</aside>
<div class="main-content">
<div id="tables-section"></div>
<div id="sim-section" style="display:none;">
<div id="diffPanel" style="display:none;"></div>
<div id="output" style="display:none;"></div>
<div class="rag-container" id="rag-section" style="display:none;">
<div class="rag-header">
<div class="card-title" style="margin:0;padding:0;border:none;">
<span class="card-title-dot" style="background:var(--teal);"></span>
Resource Allocation Graph
</div>
<div class="rag-legend">
<div class="rag-legend-item">
<div class="rag-legend-line" style="background:#16a34a;height:3px;"></div>
<span><b> Allocation: </b> Resource → Process </span>
</div>
<div class="rag-legend-item">
<div class="rag-legend-line" style="background:#dc2626;height:3px;"></div>
<span><b> Request: </b> Process → Resource </span>
</div>
</div>
</div>
<canvas id="ragCanvas" width="720" height="460"></canvas>
</div>
</div>
</div>
</div>
</div>
<script src="script.js" defer></script>
</body>
</html>