|
| 1 | +# CloudKernel ☁️⚙️ |
| 2 | + |
| 3 | +## Overview |
| 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. |
| 7 | + |
| 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. |
| 54 | + |
| 55 | +--- |
| 56 | + |
| 57 | +### 2. VM Cycle Synchronization |
| 58 | + |
| 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 | + |
| 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 | +``` |
| 99 | +--- |
| 100 | + |
| 101 | +## 🏗 System Workflow |
| 102 | + |
| 103 | +The program runs in the following order: |
| 104 | + |
| 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 | +``` |
| 123 | + |
| 124 | +--- |
| 125 | + |
| 126 | +## ▶️ How to Run the Project |
| 127 | + |
| 128 | +### 1. Compile the project |
| 129 | + |
| 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 |
| 138 | + |
| 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 |
| 148 | +
|
| 149 | +[VM-1] Requesting network access |
| 150 | +[VM-2] Requesting network access |
| 151 | +
|
| 152 | +[VM-1] Using network port |
| 153 | +[VM-2] Using network port |
| 154 | +
|
| 155 | +[VM-3] Waiting for network port |
| 156 | +``` |
| 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 | + |
| 175 | +## 📌 Conclusion |
| 176 | + |
| 177 | +CloudKernel is a simple educational simulation that demonstrates how a hypervisor-like system can coordinate virtual machines and manage shared resources. |
| 178 | + |
| 179 | +Although it is a simplified model, it provides a clear understanding of synchronization and concurrency in operating systems. |
| 180 | + |
| 181 | +--- |
0 commit comments