|
1 | 1 | # CloudKernel |
2 | 2 |
|
3 | | -CloudKernel is a Java concurrency simulator with a professional Swing dashboard that visualizes hypervisor-like VM scheduling, shared resource contention, and synchronization. |
4 | | - |
5 | | -## 📋 Project Information |
6 | | - |
7 | | -| Field | Details | |
8 | | -|-------|---------| |
9 | | -| **Subject** | Operating Systems | |
10 | | -| **Semester** | 4th Semester — BSAI 2k24 | |
11 | | -| **Institute** | NFC Institute of Engineering & Technology, Multan | |
12 | | -| **Department** | Artificial Intelligence | |
13 | | -| **Submitted To** | Mam Amara Nadeem — [ammara.visiting@nfciet.edu.pk](mailto:ammara.visiting@nfciet.edu.pk) | |
14 | | -| **Submission Date** | March 03, 2026 | |
15 | | - |
16 | | ---- |
17 | | - |
18 | | -## 👥 Team Members |
19 | | - |
20 | | -| Name | Roll Number | Email | |
21 | | -|------|-------------|-------| |
22 | | -| Muawiya Amir | 2k24_BSAI_72 | [2k24bsai72@undergrad.nfciet.edu.pk](mailto:2k24bsai72@undergrad.nfciet.edu.pk) | |
23 | | -| Ali Raza | 2k24_BSAI_44 | [2k24bsai44@undergrad.nfciet.edu.pk](mailto:2k24bsai44@undergrad.nfciet.edu.pk) | |
24 | | -| Muhammad Arslan Nasir | 2k24_BSAI_26 | [2k24bsai26@undergrad.nfciet.edu.pk](mailto:2k24bsai26@undergrad.nfciet.edu.pk) | |
25 | | -## Highlights |
26 | | - |
27 | | -- Dark-theme dashboard: Cloud hypervisor monitor layout. |
28 | | -- Boot orchestration with CountDownLatch. |
29 | | -- VM cycle synchronization with CyclicBarrier. |
30 | | -- Shared CPU, memory, and network resources with fair semaphores and timeout handling. |
31 | | -- Color-coded live logs streamed to terminal and GUI simultaneously. |
32 | | -- Live stats for cycles, operations, contentions, timeouts, and uptime. |
33 | | -- Configurable behavior through config.properties. |
34 | | - |
35 | | -<img src ="img/banner.png"> |
36 | | -## Final Package Structure |
37 | | - |
38 | | -```text |
39 | | -CloudKernel/ |
40 | | - src/ |
41 | | - Main.java |
42 | | - config/ |
43 | | - ConfigLoader.java |
44 | | - core/ |
45 | | - BootManager.java |
46 | | - ClockSynchronizer.java |
47 | | - entities/ |
48 | | - ResourceManager.java |
49 | | - VirtualMachine.java |
50 | | - VMPriority.java |
51 | | - VMState.java |
52 | | - VMStats.java |
53 | | - shutdown/ |
54 | | - ShutdownManager.java |
55 | | - ui/ |
56 | | - BarrierPanel.java |
57 | | - CloudKernelGUI.java |
58 | | - ControlPanel.java |
59 | | - DashboardUpdater.java |
60 | | - LogPanel.java |
61 | | - ResourceMonitorPanel.java |
62 | | - StatsBar.java |
63 | | - VMCard.java |
64 | | - utils/ |
65 | | - GUILogger.java |
66 | | - StatsCollector.java |
67 | | - config.properties |
68 | | - ARCHITECTURE.md |
69 | | - doc/ |
70 | | - PROJECT_PROPOSAL.md |
71 | | - PROJECT_Report.md |
72 | | - Project_presentation.ppt |
73 | | -
|
74 | | -
|
75 | | -``` |
76 | | - |
77 | | -## GUI Overview |
78 | | - |
79 | | -Main window sections: |
80 | | - |
81 | | -- Header: title, digital clock, online indicator. |
82 | | -- Boot panel: resource chips and latch countdown. |
83 | | -- VM dashboard: one card per VM with state, priority, progress, and resource indicators. |
84 | | -- Left sidebar: semaphore slot view for CPU, memory, and network. |
85 | | -- Barrier panel: arrival dots and cycle display. |
86 | | -- Right sidebar: color-coded live event log. |
87 | | -- Bottom bars: statistics and controls. |
88 | | - |
89 | | -## Core Concurrency Model |
90 | | - |
91 | | -- Boot phase: CountDownLatch initialized to four boot tasks. |
92 | | -- Runtime phase: each VM executes for configured cycles. |
93 | | -- Resource phase: each VM requests CPU, memory, and network permits with timeout. |
94 | | -- Synchronization phase: all VMs rendezvous at a CyclicBarrier before the next cycle. |
| 3 | +CloudKernel is a Java concurrency simulator with a Swing dashboard that models a |
| 4 | +hypervisor managing virtual machines. A configurable number of VM threads boot |
| 5 | +together, compete for shared CPU, memory, and network resources, and synchronize |
| 6 | +at the end of each execution cycle, while the GUI shows their state, resource |
| 7 | +usage, and a live event log in a dark-theme monitor layout. |
| 8 | + |
| 9 | +<img src="img/banner.png"> |
| 10 | + |
| 11 | +## How it works |
| 12 | + |
| 13 | +- Boot phase: a CountDownLatch holds the VMs until four boot tasks complete. |
| 14 | +- Runtime phase: each VM runs a configured number of cycles with randomized |
| 15 | + workload durations. |
| 16 | +- Resource phase: VMs acquire CPU, memory, and network permits from fair |
| 17 | + semaphores, with a timeout so contention never deadlocks. |
| 18 | +- Synchronization phase: all VMs rendezvous at a CyclicBarrier before starting |
| 19 | + the next cycle. |
| 20 | + |
| 21 | +The main window shows a header with a digital clock, a boot panel with the |
| 22 | +latch countdown, one card per VM (state, priority, progress, held resources), |
| 23 | +a semaphore slot view for each resource, a barrier panel with arrival dots, |
| 24 | +a color-coded event log, and a stats/control bar. Logs stream to the terminal |
| 25 | +and the GUI at the same time, and stats track cycles, operations, contentions, |
| 26 | +timeouts, and uptime. Worker threads never touch Swing directly; all UI updates |
| 27 | +go through SwingUtilities.invokeLater. |
| 28 | + |
| 29 | +Source lives under `src/` in packages: `config` (ConfigLoader), `core` |
| 30 | +(BootManager, ClockSynchronizer), `entities` (VirtualMachine, ResourceManager, |
| 31 | +VM state/priority/stats), `shutdown` (ShutdownManager), `ui` (the dashboard |
| 32 | +panels), and `utils` (GUILogger, StatsCollector). `Main.java` is just the GUI |
| 33 | +entry point. Design details are in `ARCHITECTURE.md`, and the proposal, report, |
| 34 | +and slides are in `doc/`. |
95 | 35 |
|
96 | 36 | ## Configuration |
97 | 37 |
|
98 | | -Edit config.properties before running: |
99 | | - |
100 | | -- vm.count |
101 | | -- cycle.count |
102 | | -- semaphore.cpu.permits |
103 | | -- semaphore.memory.permits |
104 | | -- semaphore.network.permits |
105 | | -- task.duration.min |
106 | | -- task.duration.max |
107 | | -- timeout.duration |
108 | | -- gui.enabled |
109 | | -- gui.theme |
110 | | -- gui.font |
111 | | -- logging.level |
112 | | -- stats.enabled |
| 38 | +Edit `config.properties` before running. It sets the VM count, cycles per VM, |
| 39 | +permit counts for the CPU/memory/network semaphores, min/max task duration, |
| 40 | +acquire timeout, GUI options (enabled, theme, font), logging level, and whether |
| 41 | +stats collection is on. |
113 | 42 |
|
114 | | -## Build And Run |
| 43 | +## Build and run |
115 | 44 |
|
116 | | -From CloudKernel root: |
| 45 | +From the CloudKernel root on Windows (PowerShell): |
117 | 46 |
|
118 | 47 | ```powershell |
119 | 48 | javac -encoding UTF-8 -d bin (Get-ChildItem -Recurse src -Filter *.java | ForEach-Object { $_.FullName }) |
120 | 49 | java -cp "bin;." Main |
121 | 50 | ``` |
122 | 51 |
|
123 | | -## Notes |
| 52 | +On Linux/macOS the equivalent is: |
| 53 | + |
| 54 | +```bash |
| 55 | +javac -encoding UTF-8 -d bin $(find src -name '*.java') |
| 56 | +java -cp "bin:." Main |
| 57 | +``` |
124 | 58 |
|
125 | | -- All UI updates triggered by worker threads are dispatched through SwingUtilities.invokeLater. |
126 | | -- Main.java contains only the GUI entry point. |
127 | | -- Legacy duplicate docs and unused legacy classes were removed to keep one canonical implementation path. |
| 59 | +## Credits |
128 | 60 |
|
| 61 | +Operating Systems project, 4th semester BSAI 2k24, Department of Artificial |
| 62 | +Intelligence, NFC Institute of Engineering & Technology, Multan. |
| 63 | +Submitted to Mam Amara Nadeem (ammara.visiting@nfciet.edu.pk) on March 03, 2026. |
129 | 64 |
|
| 65 | +Team: Muawiya Amir (2k24_BSAI_72, 2k24bsai72@undergrad.nfciet.edu.pk), |
| 66 | +Ali Raza (2k24_BSAI_44, 2k24bsai44@undergrad.nfciet.edu.pk), |
| 67 | +Muhammad Arslan Nasir (2k24_BSAI_26, 2k24bsai26@undergrad.nfciet.edu.pk). |
0 commit comments