is the server backend in PHP or Python? What are the pros and cons of both?
Reply content:
is the server backend in PHP or Python? What are the pros and cons of both?
Online-judge's back end is actually divided into two pieces, one is the web, and the other is judge.
The Web Part is responsible for the input and output, interface display, and the usual web site is no different, whether it is PHP or Python are very fast.
The Judge section requires at least several features:
1. Sandbox, when executing code to ensure the security of the system, the code must be limited to the sandbox.
2. Monitoring calls, because the online execution code is likely to invoke the system's resources (including requests for files, network/system commands), these should be security first, prohibit the execution of some calls.
3. Statistics, most judge are with memory statistics, execution time statistics, so as to calculate the rank or score, so this function is also very important.
So the judge part of these features leads to the need for a language that can precisely control the system, which is why most judge are written in c++/c, and then use SOCKET/IPC to communicate with each other on the web.
At this point Php/python is the front end, which executes the code to the back end of the judge and returns the corresponding result.
If you want to use Php/python to do judge, although theoretically feasible, but actually seemingly no one to do, you need to achieve a lot of things, not the above plan is reliable.
Remember: no strict implementation of the sandbox language is not judge! There is a sandbox but poor performance is also difficult to bear the task of (those virtual machines)
Previously, the university ACM Community used an open source system that was developed using Java.
Write this system, I think it is a running program test results on the line Ah, different languages call different scripts to run the environment is good. The final comparison results, and then the score. easy!