ioi / isolate

Sandbox for securely executing untrusted programs
Other
1.1k stars 161 forks source link

Time function doesn't work with sleep() #72

Closed kubapat closed 5 years ago

kubapat commented 5 years ago

Hi! I've recently experienced weird problem with isolate. I have time limit on my OJ at 1 second for HELLO WORLD task. When I submit while(true) codes in cpp it works, but when one user has submitted code in C with sleep from unistd.h isolate hasn't killed program.

Thanks in advance

pj1031999 commented 5 years ago

-t, --time='time':: Limit run time of the program to 'time' seconds. Fractional numbers are allowed. Time in which the OS assigns the processor to different tasks is not counted.

gollux commented 5 years ago

This is the difference between the run time limit (--time) and wall clock time limit (--wall-time). The former measures how long did the program actually run, the latter includes time when the program is waiting (for I/O, for timers etc.).

An usual setup is to specify run time limit (to restrict the actual computation time) and set wall clock time limit several times higher to catch programs which get stuck waiting.