How sambhav1501/cpu-scheduler-simulator works
Project type and purpose
• This is a static, client-side Interactive Web Application (“CPU Scheduler Simulator”) meant for educational use.
• It runs entirely in the browser (no server-side code), visualizes CPU scheduling algorithms in real-time, and provides documentation and about pages.
File structure
• Top level
• index.html – Landing page
• docs.html – Documentation
• about.html – Team info
• style.css, docs.css – Global styles
• images/, img/ – Assets
• backend/ – Core simulator module
• backend folder
• css/ – Simulator-specific styles (bootstrap-simplex.css, cpu-scheduler.css, explanation.css)
• js/ – Algorithm engine & UI scripts (cpu-scheduler.js, new.js, bootstrap-slider.js, MathJaxSetup.js)
• ganttcharts.html – Main simulation interface (loads engine, renders Gantt)
README for additional insights
• Frontend only: HTML5, CSS3 (Bootstrap), JavaScript (ES6+), Chart.js, MathJax
• Key components called out: Algorithm Engine, Visualization System (Gantt), Calculation Engine, Responsive Design
a. Main components
1. Static Asset Host (e.g., GitHub Pages)
2. Browser (Client)
• UI Layer (HTML5 + CSS + Bootstrap)
• Controller Layer (Event handlers in JS)
• Model Layer (Process data structures + metrics)
• Algorithm Engine (Preemptive & non-preemptive schedulers)
• Calculation Engine (waiting time, turnaround time, CPU utilization)
• Visualization Engine (Chart.js + Gantt module)
• Documentation Module (docs.html + MathJax explanations)
b. Relationships & data flow
1. User opens index.html → Browser requests static assets from host
2. User navigates to ganttcharts.html → JS Controller initializes Algorithm Engine & UI
3. User inputs processes → Controller stores in Model
4. Controller invokes Algorithm Engine → produces execution sequence
5. Calculation Engine derives performance metrics → updates Model
6. Visualization Engine (Chart.js) reads Model → renders dynamic Gantt chart
7. UI Layer displays metrics, step-by-step explanation (MathJax for formulas)
c. Architectural patterns & principles
• Modular Frontend: separation of concerns (Algorithm, Calculation, Visualization, UI, Styling)
• MVC-like flow: Model (process data), View (HTML/CSS/Chart), Controller (JS events)
• Static-site deployment: simplicity, no backend server
d. Key technologies
• HTML5, CSS3, Bootstrap (UI)
• JavaScript ES6+ (logic)
• Chart.js (Gantt charts)
• MathJax (formula rendering)
• bootstrap-slider (parameter input)