Messages in this thread | | | From | (Linus Torvalds) | Subject | Re: fork,clone,CLONE_VM prob. | Date | 5 Sep 1998 07:09:25 GMT |
| |
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
| |