9fans archive / 2000 / 09 / 11 /    prev next

From: Alexander Viro <viro@mat...>
Subject: Re: [9fans] FreeBSD 4.0 / Plan9 3rd ed.
Date: Fri, 1 Sep 2000 19:34:14 -0400 (EDT)



On Fri, 1 Sep 2000 forsyth@cal... wrote:

> >>thread==process. There is a rfork() equivalent (clone(2)) and model is
> >>exactly the same as on Plan 9 (process as a set of components that can be
> >>shared between several processes; fork() as a special case of more generic
> 
> no it is not equivalent.
> would that it were.

You can have multiple stacks. If anything, work by ESP is better than by
TSS. "Current stack pointer" makes sense on most of architectures. TSS
doesn't.

Lack of stack-splitting is not an accident - stack is not a magic object.
It's just an anonymous mapping with MAP_GROWSDOWN in flags.
<checks the manpage>
<damn>
OK, so it's time for patch to mmap.2. Omitted piece being:

	MAP_GROWSDOWN	created mapping will behave like a stack - grow
			downwards upon pagefaults. Stacks are not
			special in any respects - they are nothing but
			anonymous mappings that can grow.

Sorry. That makes my original reaction somewhat over-the-top. Umhm...
OK, I'll look through the thing (drawterm, that is) and try to see what
can be done.

Anyway, TSS hack is doomed - it's not going to work on 2.4. We used to
allocate a separate TSS for each task, but that essentially forced a TLB
flush upon every context switch. And it hurts a lot. Current kernel has a
TSS per CPU and does needed updates by hands - it turned out to be faster
than jump on TSS. So something has to be done anyway. Yes, 2.4 is not
released yet, but you can be 100% sure that this change will not be
reverted.