lkml.org 
[lkml]   [1998]   [Sep]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: fork,clone,CLONE_VM prob.
Date
In article <199809050644.CAA11601@rabi.phys.columbia.edu>,
Zack Weinberg <zack@rabi.phys.columbia.edu> wrote:
>
>Hmm... A clone flag that shared all of VM except the stack might be
>interesting.

Oh, puh-leeze.

Linux is so far the _only_ system I know of that avoided that particular
braindamage. Both Irix and Plan-9 have "clone-like" system calls (in
fact, as far as I know the concept came from plan-9), but both of them
tried to do it the way you allude to above.

And it's completely broken and totally moronic when you actually start
looking into what that one small "wouldn't it be nice if" feature means
for the implementation.

Why Linux does NOT do the above:
- it's impossible to do an efficient task-switch on any current
hardware I know of once you start doing "partially shared" page
tables.
- it's impossible to do an even remotely sane implementation of good
sharing, if that sharing can sometimes be incomplete. What happens
when the stack grows in one thread but not the other?
- You have "local pointers" and "global pointers" depending on whether
they point to inside your stack or not. As such, sometimes you can
pass pointers to your stack around, and sometimes you can't depending
on whether the thing you pass the pointer to happens to be
communicating with another thread.

Trust me, anybody who ever implemented what you were thinking of is now
either feeling very sorry about it or is just too stupid to understand
what a disaster it is.

And yes, it looks like a deceptively good idea. It just isn't.

Linus

-
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/faq.html

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