|
1 | | -# CloudKernel βοΈβοΈ |
| 1 | +# CloudKernel |
2 | 2 |
|
3 | | -## Overview |
| 3 | +CloudKernel is a Java concurrency simulator with a professional Swing dashboard that visualizes hypervisor-like VM scheduling, shared resource contention, and synchronization. |
4 | 4 |
|
5 | | -**CloudKernel** is a small Java-based simulation created for our **Operating Systems Lab**. |
6 | | -The purpose of this project is to show how a hypervisor-like system can manage multiple **Virtual Machines (VMs)** while coordinating shared resources. |
| 5 | +## π Project Information |
7 | 6 |
|
8 | | -Instead of building a real operating system, this project focuses on demonstrating **important OS concepts** like synchronization, resource sharing, and concurrent execution using Java threads. |
9 | | - |
10 | | -The program simulates a system where several virtual machines start after the system boots, run tasks together, and share limited network resources. |
11 | | - |
12 | | ---- |
13 | | - |
14 | | -## π Academic Information |
15 | | - |
16 | | -**Course:** Operating Systems Lab |
17 | | -**Semester:** 4th Semester |
18 | | - |
19 | | -**Submitted to:** |
20 | | -Mam Amara Nadeem |
21 | | - |
22 | | -**Submitted by:** |
23 | | - |
24 | | -- **Moavia Amir** (2k24_BSAI_72) |
25 | | -- **Ali Raza** (2k24_BSAI_44) |
26 | | -- **Muhammad Arslan Nasir** (2k24_BSAI_26) |
27 | | - |
28 | | -**Submission Date:** |
29 | | -March 03, 2026 |
30 | | - |
31 | | ---- |
32 | | - |
33 | | -## π― Project Goals |
34 | | - |
35 | | -This project was designed to help understand how operating systems manage: |
36 | | - |
37 | | -- System boot coordination |
38 | | -- Thread synchronization |
39 | | -- Limited resource sharing |
40 | | -- Parallel execution of processes |
41 | | - |
42 | | -All these ideas are implemented using **Java concurrency utilities**. |
43 | | - |
44 | | ---- |
45 | | - |
46 | | -## βοΈ Key Concepts Used |
47 | | - |
48 | | -### 1. System Boot Coordination |
49 | | - |
50 | | -Before any virtual machine starts running, the system must finish its boot process. |
51 | | - |
52 | | -We simulate this using **CountDownLatch**. |
53 | | -It ensures that resources like **Disk and RAM** are ready before the virtual machines begin execution. |
| 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 | |
54 | 15 |
|
55 | 16 | --- |
56 | 17 |
|
57 | | -### 2. VM Cycle Synchronization |
| 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 |
58 | 73 |
|
59 | | -Each virtual machine performs its work in cycles. |
60 | | -To keep them synchronized, we use **CyclicBarrier**. |
61 | | - |
62 | | -This means all VMs must finish a cycle before the next one begins. |
63 | | - |
64 | | ---- |
65 | 74 |
|
66 | | -### 3. Limited Network Access |
67 | | - |
68 | | -In real systems, hardware resources are limited. |
69 | | -In this simulation, only **two VMs can use the network at the same time**. |
70 | | - |
71 | | -This is managed using a **Semaphore**, which controls access to the shared network ports. |
72 | | - |
73 | | ---- |
74 | | - |
75 | | -## π§© Project Structure |
76 | | -``` |
77 | | -CloudKernel |
78 | | -β |
79 | | -βββ src |
80 | | -β β |
81 | | -β βββ Main.java |
82 | | -β β |
83 | | -β βββ core |
84 | | -β β βββ BootManager.java |
85 | | -β β βββ ClockSynchronizer.java |
86 | | -β β βββ NetworkPortManager.java |
87 | | -β β |
88 | | -β βββ entities |
89 | | -β β βββ VirtualMachine.java |
90 | | -β β |
91 | | -β βββ utils |
92 | | -β βββ Logger.java |
93 | | -β |
94 | | -βββ doc |
95 | | -β βββ proposal |
96 | | -β |
97 | | -βββ README.md |
98 | 75 | ``` |
99 | | ---- |
100 | 76 |
|
101 | | -## π System Workflow |
| 77 | +## GUI Overview |
102 | 78 |
|
103 | | -The program runs in the following order: |
| 79 | +Main window sections: |
104 | 80 |
|
105 | | -``` |
106 | | -System Boot |
107 | | -β |
108 | | -βΌ |
109 | | -BootManager initializes resources |
110 | | -β |
111 | | -βΌ |
112 | | -Virtual Machines start (Threads) |
113 | | -β |
114 | | -βΌ |
115 | | -VMs execute cycles together |
116 | | -β |
117 | | -βΌ |
118 | | -Network access controlled by Semaphore |
119 | | -β |
120 | | -βΌ |
121 | | -Logs printed to terminal |
122 | | -``` |
| 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. |
123 | 88 |
|
124 | | ---- |
| 89 | +## Core Concurrency Model |
125 | 90 |
|
126 | | -## βΆοΈ How to Run the Project |
| 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. |
127 | 95 |
|
128 | | -### 1. Compile the project |
| 96 | +## Configuration |
129 | 97 |
|
130 | | -```bash |
131 | | -javac -d out -sourcepath src src/Main.java |
132 | | -``` |
133 | | -### 2. Run the program |
134 | | -```bash |
135 | | -java -cp out Main |
136 | | -``` |
137 | | -## π₯ Example Output |
| 98 | +Edit config.properties before running: |
138 | 99 |
|
139 | | -When the program runs, you may see output like: |
140 | | -``` |
141 | | -[BOOT] Disk initialized |
142 | | -[BOOT] RAM initialized |
143 | | -[BOOT] System ready |
144 | | -
|
145 | | -[VM-1] Starting execution |
146 | | -[VM-2] Starting execution |
147 | | -[VM-3] Starting execution |
| 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 |
148 | 113 |
|
149 | | -[VM-1] Requesting network access |
150 | | -[VM-2] Requesting network access |
| 114 | +## Build And Run |
151 | 115 |
|
152 | | -[VM-1] Using network port |
153 | | -[VM-2] Using network port |
| 116 | +From CloudKernel root: |
154 | 117 |
|
155 | | -[VM-3] Waiting for network port |
| 118 | +```powershell |
| 119 | +javac -encoding UTF-8 -d bin (Get-ChildItem -Recurse src -Filter *.java | ForEach-Object { $_.FullName }) |
| 120 | +java -cp "bin;." Main |
156 | 121 | ``` |
157 | | -The Logger class keeps the output organized so it is easier to read. |
158 | | - |
159 | | -## π§ What We Learned |
160 | | - |
161 | | -While building this project, we understood how operating systems handle: |
162 | | - |
163 | | -+ **Thread** synchronization |
164 | | - |
165 | | -+ **Shared** resource management |
166 | | - |
167 | | -+ **Parallel** execution |
168 | | - |
169 | | -+ **Process** coordination |
170 | | - |
171 | | -These concepts are important for understanding how real operating systems and cloud platforms work. |
172 | | - |
173 | | ---- |
174 | 122 |
|
175 | | -## π Conclusion |
| 123 | +## Notes |
176 | 124 |
|
177 | | -CloudKernel is a simple educational simulation that demonstrates how a hypervisor-like system can coordinate virtual machines and manage shared resources. |
| 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. |
178 | 128 |
|
179 | | -Although it is a simplified model, it provides a clear understanding of synchronization and concurrency in operating systems. |
180 | 129 |
|
181 | | ---- |
0 commit comments