Client/Server Runtime Subsystem (csrss.exe)
Overview
CSRSS (Client/Server Runtime Subsystem) provides user-mode support for console applications and GUI subsystems, bridging kernel functionality with user applications.
Functions
- Console Support - Terminal and console window management
- GUI Bridge - Interface between applications and kernel GUI
- Process Management - User-mode process tracking
- Thread Management - User-mode thread coordination
Architecture
CSRSS runs as a privileged user-mode process that communicates with the kernel through system calls and provides services to other user processes.
Service Registration
CSRSS registers itself with the kernel service manager on startup:
#include "libc/syscalls/service_syscalls.h"
int main(int argc, char** argv) {
// Initialize kernel service manager
if (service_manager_init() != 0) {
fprintf(stderr, "csrss: Failed to initialize kernel service manager\n");
return 1;
}
// Register csrss service
if (service_register("csrss", "/sbin/csrss",
SERVICE_TYPE_SIMPLE, SERVICE_RESTART_ALWAYS) != 0) {
fprintf(stderr, "csrss: Failed to register service\n");
return 1;
}
// ... rest of initialization
}
Service Integration: CSRSS integrates with the kernel service manager for lifecycle management, automatic restart, and health monitoring. See Service Management System for complete documentation.
Implementation
CSRSS is implemented as a Node.js service that provides console and GUI APIs to applications running in user space.