Why does an online Judge crash during an online Programming Contest?


We all are well aware are that now-a-days various coding platforms include competitive codings, for example GeeksforGeeks, CodeChef, Codeforces, atCoder, SPOJ, HackerRank, HackerEarth, and many more where they supposed to code out by themselves by either attaching local editor file such as a sublime editor or by directly writing on their respective editors.

So how are these test cases getting accessed or in an easy way we can say that our code is getting compiled and run? On these programming platforms for competitive programming online judges act as the backbone for code compilation and run.

Online Judge

To judge the code submitted by the users which is going to be next compiled and tested in a homogeneous environment is done by online judges. Online judges are classified into various systems which support the establishment of competitive programming contests, enhance education and recruitment processes, facilitate in solving of data mining challenges, online compilers and development platforms integrated as components of other custom systems. Therefore it would be implemented as an efficient system which will help students to gain knowledge of data structure and programming skills. The system includes user interface, sandbox judging environment, functions for evaluating scores and updating reports into the database. In this article we are going to discuss how online judges crash during programming contests. This image will help us explain better how it crashes.

  • Time Limit completion − code should be executed at a certain time. Can we set up a time limit while executing a thread on our Operating System by default?

  • Memory Limit completion − The program should not take all the memory on the CPU. How can we change that in any easier way?

  • Stack Overflow Error − After tracing the program, the system will understand whether the program ran successfully or not. So how does that information get to us?

All of the above points explains the problems of the system to check and run a program. Users are allowed to submit any code in the program. How come we determine if the code submitted is malicious or how malicious.

Some code can execute different processes or they can investigate your document directory, and get a little information or can run administrative commands or can devour the server’s bandwidth and there are various facts that a code can do. And we don’t need to permit the system to do that. So the question is, how can we put these permission guidelines into effect as well? To handle the above scenarios, we will be explaining ways which are as follows below −

Ways

The techniques used to apply permission and hardware of the system is known as code sandboxing. There are two ways code sandboxing approaches by which the web decides to handle the above different scenarios.

  • Lame way

  • Lengthy historical way

Way 1: Lame Way

There are few visible online decision initiatives through which the developer attempts to discover the malicious capabilities on a code before executing the code. For example, in case our code is on C++, the decision will first take a look at if there may be any line of code in which the “system” phrase is used. This answer won’t paint for a diverse reason, as many programming languages don't paint inside the identical way. You can generate a characteristic dynamically and get in touch with it in a few programming languages, so filtering won’t paint in the one’s code. Another thing, what in case you want to print “system” as output? This answer will say that the code is malicious however it isn’t.

Way 2: Lengthy Historical Way

In this approach, the maximum the net decides works. And this answer is relevant to Linux primarily based totally system. Stack Overflow/Runtime Error may be checked via way of means of the go back cost of a program. If it’s far 0, then we can say the system is able to run successfully, if in any other case crashed.

By using various Unix-based complete libraries Memory Limit hassle and time limitation limitations can be provided.Some programming language enables this feature of limitations flag through manner of way of default, for example, Java. Time restriction boundaries and memory Limit drawbacks can be supplied by the usage of numerous Unix primarily based totally libraries. Some programming languages help this type of boundary flag through default, for example, Java.

On Linux, directory permission is simple. We can simply create a user and allow that user for a few directories and some read/write permissions. Then by executing an application of the usage of that user, document listing hassle can be solved. Also, the code is not able to run a few administrative commands.

Limiting community skills is likewise viable with the usage of a few libraries, for example, Trickle. To simply remedy one safety hole we can set up diverse libraries and write diverse codes.

Conclusion

All of the above troubles can be solved in case we use Docker or box primarily based totally on VM (Virtual Machine). We can create a box if we want to have a preliminary memory, with preset community permission, time restriction for the box. All the hassles can be overlooked after with the aid of using the Virtual Machine. There can be alternatives which of the developers can be aware of. In this solution, the entire judging machine can also additionally appear to be slower than the alternative techniques however absolutely on a massive scale it’s far pretty faster, and manner safer, purifier than every other solution. You can take a look at this GitHub Repo to recognize how docker may be used for judging.

This entire manner of judging is one in all maximum vital parts of an online judge. To enforce a judging machine, one wants to apprehend how the Operating System works, or how the programming language works.

Updated on: 01-Aug-2023

66 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements