A scalable, production-grade operating system kernel written in C and Assembly for x86 architecture. Designed for scale-up with modern OS features.
Smetana OS uses a hybrid microkernel/monolithic architecture for optimal performance and scalability:
-
Memory Management
- Physical Memory Manager (PMM) with bitmap-based page frame allocation
- Virtual Memory Manager (VMM) with full paging support
- Kernel heap allocator (kmalloc/kfree)
- User-space memory protection via page tables
-
Process Management
- Preemptive multitasking with round-robin scheduler
- Process Control Blocks (PCBs) with full process state tracking
- Process hierarchy (parent/child relationships)
- Priority-based scheduling with time slices
- Process states: READY, RUNNING, BLOCKED, SLEEPING, ZOMBIE
-
System Call Interface
- POSIX-like syscall interface (int 0x80)
- 23+ syscalls including: fork, exec, read, write, open, close, mmap, socket, etc.
- User-kernel mode transitions with privilege separation
-
Driver Framework
- Modular driver subsystem with device abstraction
- Block and character device support
- Device node management (/dev/*)
- Standardized driver operations (open, close, read, write, ioctl)
-
Filesystem
- Ext2 filesystem support (persistent storage)
- VFS (Virtual Filesystem) layer for abstraction
- In-memory filesystem for ramdisk
- File descriptor management
-
Network Stack
- Full TCP/IP stack implementation
- Ethernet, IP, ICMP, UDP, TCP protocols
- Socket API for network programming
- RTL8139 Ethernet driver
-
Security
- Protection rings (Ring 0 for kernel, Ring 3 for user)
- Capability-based security model (POSIX capabilities)
- Memory protection via page tables
- System call permission checks
- User/kernel-space separation
- Multiboot-compliant bootloader loads kernel
- GDT (Global Descriptor Table) setup
- IDT (Interrupt Descriptor Table) setup
- PMM initialization (physical memory detection)
- VMM initialization (paging enable)
- Process manager initialization
- Driver subsystem initialization
- Security subsystem initialization
- Network stack initialization
- Scheduler starts with test processes
- Multitasking: Preemptive multitasking with priority-based scheduler
- Memory Management: Paging, virtual memory, heap allocation
- Filesystem: Ext2 (persistent) and in-memory filesystems
- Network: Full TCP/IP stack with socket API
- Security: Protection rings, capabilities, memory protection
- Drivers: Modular driver framework with device abstraction
- Syscalls: POSIX-like system call interface
- Shell: Command-line interface with 20+ commands
sudo apt install make nasm gcc xorriso grub-common qemu-system-x86# Build
make
# Run in QEMU
./controller.sh run
# or directly:
qemu-system-i386 -cdrom out/Smetana.iso -m 512M| Category | Commands |
|---|---|
| System | help, clear, reboot, shutdown, loadkeys |
| Files | ls, cd, pwd, mkdir, touch, rm, cat |
| Info | ps, meminfo, free, uptime, uname, date, time, cpuid |
| Memory | malloc <size> |
| Network | dhcp, ping <ip>, netinfo |
| Misc | echo <text> |
smetana/
├── src/ # Kernel source code
│ ├── asm/ # Assembly files (entry, context switch, syscalls)
│ ├── programs/ # User programs
│ ├── pmm.c # Physical Memory Manager
│ ├── vmm.c # Virtual Memory Manager
│ ├── process.c # Process management
│ ├── syscall.c # System call handler
│ ├── driver.c # Driver framework
│ ├── ext2.c # Ext2 filesystem
│ ├── tcpip.c # TCP/IP network stack
│ ├── security.c # Security subsystem
│ └── ...
├── include/ # Header files
│ ├── pmm.h
│ ├── vmm.h
│ ├── process.h
│ ├── syscall.h
│ ├── driver.h
│ ├── ext2.h
│ ├── tcpip.h
│ └── security.h
├── config/ # Linker script and GRUB config
├── Makefile # Build system
└── README.md # This file
Smetana OS is designed for scale-up with:
- Modular architecture: Clear separation between subsystems
- Driver framework: Easy addition of new hardware support
- VFS layer: Support for multiple filesystems
- Network stack: Full TCP/IP for distributed systems
- Security model: Capability-based for fine-grained control
- Memory management: Paging supports large address spaces
MIT License - Educational and commercial use encouraged.