TIER 4 · PRACTICAL ENGINEERING
सिद्धांत (Theory & Architecture)
Asynchronous Event Loops in SanOS
High-performance servers like Nginx achieve their speed through asynchronous event loops rather than spawning a new OS thread for every connection. In Sanskriti, we utilize Zero-Mass sockets—which carry zero memory overhead until data is actively being transferred.
By defining a चक्रम् (Cycle/Event Loop), we can handle tens of thousands of concurrent connections on a single core.
[ HTTP Request ] → (Zero-Mass Socket)
↓
[ Event Loop (चक्रम्) ] → (Non-Blocking Dispatch)
↓
[ File System / Static Assets ]
प्रारूप (Specifications)
Server Requirements in Sanskriti
English Specification
"Create an asynchronous HTTP server. Listen on port 8080. For every incoming GET request, serve the corresponding static file from the './public' directory using an asynchronous event loop."
Sanskrit Counterpart (Sanskriti Input)
॰ ParamServer - Async HTTP Engine
एचटीटीपी-सर्वरं (HTTP Server) सृज ।
तद् अष्टशून्य-अष्टशून्य-द्वारे (Port 8080) शृणु ।
प्रति-अनुरोधाय (GET) './public' कोशात् सञ्चिकां (File) प्रयच्छ ।
सर्वे व्यापाराः असङ्गत-चक्रेण (Asynchronous Loop) सम्पादय ।
प्रक्रिया (CLI Tutorial)
Compiling the Server
-
Compile the Server Engine:
$ sanskriti build server.सस --optimize O3
[संस्कृति] Parsing Network AST...
[संस्कृति] Linking Zero-Mass Sockets...
[संस्कृति] Successfully built: paramserver.exe
-
Launch the Engine:
$ ./paramserver.exe
[ParamServer] Asynchronous Loop started.
[ParamServer] Serving ./public on http://localhost:8080/