High-performance, isolated Linux execution engine kernel
- Linux Kernel: Version 5.8+ recommended (with unified cgroups v2 enabled).
- Filesystem: Unified cgroup hierarchy mounted at
/sys/fs/cgroup. - User Permissions: Root permissions required for direct cgroups v2 controller creation.
stat -fc %T /sys/fs/cgroup
# Should output: cgroup2fsIf not enabled, update /etc/default/grub:
GRUB_CMDLINE_LINUX="systemd.unified_cgroup_hierarchy=1 cgroup_no_v1=all"
Run sudo update-grub and reboot.
| Language | Extension | Compiler / Interpreter | Flags |
|---|---|---|---|
| C++ | .cpp |
g++ (GCC) |
-O3 -std=c++17 -Wall -Wextra -DONLINE_JUDGE -pipe |
| Python | .py |
python3 |
-u (unbuffered I/O), -B (suppress bytecode caching) |
ACCEPTED: Solution compiled and passed all testcases within resource limits.WRONG_ANSWER: Solution ran successfully but stdout differed from expected output.TIME_LIMIT_EXCEEDED(TLE): Execution exceeded wall-clock timeout or CPU quota.MEMORY_LIMIT_EXCEEDED(MLE): Process breachedmemory.maxand was killed by OOM.COMPILATION_ERROR: Failure during the compilation phase with diagnostic stderr.RUNTIME_ERROR: Process exited with non-zero exit code or fatal signal (SIGSEGV,SIGFPE).OUTPUT_LIMIT_EXCEEDED: Output exceeded maximum allowed stream buffer (1MB).SYSTEM_ERROR: Internal orchestration or host failure.
- Memory Isolation (
memory.max): Hard memory ceiling. The Linux kernel guarantees no process or child in the cgroup exceeds this limit. - CPU Throttling (
cpu.max): Enforces CFS quota (e.g.100000 100000for 1 full core) preventing multi-threaded CPU starvation. - Fork-Bomb Defense (
pids.max): Restricts maximum processes/threads to32, renderingfork()exhaustion attacks harmless. - Unprivileged Execution: Code runs strictly under
nobodyor unprivileged UID1001:1001withno_new_privs. - Network Disconnection: Sockets and networking blocked (
--network nonein container mode). - Disk & Output Exhaustion Caps: Bounded stream readers cap output at
1MBto prevent disk filling and memory buffer overflow. - External Watchdog: An asynchronous watchdog forcefully issues
SIGKILLto the process group if wall-clock limits are exceeded.
# Build CLI engine, API server, and Worker daemon
make build-alldocker-compose up -d --buildThis spins up:
- Redis 7 on port
6379 - SpeedCode REST & WebSocket API Gateway on port
8080 - Worker Pool #1 (Concurrency 4)
- Worker Pool #2 (Concurrency 4)
Detailed API documentation is available in API.md.
curl -X POST http://localhost:8080/api/v1/submissions \
-H "Content-Type: application/json" \
-d '{
"language": "python3",
"code": "a, b = map(int, input().split())\nprint(a + b)",
"test_cases": [
{"id": "tc-1", "input": "5 7\n", "expected_output": "12\n"},
{"id": "tc-2", "input": "100 200\n", "expected_output": "300\n"}
]
}'Response (202 Accepted):
{
"submission_id": "sub-a1b2c3d4e5f6",
"status": "QUEUED",
"ws_url": "/api/v1/submissions/sub-a1b2c3d4e5f6/ws",
"enqueued_at": "2026-08-30T10:45:00.000Z"
}const ws = new WebSocket("ws://localhost:8080/api/v1/submissions/sub-a1b2c3d4e5f6/ws");
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
console.log("Live Event:", data.status, data);
};