diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..84f49a0 --- /dev/null +++ b/Readme.md @@ -0,0 +1,22 @@ +# Monaco Code Execution Engine +Monaco is a secure, containerized code execution engine that allows you to run code in multiple programming languages through a simple REST API. + +## Features +- Multi-language support: Run code in Python, Java, C, and C++ +- Secure execution: All code runs in isolated Docker containers +- Resource limits: Memory, CPU, and file descriptor limits to prevent abuse +- Concurrent processing: Efficient job queue for handling multiple requests +- Simple REST API: Easy to integrate with any frontend + +## Architecture +Monaco consists of several components: + +- HTTP Handlers (handler/handler.go): Processes API requests +- Execution Service (service/execution.go): Manages code execution in containers +- Job Queue (queue/queue.go): Handles concurrent execution of code submissions +- Submission Model (model/submission.go): Defines the data structure for code submissions + +## Requirements +- Go 1.22.3 or higher +- Docker +- Network connectivity for container image pulling \ No newline at end of file diff --git a/backend/service/execution.go b/backend/service/execution.go index 7097ff7..90fc2a5 100644 --- a/backend/service/execution.go +++ b/backend/service/execution.go @@ -232,7 +232,7 @@ func (s *ExecutionService) executeC(submission *model.CodeSubmission) { "gcc:latest", "bash", "-c", "cd /code && gcc -o main main.c && ./main") log.Printf("[C-%s] Executing C code with timeout: 10s", submission.ID) - output, err := s.executeWithTimeout(cmd, 1000*time.Second, submission.ID) + output, err := s.executeWithTimeout(cmd, 10*time.Second, submission.ID) elapsed := time.Since(startTime) log.Printf("[C-%s] C execution completed in %v", submission.ID, elapsed) diff --git a/backend/tmp/main.exe b/backend/tmp/main.exe index ea60ef9..5e1b8a0 100644 Binary files a/backend/tmp/main.exe and b/backend/tmp/main.exe differ