¿Es posible desarrollar un sistema ACM ONLINE JUDGE usando NODE.JS (o PYTHON)?

I'm a newer and if the question is so easy I apologize for that.

Assume I want to dev a classical online judge system, obviously the core part is

  • get users' code to a file
  • compile it on server
  • run it on server (with some sandbox things to prevent damage)
    • the program exit itself, then check the answer.
    • or get the signal of program collapsing.

I wonder if it's possible to do all the things using Node.js, how to do the sandbox things. Is there any example for compile-sandbox-run-abort-check thing?

additional: is it more convenient to dev a such system using PYTHON?

gracias por adelantado.

preguntado el 09 de marzo de 12 a las 15:03

2 Respuestas

Most of these steps are standard --- create a file, run a system call to compile something, muck around with I/O --- I think cualquier language should be able to do them, except the very crucial step of "run in a sandbox." I am aware of several solutions for sandboxing:

  1. use OS commands to restrict or remove abilities (chroot, setrlimit, file system permissions in linux)
  2. remove all dangerous functionality from the language being graded
  3. interrupt system events
  4. run the sandbox inside a virtual machine.

This list is probably not exhaustive. The system I am involved with, http://cscircles.cemc.uwaterloo.ca uses option #1. Again, most of the work is done in system calls so I can't imagine that one language is so much better than the other? We use php for the big-level stuff and C to do the sandboxing. Does that help answer your question?

Respondido 02 Abr '12, 23:04

To accomplish the sandbox, it would be fairly easy to do this by simply running your code inside of a closure that reassigns all of the worrisome calls to NaN

for instance, if the code executes inside a closure where eval=NaN

respondido 09 mar '12, 15:03

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.