Though there is NO official blog available for this, still I tried to attach the resources from different sites.
1) When you click the "run" button on the website, an API request is sent to the back-end containing your code (along with other relevant information such as your user ID and the ID of the problem being solved).
2)When the server receives the request, several things happen. The server compiles your code (or tries to, if you're using a compiled language).
3) The server then executes the resulting program. I'm assuming it'll be run inside a container (e.g. Docker). This is due to a number of factors. First, the amount of memory and other resources available to your program can be precisely controlled.
𝐒𝐞𝐜𝐨𝐧𝐝, to precisely control the environment in which it runs; for example, Java programs, will launch a container from an image that only contains the bare minimum Java runtime and nothing else.
𝐓𝐡𝐢𝐫𝐝, to make it simple to set a timeout, i.e. simply kill the container if it does not complete running within the time limit.
𝐅𝐨𝐮𝐫𝐭𝐡, and most importantly, for security. Using a container makes it simple to ensure that the program does not interact with anything other than the standard I/O (stdin, stdout, stderr) used to test your program. For example, your program may be unable to access the network or filesystem because the container does not explicitly permit it.
Once your program's container (or, more likely, one container for each test case) is running, the data for that test case is sent to that container's STDIN. The system then reads the STDOUT and compares it to the expected output of the program. If there is an exact match, the test case passes. Otherwise, if there is no exact match, the test times out, or a runtime error occurs, then the test case fails.
4) The results of the test are saved and sent back to the user.
𝐀 𝐃𝐒𝐀 𝐪𝐮𝐞𝐬𝐭𝐢𝐨𝐧 𝐚 𝐝𝐚𝐲 𝐤𝐞𝐞𝐩𝐬 𝐭𝐡𝐞 𝐈𝐧𝐭𝐞𝐫𝐯𝐢𝐞𝐰 𝐅𝐞𝐚𝐫 𝐚𝐰𝐚𝐲
Top comments (0)