ShaderOS is an experimental operating system that runs entirely on the GPU using WebGPU compute shaders. It provides OS-level services (filesystem, networking, windowing, AI) directly in shader code, with privileged operations mediated by a minimal host runtime.
Traditional operating systems run on the CPU and use the GPU as a peripheral for graphics. ShaderOS inverts this model: the "kernel" runs as GPU compute shaders, and the CPU acts as a privileged host for hardware access.
Key Features:
- ๐ง Filesystem Service - Virtual filesystem with 65K files, 256MB storage
- ๐ Network Stack - TCP/UDP/ICMP implementation in shaders
- ๐ช Window System - GPU-native compositor with 256 concurrent windows
- ๐ค AI Service - Neural network inference directly in compute shaders
- ๐จ Framebuffer - Direct 1920x1080 RGBA rendering
- ๐ Debug Traces - Real-time shader debugging with 65K trace entries
- Python 3.8+
- GPU with WebGPU support (Vulkan, Metal, or DX12 backend)
- ~450MB GPU memory for all services
# Install dependencies
pip install -r requirements.txt
# Run the ShaderOS
python3 ShaderOSRuntime.py$ python3 ShaderOSRuntime.py
๐ ShaderOSRuntime - The Layer Above Shaders
Created buffer 'service_requests' (binding 0) with size 9216 bytes
Created buffer 'service_responses' (binding 1) with size 6144 bytes
...
Created buffer 'ai_weights' (binding 39) with size 4194304 bytes
โ
ShaderOSRuntime ready - shaders can now request privileged operations
=== HOST TICK 0 ===โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Host Runtime (CPU) โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ ShaderOSRuntime.py โ โ
โ โ - Service Handlers โ โ
โ โ - Buffer Management โ โ
โ โ - Shader Dispatch โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโ
โ WebGPU API
โโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโ
โ GPU Compute Shaders โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Substrate Kernel (substrate.wgsl)โ โ
โ โ - Frame Counter โ โ
โ โ - Debug Logging โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ OS ABI (os_abi.wgsl) โ โ
โ โ - 40 Global Buffers โ โ
โ โ - Service Definitions โ โ
โ โ - Helper Functions โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
ShaderOS provides 5 core services:
-
Filesystem (Service ID: 1)
- 65,536 file entries
- 256MB data storage
- Directory hierarchy support
- Atomic file operations
-
Reload (Service ID: 2)
- Hot shader reloading
- Runtime code updates
-
Network (Service ID: 3)
- 1,024 concurrent sockets
- TCP/UDP/ICMP protocols
- Packet routing and DNS cache
-
Service Manager (Service ID: 4)
- Service registration
- Inter-service communication
-
Control (Service ID: 5)
- System shutdown
- Runtime control
Total GPU Memory: ~450MB
| Service | Size | Bindings |
|---|---|---|
| Core System | ~17MB | 0-9 |
| Framebuffers | ~33MB | 10-13 |
| Filesystem | ~340MB | 14-20 |
| Window System | ~250KB | 21-26 |
| Networking | ~14MB | 27-34 |
| AI Services | ~4.2MB | 35-39 |
- ARCHITECTURE.md - Detailed system architecture
- API.md - Service API reference
- QUICKSTART.md - Getting started guide
shaderos/
โโโ ShaderOSRuntime.py # Main runtime (host-side)
โโโ runtime/
โ โโโ core/
โ โโโ substrate.wgsl # Substrate kernel
โ โโโ os_abi.wgsl # OS ABI definitions
โโโ requirements.txt # Python dependencies
โโโ docs/ # Documentation
- Define service ID in
ShaderOSRuntime.py - Add buffer bindings to
BUFFER_BINDINGS - Implement handler in
ShaderOSRuntimeclass - Define structs and bindings in
os_abi.wgsl
Enable debug output:
runtime.read_debug_log() # Read shader debug traces- No u64 support: All 64-bit types replaced with u32
- No pointer returns: Direct buffer access instead of helper functions
- No atomic structs: Structs with atomic fields cannot be passed as parameters
- Reserved keywords:
typerenamed toevent_type/socket_type
All 40 buffer bindings follow WebGPU storage buffer conventions:
@group(0)for all buffers@binding(N)from 0-39var<storage, read_write>for mutable buffersvar<storage, read>for read-only buffers
This is an experimental research project. Contributions welcome!
MIT License - See LICENSE file for details
Built with:
- wgpu-py - Python WebGPU implementation
- WebGPU Shading Language (WGSL)
- NumPy for buffer operations
- Single-threaded host runtime
- No persistent storage
- Limited error handling
- Experimental shader implementations
- Requires modern GPU with WebGPU support
- Multi-shader orchestration
- Persistent filesystem
- Real network integration
- Window system with actual rendering
- Performance optimizations
- More comprehensive error handling
Status: Experimental Research Project Version: 0.1.0-alpha Last Updated: November 2025