But if you check Ideone.com and write a code like this:
while(true){}
the page loads but the ide says time limit exceeded after 5 seconds and stops the execution. Now, how do you do that?
while(true){}
the page loads but the ide says time limit exceeded after 5 seconds and stops the execution. Now, how do you do that?
executeUserProgram(userProgram, timeout=5)...
alternatively, the server on which the user program runs could monitor user processes and terminate any process using excessive CPU time.Both approaches look for the effects of an infinite loop instead of the program logic of an infinite loop. Which makes sense since logical analysis for infinite loops is the Halting Problem and NP-Hard.
executeUserProgram()
Is an abstraction. I made up the name to explain how the behavior might be implemented in the abstract. Implementing the abstraction in a way appropriate for an actual program is software engineering based on the actual program's actual constraints.