SUMMARY: setting CPU usage limits with ulimit

From: Geoff Lane (zzassgl@twirl.mcc.ac.uk)
Date: Thu Jun 15 2000 - 06:34:46 CDT


The only additional info about ulimit I received was from Stephen Harris who
pointed out that this can all be explained if there's code in ulimit that
prevents a user from setting the hard limit below the current soft limit and
it's been like that since at least SunOS 4.1.3_U1B.

OK, now I understand how it seems to work I can give the users a scare and
set some limits on CPU misuse <evil grin>

>
>
> I've checked this on X86 Solaris 7 and Sparc Solaris 8 using ksh in each
> case.
>
> The man page for ulimit (and the ulimit section for ksh(1)) both suggest that
> it's possible to set an explicit hard and soft limit for CPU usage but by
> testing this is shown not to be so...
>
> $ ulimit -t
> unlimited
> $ ulimit -Ht 400 <-- this should work as reducing hard limit is permitted
> ksh: ulimit: exceeds allowable limit
> $ ulimit -St 400
> $ ulimit -t
> 400
> $ ulimit -Ht
> unlimited
> $ ulimit -St
> 400
> $ ulimit -t 300 <-- this has set hard limit as expected
> $ ulimit -Ht
> 300
> $ ulimit -St
> 300
>
>
> So I, as an ordinary user, can implicitly set a lower hard limit for CPU but
> cannot explicitly set a lower hard limit?
>
> The following sequence is a work around...
>
> $ ulimit -t 1000000
> $ ulimit -t
> 1000000
> $ ulimit -St 500
> $ ulimit -t
> 500
>
> which lets be do what I want, set a high hard limit and a lower soft limit.
>
> So, is it me being dumb, the man pages being inaccurate or ulimit being
> buggy? I've checked with SunSolve but didn't see anything obviously
> related.
>
> As usual I'll summarize any replies.
>
>
> --
> /\ Geoff. Lane. /\ Manchester Computing /\ Manchester /\ M13 9PL /\ England /\
>

-- 
/\ Geoff. Lane. /\ Manchester Computing /\ Manchester /\ M13 9PL /\ England /\

This version of me is an unregistered evaluation copy.



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:14:09 CDT