I've posted a question about this few hours ago on Stack Overflow:
As I know, to limit the resource I can use ulimit command.
But, the problem is when I set the CPU time limit 1 second, and then I want to execute another program with CPU limit 2s, the ulimit command return an error like this:
bash: ulimit: CPU time: cannot modify limit: Operation not permitted
and absolutely my program killed in 1 second.
So, How can I make the second program running with the CPU time limit 2 seconds?