Re: Overcommitable memory??

From: Olaf Weber (olaf@infovore.xs4all.nl)
Date: Mon Mar 20 2000 - 02:22:01 EST


Jesse Pollard writes:
> On Sun, 19 Mar 2000, Olaf Weber wrote:

>> IIRC the usual practice on IRIX is that the child gets a copy of the
>> parent's stack. The sproc call on IRIX can be compared to clone on
>> Linux. If you don't mind using linux-specific code, you can use a
>> clone call with CLONE_VM set. This works provided the child doesn't
>> attempt to return from the function that called clone.

> But if the parent does return, and proceds to call another function,
> woudn't that corrupt the stack frame of the child?

Well, I misspoke a bit. Here's how sproc(2) and clone(2) work:

     pid_t sproc (void (*entry) (void *), unsigned inh, ...);

     int __clone(int (*fn) (void *arg), void *child_stack, int
     flags, void *arg)

In both cases, you can specify how a stack is to be allocated. The
entry/fn argument is the entry function for the child. Return from
the entry function means the child exits.

On IRIX, if the child needs access to the parent's stack, you can
specify PR_BLOCK to ensure the parent only resumes running after the
child unblocks it with an unblockproc(2) call.

-- 
Olaf Weber

Do not meddle in the affairs of sysadmins, for they are quick to anger and have no need for subtlety.

- 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/



This archive was generated by hypermail 2b29 : Thu Mar 23 2000 - 21:00:30 EST