|
|
ulimit: per-process limits and other questions
Is there a way to enforce a per process limit? ulimit has many options but
they are shell session specific, right? But let's say I wanted to run
matlab but only allow it 2 Gigs of memory is there a way to do this?
Another point that confuses me is why my ulimit won't allow me to push the
limit in the upwards direction. I understand that the hard limit set by
root cannot be exceeded but what's the harm in trying to move up and down
so long as I don't exceed the hard limit?
e.g.
[rpnabar@eu001 ~]$ ulimit -u
137216
[rpnabar@eu001 ~]$ ulimit -u 137215
[rpnabar@eu001 ~]$ ulimit -u
137215
[rpnabar@eu001 ~]$ ulimit -u 137216
-bash: ulimit: max user processes: cannot modify limit: Operation not
permitted
Is there a reason for this restriction?
--
Rahul
|
|
0
|
|
|
|
Reply
|
Rahul
|
9/9/2010 11:26:57 PM |
|
On 2010-09-09, Rahul <nospam@nospam.invalid> wrote:
> Is there a way to enforce a per process limit? ulimit has many options but
> they are shell session specific, right? But let's say I wanted to run
> matlab but only allow it 2 Gigs of memory is there a way to do this?
>
> Another point that confuses me is why my ulimit won't allow me to push the
> limit in the upwards direction. I understand that the hard limit set by
> root cannot be exceeded but what's the harm in trying to move up and down
> so long as I don't exceed the hard limit?
>
> e.g.
> [rpnabar@eu001 ~]$ ulimit -u
> 137216
> [rpnabar@eu001 ~]$ ulimit -u 137215
> [rpnabar@eu001 ~]$ ulimit -u
> 137215
> [rpnabar@eu001 ~]$ ulimit -u 137216
> -bash: ulimit: max user processes: cannot modify limit: Operation not
> permitted
>
> Is there a reason for this restriction?
The limits you see through 'ulimit' and friends _ARE_ per-process
limits.
It would be nice to have separate hard limits and allow non-root
users to adjust the soft limits within the boundaries of the hard
limits. Many years ago, I used an operating system that did have
separate hard vs. soft limits. There are a _FEW_ things I wish
Linux/Unix had or could do that it doesn't.
--
Robert Riches
spamtrap42@jacob21819.net
(Yes, that is one of my email addresses.)
|
|
0
|
|
|
|
Reply
|
Robert
|
9/10/2010 4:43:50 AM
|
|
Robert Riches <spamtrap42@jacob21819.net> wrote in
news:slrni8jds6.ga7.spamtrap42@one.localnet:
> The limits you see through 'ulimit' and friends _ARE_ per-process
> limits.
Ah! Thanks for that clarification. My bad. But then that means _every_
process has the same limits and within a shell I cannot fine-tune this?
> It would be nice to have separate hard limits and allow non-root
> users to adjust the soft limits within the boundaries of the hard
> limits. Many years ago, I used an operating system that did have
> separate hard vs. soft limits. There are a _FEW_ things I wish
> Linux/Unix had or could do that it doesn't.
Does anyone know _why_ Linux stopped allowing this? Is there a performance
or other tradeoff or just a feature that no-body much needs?
--
Rahul
|
|
0
|
|
|
|
Reply
|
Rahul
|
9/10/2010 6:00:33 AM
|
|
In <Xns9DEFA4548B9C6650A1FC0D7811DDBC81@85.214.73.210> Rahul:
[Snip...]
> anyone know _why_ Linux stopped allowing this
FWIW...
I'm not sure it was Linux mentioned:
"Many years ago, I used an operating system..."
Possibly Sun/Solaris or SGI, in the *nix world, but I don't recall.
--
Regards, Weird (Harold Stevens) * IMPORTANT EMAIL INFO FOLLOWS *
Pardon any bogus email addresses (wookie) in place for spambots.
Really, it's (wyrd) at airmail, dotted with net. DO NOT SPAM IT.
I toss GoogleGroup (http://twovoyagers.com/improve-usenet.org/).
|
|
0
|
|
|
|
Reply
|
wookie7138 (24)
|
9/10/2010 11:46:04 AM
|
|
Rahul writes:
> But then that means _every_ process has the same limits and within a
> shell I cannot fine-tune this?
Fork a shell, set the limits, and exec the process. Do this for each
process that needs different limits.
> Does anyone know _why_ Linux stopped allowing this? Is there a
> performance or other tradeoff or just a feature that no-body much
> needs?
Unless told otherwise ulimit sets both hard and soft limits. You can
lower the hard limits but not raise them. "-S" tells ulimit to set only
soft limits, which you can raise.
Type "help ulimit" at the bash prompt or read the bash man page section
on ulimit.
--
John Hasler
jhasler@newsguy.com
Dancing Horse Hill
Elmwood, WI USA
|
|
0
|
|
|
|
Reply
|
John
|
9/10/2010 5:39:36 PM
|
|
John Hasler <jhasler@newsguy.com> wrote in
news:87lj797b1j.fsf@thumper.dhh.gt.org:
Thanks John!
> Fork a shell, set the limits, and exec the process. Do this for each
> process that needs different limits.
That works. I didn't realize that the forked shells inherit it.
> Unless told otherwise ulimit sets both hard and soft limits. You can
> lower the hard limits but not raise them. "-S" tells ulimit to set only
> soft limits, which you can raise.
>
> Type "help ulimit" at the bash prompt or read the bash man page section
> on ulimit.
Yup. I did that already. What isn't clear to me is what utility "hard"
limits provide over "soft"? Is the reason so that the process being invoked
cannot subsequently stealthily increase it's own limit after it has been
forked? I'm not sure under what usage scenarios one uses the soft ulimits
and when the hard ulimits.
--
Rahul
|
|
0
|
|
|
|
Reply
|
Rahul
|
9/10/2010 6:03:05 PM
|
|
Rahul writes:
> What isn't clear to me is what utility "hard" limits provide over
> "soft"? Is the reason so that the process being invoked cannot
> subsequently stealthily increase it's own limit after it has been
> forked? I'm not sure under what usage scenarios one uses the soft
> ulimits and when the hard ulimits.
You're a system administrator for a Unix system at a university. One of
your machines has accounts for 180 undergraduates. You don't want them
bringing the system to its knees with fork bombs or infinite loops in
CS101 homework problems. What do you do?
--
John Hasler
jhasler@newsguy.com
Dancing Horse Hill
Elmwood, WI USA
|
|
0
|
|
|
|
Reply
|
John
|
9/10/2010 6:27:41 PM
|
|
John Hasler <jhasler@newsguy.com> wrote in
news:87hbhx78te.fsf@thumper.dhh.gt.org:
> You're a system administrator for a Unix system at a university. One of
> your machines has accounts for 180 undergraduates. You don't want them
> bringing the system to its knees with fork bombs or infinite loops in
> CS101 homework problems. What do you do?
Understood. :)
--
Rahul
|
|
0
|
|
|
|
Reply
|
Rahul
|
9/10/2010 8:29:13 PM
|
|
On 2010-09-10, Harold Stevens <wookie@jimbo.localdomain> wrote:
> In <Xns9DEFA4548B9C6650A1FC0D7811DDBC81@85.214.73.210> Rahul:
>
> [Snip...]
>
>> anyone know _why_ Linux stopped allowing this
>
> FWIW...
>
> I'm not sure it was Linux mentioned:
>
> "Many years ago, I used an operating system..."
>
> Possibly Sun/Solaris or SGI, in the *nix world, but I don't recall.
Actually, the operating system I used many years ago with both
hard and soft limits was DEC's (remember them?) VAX VMS. I don't
think I have ever used a Unix that had both hard and soft limits.
From other postings in the thread, it sounds like Linux has
them. I was not aware of that. Learn something new every day...
--
Robert Riches
spamtrap42@jacob21819.net
(Yes, that is one of my email addresses.)
|
|
0
|
|
|
|
Reply
|
Robert
|
9/11/2010 4:54:07 AM
|
|
|
8 Replies
589 Views
(page loaded in 0.096 seconds)
|
|
|
|
|
|
|
|
|