lkml.org 
[lkml]   [2000]   [Mar]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Avoiding OOM on overcommit...?
Date
On Fri, 24 Mar 2000 12:47:54 -0600 (CST), you wrote:
>> On Wed, 22 Mar 2000 07:33:12 -0600 (CST), you wrote:
>> >James Sutherland <jas88@cam.ac.uk>
>> (snip)
>> >> Yours, if you don't have enough resources available to you to run it.
>> >> Otherwise, both run fine.
>> >
>> >BUT "when I use up the resources given to me" - If the resources weren't
>> >available, why did the system give them to me?
>>
>> It didn't.
>
>It let me start the process. That confirmed that the resources were available.

No. It just confirmed you had the resources to start a process.

>I cannot cover race conditions between your process and mine. You may use
>a sbrk call to get memory. So can I, the return from sbrk resumes my process
>which fills memory with data. Your process starts to fill memory with data,
>and gets aborted because the page you requested really didn't get to you.

First come, first served, if there is contention between them. If both
our processes tried to lock a file for exclusive access, which would
win?

(snip)
>> >> >Which is the correct one?
>> >> Yours, as above.
>> >As determined by what?
>>
>> System policy.
>
>What policy. kernel gives you memory. kernel gives me memory. oops one
>process didn't get memory.

No. This is the point - the kernel does NOT give either process
memory, it gives them both address space. There is plenty of that to
go round. When one then fails to get the memory it is requesting, it
is signalled as a result.

>> >> >How do you know it is the correct one?
>> >> Because it would put you above the limit available to you.
>> >
>> >But the system told me the resources were available. And what limit?
>> >The kernel doesn't support resource quotas.
>>
>> I'm pretending for the moment it does; if we can pretend it doesn't
>> have overcommit, we can pretend it does have per-user rlimits, too.
>> We have already agreed that it SHOULD have this feature, and
>> eventually, it will. If you want it so badly, pay for it.
>
>rlimits are a per process limit available to the user to adjust. quotas are
>a per user limit specifing the maximum amount of a resource that the user
>may use.

OK, per user resource limits.

>> >> >If it happens again, are the answers the same?
>> >> Yes.
>> >
>> >BUGGGY. The system gave the resource to me. See above. What distinguishes
>> >my job from yours?
>>
>> I loaded a program when there WERE enough resources to support it. You
>> loaded the same program when there were not. I got the resources I was
>> allowed, you got the resources available to you.
>
>So did I.

>You don't seem to recognize the context switching and the race
>condition that can occur. If the resources were not available then my process
>should not have been started.
(snip race condition)
>Either is possible, and I belive would occur fairly between the
>two since the kernel doesn't appear to play favorites.

I accept that there is a race condition. Both processes are trying to
grab the same resource, one will fail, the other will not. The
situation is completely unchanged by imposing resource quotas.
(OK, you could set them low enough to prevent either process running,
but that's worse...)

James.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:57    [W:0.077 / U:0.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site