9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] rfork(), getss() etc etc
@ 2000-09-02  7:50 nigel
  2000-09-02  8:57 ` Alexander Viro
  0 siblings, 1 reply; 9+ messages in thread
From: nigel @ 2000-09-02  7:50 UTC (permalink / raw)
  To: 9fans

Hmm.

clone() not splitting the stack is a feature of Linux, and probably not
worth wasting brain power over. The fact that rfork() in FreeBSD copied
clone() semantics, but the Plan 9 manual page is hard to
believe. I did get some indication recently that the FreeBSD manual page
would be changed to own up to the fact that it was rfork() by name
but clone() by nature! FreeBSD does not split either because of the way
the VM works (reading between the lines, allegedly).

Now, what is the problem with this? Firslty, the only way to tell whether
you are parent or child after the split is to check the return result from
the system call. The inevitable conclusion is that assembly code is
required to establish a new stack. This is a retrograde step, and I am
staggered to find open source systems promoting the use of assembly
code by including system call variants which cannot be sensibly used
without.

Secondly, the stack now established is not managed or protected by
the kernel. Good grief, this is what we all criticise Win9x and MacOS
for.

Thirdly, you can only identify which process you are by calling getpid(),
rather than referencing a data structure in your own stack. This is
expensive, as it involves a system call, plus some form of mapping
(?hash table?) from pid to per process data structure.

This is might be why gettss() was used. It produces a number with
a smaller range that getpid(), allowing a simple index to per process
data.

The Vita Nuova FreeBSD port of the Inferno emu uses rfork() and getpid().



^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: [9fans] rfork(), getss() etc etc
@ 2000-09-02  9:49 nigel
  2000-09-02 10:52 ` Alexander Viro
  0 siblings, 1 reply; 9+ messages in thread
From: nigel @ 2000-09-02  9:49 UTC (permalink / raw)
  To: 9fans

>>	Check the examples of use. Really.

Linuxthreads is a very good example.

>>	Ferchrissake, you've explicitly asked for shared address space. It

Well, yes, but stacks are a special case. Each process has to take care
not to write outside of it's own data, fine. This is called good programming
technique, and does not require any special coding.

Ensuring that the stack is not overflowed requires either compiler
assistance, or contortions in programming.

If I thought that splitting the stack was an unreasonable thing to ask for,
I wouldn't. The thing is, fork() does it so it can't be hard. Also, I have solid
examples of operating systems which provide a choice.

>>	(Thread_Data *) (ESP & -Alignment) + Alignement - sizeof(Thread_Data)

Hadn't escaped my radar. We're getting into machine dependency here again,
but it is a solution that I had tried.

>>	consequences - you are welcome, just let's avoid imitating *.advocacy.

One man's advocacy is another man's technical discussion. I simply do not
buy the "clone() is perfect and cannot be changed" attitude, or for that
matter the "FreeBSD rfork() is perfect and cannot be changed" attitude either.
In both cases, the problem could be solved by adding a spot of functionality,
and taking away none.

So one could add this feature, break nothing, and aid a whole class of applications.
Why not?




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2000-09-05  5:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-09-02  7:50 [9fans] rfork(), getss() etc etc nigel
2000-09-02  8:57 ` Alexander Viro
2000-09-02  9:31   ` Alexander Viro
2000-09-02  9:39     ` Alexander Viro
2000-09-02  9:49 nigel
2000-09-02 10:52 ` Alexander Viro
2000-09-03  2:51   ` Scott Schwartz
2000-09-03  3:03     ` Boyd Roberts
2000-09-05  5:32     ` Erik Theisen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).