@C_R
Thanks for the investigation.
The point of this test is not parrallel rich or even int. But just to show that Maple behavior is not deterministic where timelimit sometimes work and sometimes do not work (either very late, or completely lock).
It is the only small test case I could make that clearly shows this.
I've been having this problem in Maple for many years, with random hangs at different places using same code with no solution. And this test is meant to show this.
In my main program I actually use
kernelopts(numcpus=1);
kernelopts(gcmaxthreads=1);
To force Maple not to use threads and to use one core only in the hope this will prevent the random hangs. But unfortunately this did not solve the problem in my program. It still hangs at random places even thought I do not use parrallel risch.
Below is V4 of the trial worksheet which is the same as the one in my post, but I added the above code for each trial to prevent Maple from using more than one core and more than one thread.
This now shows that indeed each trial now take similar but very long time to finish. Instead of around one minute, each now takes about 24 minutes to complete. So timelimit is still not working as was claimed in 2021 release. I understand that timelimit can't return at exact time asked. But to ask for one minute timeout and get 24 minutes timeout means the function is broken. I can understand 10 to 20 or even 30 percent off.
I do not understand why Maplesoft is unable to make timelimit work after all these years. It can't be that hard to fix.
So using one core core and one thread solved the problem of getting different timing for this test.
But since I am not using parallel risch in my main program and still get random hangs at different places in code, this means there is another Maple function I am using which does not support timelimit but I have no idea what it is in order to try not to use it or replace it with something else.
But for this specific question, I think your answer here solves it as it shows the cause of the different times was using threads.
Download hangs_int_V4_june_16_2024.mw