An open API service indexing awesome lists of open source software.

https://github.com/haksham/linux-project

A dynamic web-based simulation of real-time clock (RTC) management and synchronization across OS partitions
https://github.com/haksham/linux-project

expressjs linux-kernel makefile nextjs real-time-clock socket-io

Last synced: 3 months ago
JSON representation

A dynamic web-based simulation of real-time clock (RTC) management and synchronization across OS partitions

Awesome Lists containing this project

README

          

# πŸ•’ Real-Time Clock Partition Simulator

A dynamic, interactive web-based simulation of real-time clock (RTC) management and synchronization across OS partitions.
Built for Linux session.

---

## πŸš€ Overview

This project demonstrates **master-slave RTC synchronization** in a multi-partition system:

- **Linux** acts as the **Master Partition**, reading time from the hardware clock.
- **Windows OS** and **Ubuntu** are **Slave Partitions** whose clocks can drift and become out of sync.
- You can simulate clock drift, observe out-of-sync states, and manually synchronize all partitionsβ€”just like using `timedatectl set-local-rtc 1` in Linux.

---

## ✨ Features

- **Live RTC Simulation:** Visualize how clocks drift and sync in real time.
- **Master-Slave Architecture:** Linux (master) always stays in sync; others can drift.
- **Manual & Bulk Sync:** Instantly synchronize all slave partitions with a single click.
- **Visual Feedback:** Out-of-sync states are clearly highlighted.
- **Modern UI:** Responsive, attractive interface using React and Next.js.
- **Command Simulation:** Simulate Linux RTC commands and observe their effects.

---

## πŸ–ΌοΈ Screenshots


RTC Dashboard



Out of Sync Example



Sync All Example



Sync All Example



Sync All Example

---

## πŸ› οΈ Getting Started

### 1. Clone the repository

```bash
git clone https://github.com/yourusername/linux-proj.git
cd linux-proj
```

### 2. Start the RTC Master Server

```bash
cd rtc-sim
npm install
node index.js
```

### 3. Start the Frontend

```bash
cd ../frontend
npm install
npm run dev
```

Open [http://localhost:3000](http://localhost:3000) in your browser.

---

## πŸ—οΈ Project Structure

πŸ“ linux-proj/ (Root)

β”œβ”€β”€ frontend/ (Next.js frontend)
β”‚Β Β  β”œβ”€β”€ app/

β”‚Β Β  β”‚Β Β  β”œβ”€β”€ layout.js
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ page.js
β”‚Β Β  β”‚Β Β  └── globals.css
β”‚Β Β  β”œβ”€β”€ components/

β”‚Β Β  β”‚Β Β  └── PartitionClock.js
β”‚Β Β  β”œβ”€β”€ pic/ (Screenshots & images)

β”‚Β Β  β”‚Β Β  β”œβ”€β”€ p1.png
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ p2.png
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ p3.png
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ p4.png
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ p5.png
β”‚Β Β  β”œβ”€β”€ .gitignore
β”‚Β Β  β”œβ”€β”€ jsconfig.json
β”‚Β Β  β”œβ”€β”€ next.config.mjs
β”‚Β Β  β”œβ”€β”€ package.json
β”‚Β Β  β”œβ”€β”€ postcss.config.mjs
β”‚Β Β  β”œβ”€β”€ README.md
β”‚Β Β  β”œβ”€β”€ requirements.txt
β”‚Β Β  └── tailwind.config.mjs
β”œβ”€β”€ rtc-sim/ (Node.js backend)

β”‚Β Β  β”œβ”€β”€ .gitignore
β”‚Β Β  β”œβ”€β”€ index.js
β”‚Β Β  β”œβ”€β”€ package.json
β”‚Β Β  └── requirements.txt
β”œβ”€β”€ .gitignore
β”œβ”€β”€ Commands.txt
β”œβ”€β”€ LICENSE
β”œβ”€β”€ Makefile
β”œβ”€β”€ README.md
β”œβ”€β”€ rtc_slave.c
β”œβ”€β”€ rtc_sync.c

---

## βš™οΈ How It Works

- **Master Clock:** The backend (`rtc-sim/index.js`) broadcasts the current time to all partitions.
- **Partitions:** Each partition (component) simulates its own clock, which may drift.
- **Synchronization:** Slave partitions periodically sync to the master, or can be manually synced via UI buttons.
- **Command Simulation:** Use the UI to simulate commands like `timedatectl set-local-rtc 1` for instant synchronization.

---

## πŸ–₯️ Useful Commands

The following commands (from [`Commands.txt`](Commands.txt)) are useful for working with the kernel RTC module:

```bash
make

sudo insmod rtc_sync.ko

sudo dmesg | grep rtc_shm

ls -l /dev/rtc_shm

cat /dev/rtc_shm

gcc rtc_slave.c -o rtc_slave

sudo ./rtc_slave

sudo rmmod rtc_sync
```

---

## πŸ“š References

- [Linux Kernel RTC Subsystem](https://www.kernel.org/doc/html/latest/driver-api/rtc.html)
- [timedatectl Documentation](https://www.freedesktop.org/software/systemd/man/latest/timedatectl.html)
- [Socket.io](https://socket.io/)
- [Next.js](https://nextjs.org/)

---

## πŸ‘¨β€πŸ’» Authors

- **Harsh V M**
- **Karthik Hegde**

---

## πŸ“ License

This project is licensed under the MIT License. See [LICENSE](LICENSE) for details.