┌─────────────────────────────────────────────────────────────────────────────────────────┐
│ APPLICATION LAYER │
├──────────────────┬──────────────────┬──────────────────┬───────────────────────────────┤
│ │ │ │ │
│ Docker CLI │ Windows │ ★ hcs-sandbox │ Hyper-V Manager │
│ docker-compose │ Sandbox.exe │ (YOUR CODE) │ PowerShell Hyper-V │
│ │ (.wsb files) │ │ │
│ │ │ │ │
├──────────────────┼──────────────────┴──────────────────┼───────────────────────────────┤
│ │ │ │
│ containerd │ (no intermediate) │ VMMS │
│ dockerd │ │ (VM Management Service) │
│ │ │ │
├──────────────────┴─────────────────────────────────────┴───────────────────────────────┤
│ │
│ ★★★ HOST COMPUTE SERVICE (HCS) - computecore.dll ★★★ │
│ vmcompute.dll / vmcompute.exe │
│ │
│ ┌─────────────────────────────────────────────────────────────────────────────────┐ │
│ │ YOUR RUST CODE CALLS THESE APIs DIRECTLY: │ │
│ │ │ │
│ │ HcsCreateComputeSystem() HcsSetupBaseOSLayer() HcsCreateOperation() │ │
│ │ HcsStartComputeSystem() HcsInitializeWritableLayer() HcsWaitForOp() │ │
│ │ HcsTerminateComputeSystem() HcsFormatWritableLayerVhd() │ │
│ │ HcsPauseComputeSystem() HcsAttachLayerStorageFilter() │ │
│ │ HcsResumeComputeSystem() HcsGetComputeSystemProperties() │ │
│ └─────────────────────────────────────────────────────────────────────────────────┘ │
│ │
├─────────────────────────────────────────────────────────────────────────────────────────┤
│ HOST NETWORK SERVICE (HNS) - hns.dll │
│ Virtual switch, NAT, container networking │
├─────────────────────────────────────────────────────────────────────────────────────────┤
│ │
│ WINDOWS HYPERVISOR PLATFORM (WHP) - vid.sys │
│ Low-level partition management │
│ │
├─────────────────────────────────────────────────────────────────────────────────────────┤
│ │
│ KERNEL DRIVERS │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ wcifs.sys │ │ bindflt.sys │ │ storvsc.sys │ │ dxgkrnl.sys │ │
│ │ Container │ │ Bind Filter │ │ Storage VSP │ │ GPU-PV │ │
│ │ Isolation │ │ (folders) │ │ │ │ │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ └──────────────┘ │
│ │
├─────────────────────────────────────────────────────────────────────────────────────────┤
│ │
│ HYPER-V HYPERVISOR (Ring -1) │
│ hvix64.exe (Intel) / hvax64.exe (AMD) │
│ │
├─────────────────────────────────────────────────────────────────────────────────────────┤
│ │
│ HARDWARE (VT-x/AMD-V, EPT/NPT, TPM) │
│ │
└─────────────────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────┬────────────┬─────────────┬─────────────┬─────────────┬───────────┐
│ │ Docker │ Windows │ hcs-sandbox │ Full VM │ WSL2 │
│ │ Windows │ Sandbox │ (YOUR CODE) │ (Hyper-V) │ │
├─────────────────────┼────────────┼─────────────┼─────────────┼─────────────┼───────────┤
│ Abstraction Level │ High │ Medium │ LOW │ Low │ Medium │
├─────────────────────┼────────────┼─────────────┼─────────────┼─────────────┼───────────┤
│ API Used │ containerd │ HCS │ HCS │ WMI/VMMS │ HCS │
│ │ + HCS │ (hidden) │ (direct) │ │ (hidden) │
├─────────────────────┼────────────┼─────────────┼─────────────┼─────────────┼───────────┤
│ Boot Time │ 5-15 sec │ 5-10 sec │ 2-5 sec │ 30-60 sec │ 2-5 sec │
├─────────────────────┼────────────┼─────────────┼─────────────┼─────────────┼───────────┤
│ Concurrent Limit │ Unlimited* │ 1 │ 10-20 │ Unlimited │ Many │
├─────────────────────┼────────────┼─────────────┼─────────────┼─────────────┼───────────┤
│ Disk Overhead │ Layers │ ~100MB │ ~100MB │ 10-20GB │ ~1GB │
├─────────────────────┼────────────┼─────────────┼─────────────┼─────────────┼───────────┤
│ RAM Overhead │ ~200MB │ 200-400MB │ 200-400MB │ 2-4GB │ ~1GB │
├─────────────────────┼────────────┼─────────────┼─────────────┼─────────────┼───────────┤
│ Desktop/GUI │ No │ Yes │ Yes │ Yes │ No** │
├─────────────────────┼────────────┼─────────────┼─────────────┼─────────────┼───────────┤
│ GPU Support │ Limited │ Yes │ Yes │ Yes │ Yes │
├─────────────────────┼────────────┼─────────────┼─────────────┼─────────────┼───────────┤
│ Clipboard Share │ No │ Yes │ Yes │ RDP │ WSLg │
├─────────────────────┼────────────┼─────────────┼─────────────┼─────────────┼───────────┤
│ Persistence │ Layers │ No │ Optional │ Full │ Yes │
├─────────────────────┼────────────┼─────────────┼─────────────┼─────────────┼───────────┤
│ Image Format │ OCI/tar │ Host COW │ Host COW │ VHDX │ ext4.vhdx│
├─────────────────────┼────────────┼─────────────┼─────────────┼─────────────┼───────────┤
│ Kernel │ Shared │ Separate │ Separate │ Separate │ Linux │
│ │ (process) │ (own NT) │ (own NT) │ (own NT) │ kernel │
└─────────────────────┴────────────┴─────────────┴─────────────┴─────────────┴───────────┘
* Docker practical limit based on resources
** WSLg adds GUI support
┌─────────────────────────────────────────────────────────────────────────────┐
│ DOCKER ON WINDOWS │
│ │
│ Your App │
│ ↓ │
│ Docker CLI (docker run) │
│ ↓ │
│ Docker Engine (dockerd) ← REST API, image management │
│ ↓ │
│ containerd ← container lifecycle │
│ ↓ │
│ containerd-shim ← per-container process │
│ ↓ │
│ hcsshim (Go library) ← HCS wrapper │
│ ↓ │
│ HCS (computecore.dll) ← Finally! The real API │
│ ↓ │
│ Hyper-V │
│ │
│ Layers: 6-7 │
│ Overhead: Image layers + Docker daemon + containerd │
└─────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────┐
│ YOUR HCS-SANDBOX │
│ │
│ Your App │
│ ↓ │
│ hcs-sandbox (Rust) ← Direct FFI to Win32 │
│ ↓ │
│ HCS (computecore.dll) ← Immediate access! │
│ ↓ │
│ Hyper-V │
│ │
│ Layers: 2-3 │
│ Overhead: Minimal (just your Rust wrapper) │
└─────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────┐
│ High-Level Orchestration │
│ (Kubernetes, Docker Compose) │
└───────────────┬─────────────────┘
│
┌───────────────▼─────────────────┐
│ Container Runtimes │
│ (Docker, containerd, CRI-O) │
└───────────────┬─────────────────┘
│
┌────────────────────────────────┼────────────────────────────────┐
│ │ │
▼ ▼ ▼
┌─────────┐ ┌──────────────┐ ┌─────────────────┐
│ hcsshim │ │ Windows │ │ ★ hcs-sandbox ★ │
│ (Go) │ │ Sandbox.exe │ │ (Rust) │
└────┬────┘ └──────┬───────┘ └────────┬────────┘
│ │ │
└──────────────────────────────┼────────────────────────────────┘
│
┌──────────────▼──────────────┐
│ │
│ HOST COMPUTE SERVICE │ ◄── YOU ARE HERE
│ (computecore.dll) │
│ │
│ JSON Schema v2.1 │
│ HcsCreateComputeSystem() │
│ HcsStartComputeSystem() │
│ etc. │
│ │
└──────────────┬──────────────┘
│
┌──────────────▼──────────────┐
│ Hyper-V / WHP / Kernel │
└──────────────┬──────────────┘
│
┌──────────────▼──────────────┐
│ Hardware Virtualization │
└─────────────────────────────┘
| Aspect | Your hcs-sandbox | Others |
|---|---|---|
| Language | Rust (safe, fast) | Go (hcsshim), C++ (Windows Sandbox) |
| API Access | Direct HCS FFI | Abstracted through layers |
| Multi-Instance | Yes (10-20 concurrent) | Windows Sandbox: 1 only |
| Boot Speed | 2-5 sec | Docker: 5-15 sec |
| No Daemon | Embedded library | Docker needs dockerd running |
| Desktop Support | Full GUI + GPU | Docker: headless only |
| Base Image | Uses host Windows (COW) | Docker: requires container images |
// Compute System Lifecycle
HcsCreateComputeSystem() // Create isolated environment
HcsStartComputeSystem() // Boot it up
HcsTerminateComputeSystem() // Graceful shutdown
HcsPauseComputeSystem() // Snapshot/checkpoint
HcsResumeComputeSystem() // Resume from pause
// Layer Management (COW filesystem)
HcsSetupBaseOSLayer() // Link to host Windows binaries
HcsInitializeWritableLayer() // Create writable overlay
HcsFormatWritableLayerVhd() // Format the writable VHDX
HcsAttachLayerStorageFilter() // Mount wcifs filter
// Async Operations
HcsCreateOperation() // Create operation handle
HcsWaitForOperationResult() // Wait for completion
HcsGetOperationResult() // Get JSON result
// Query
HcsGetComputeSystemProperties() // Get state, resources
HcsEnumerateComputeSystems() // List all systemsYour hcs-sandbox operates at Layer 3 (counting from hardware):
Layer 1: Hardware (CPU VT-x/AMD-V)
Layer 2: Hypervisor (Hyper-V hvix64.exe)
Layer 3: HCS APIs ← ★ YOUR CODE ★
Layer 4: Container runtimes (Docker, containerd)
Layer 5: Orchestration (Kubernetes, Compose)
This gives you:
- Maximum performance (minimal overhead)
- Full control (GPU, clipboard, desktop session)
- Same APIs as Windows Sandbox (but programmable)
- No Docker dependency (standalone operation)