setting CPU usage limits with ulimit

2007-12-25 10:26:00

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.

Comments

Got something to say?

You must be logged in to post a comment.