Skip to content

2405Gaurav/GT-OS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

95 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ GT-OS

The Gaurav Thakur Operating System

Build Status Architecture Kernel Type License

"To understand the machine, one must become the machine's architect."

A 32-bit preemptive multitasking operating system kernel built from scratch

Features β€’ Architecture β€’ Quick Start β€’ Documentation


πŸ“– About

GT-OS is a research-grade operating system kernel developed from first principles for the x86 architecture. This project explores the intricate world of protected mode execution, virtual memory management, and POSIX-compliant system interfaces.

This isn't just codeβ€”it's a journey into the heart of how computers work, bridging the gap between raw hardware and elegant software abstraction.

🎯 Purpose

  • Educational: Designed for developers who want to understand OS internals from the boot sector up
  • Research: A platform for exploring kernel design patterns and low-level systems programming
  • Professional: Built with production-grade structure and engineering discipline

✨ Features

πŸ”„ Process Management

  • Preemptive multitasking
  • Round-robin scheduling
  • Context switching
  • Process state management

πŸ’Ύ Memory Management

  • Paging-enabled VMM
  • Dynamic kernel heap
  • Slab allocator
  • Protected mode execution

πŸ“ File Systems

  • ext2 read/write support
  • Virtual File System (VFS) layer
  • procfs for process info
  • devfs for device nodes

πŸ”§ Hardware Support

  • PS/2 keyboard controller
  • ATA/PIO disk driver
  • PCI bus enumeration
  • RTC & PIT timers

πŸ› System Architecture

GT-OS follows a modular monolithic kernel design, where core services run in kernel space for performance while maintaining strict separation of concerns.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚         User Space Applications         β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚          System Call Interface          β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                         β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚Scheduler β”‚   VFS    β”‚   IPC    β”‚   β”‚
β”‚  β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€   β”‚
β”‚  β”‚   VMM    β”‚  Heap    β”‚  Slab    β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚            Kernel Core                  β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚     Hardware Abstraction Layer (HAL)    β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  PS/2  β”‚  ATA  β”‚  PCI  β”‚  RTC  β”‚  PIT  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Core Subsystems

Subsystem Description
Scheduler Preemptive multitasking with round-robin arbitration, process state tracking, and context switching
Memory Manager Paging-enabled Virtual Memory Manager with dynamic kernel heap and slab allocator
VFS Virtual File System abstraction decoupling userspace from physical storage
IPC UNIX-style signals and system call interfaces for inter-process communication

πŸš€ Quick Start

Prerequisites

Ensure you have the following tools installed:

# Required Tools
- i586-elf-gcc      # Cross-compiler
- i586-elf-as       # Assembler
- QEMU (i386)       # Emulator
- make              # Build system
- Linux/WSL/macOS   # Host environment

Building GT-OS

# Clone the repository
git clone https://github.com/yourusername/GT-OS.git
cd GT-OS/osdev-source

# Clean previous builds
make clean

# Compile the kernel
make all

Running in QEMU

# Boot the kernel
make start

Default Login:

  • Username: root
  • Password: toor

πŸ’» User Space Interface

Upon boot, GT-OS drops you into a user-mode shell that communicates with the kernel through a Linux-compatible syscall interface.

Available Commands

Command Description
ps Display running processes and PIDs
ls List directory contents (VFS query)
cat <file> Output file contents to stdout
time Poll CMOS RTC for current time
mod <module> Load/unload kernel modules dynamically

πŸ“‚ Project Structure

GT-OS/
β”œβ”€β”€ osdev-source/
β”‚   β”œβ”€β”€ arch/i386/          # x86 architecture-specific code
β”‚   β”‚   β”œβ”€β”€ boot.S          # Bootstrap assembly
β”‚   β”‚   └── interrupts.S    # Interrupt handlers
β”‚   β”œβ”€β”€ kernel/             # Core kernel subsystems
β”‚   β”‚   β”œβ”€β”€ panic.c         # Kernel panic handler
β”‚   β”‚   β”œβ”€β”€ elf.c           # ELF binary loader
β”‚   β”‚   └── syscalls.c      # System call dispatcher
β”‚   β”œβ”€β”€ mm/                 # Memory management
β”‚   β”‚   β”œβ”€β”€ pmm.c           # Physical memory manager
β”‚   β”‚   β”œβ”€β”€ vmm.c           # Virtual memory manager
β”‚   β”‚   └── heap.c          # Kernel heap allocator
β”‚   β”œβ”€β”€ fs/                 # File system implementations
β”‚   β”‚   β”œβ”€β”€ vfs.c           # Virtual File System
β”‚   β”‚   └── ext2.c          # ext2 driver
β”‚   β”œβ”€β”€ drivers/            # Hardware drivers
β”‚   β”‚   β”œβ”€β”€ screen.c        # VGA text mode
β”‚   β”‚   β”œβ”€β”€ keyboard.c      # PS/2 keyboard
β”‚   β”‚   └── ata.c           # ATA/PIO disk
β”‚   └── include/            # System-wide headers
└── README.md

🧠 Design Philosophy

GT-OS embodies three core principles of systems programming:

1. Concurrency Control

Managing race conditions and synchronization in a preemptive multitasking environment

2. Resource Abstraction

Transforming raw electrical signals into elegant abstractions like files, streams, and processes

3. Bare Metal Mastery

Direct hardware interfacing through port I/O and memory-mapped registersβ€”no safety nets

This kernel is educational in nature but professional in structure, demonstrating that with curiosity and discipline, the computer's "black box" becomes a glass house.


πŸ›  Technical Specifications

Architecture

  • x86 (32-bit)
  • Protected mode
  • Ring 0/3 separation

Binary Format

  • ELF loader
  • Dynamic linking support
  • Symbol resolution

Interrupts

  • IDT management
  • ISR handlers
  • IRQ routing

🀝 Contributing

Contributions are welcome! Areas of interest include:

  • πŸ”Œ Additional hardware drivers
  • πŸ“ Filesystem optimization
  • πŸ”§ POSIX compliance improvements
  • πŸ“š Documentation enhancements

Code Style

Please adhere to K&R coding style for consistency.

Pull Request Process

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ‘¨β€πŸ’» Author

Gaurav Thakur

Concept, Architecture & Implementation

The name GT-OS reflects the personal nature of this architectural study. It stands as a testament to the fact that with enough curiosity and determination, the "black box" of the computer becomes transparent.


🌟 Acknowledgments

  • The OSDev community for their invaluable resources
  • The GNU toolchain developers
  • QEMU project for excellent emulation
  • Everyone who believes in understanding technology from the ground up

⭐ Star this repo if you find it interesting!

Built with passion for operating systems and low-level programming

Report Bug β€’ Request Feature

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published