lkml.org 
[lkml]   [1998]   [Sep]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: fork,clone,CLONE_VM prob.
On Sat, 5 Sep 1998, Zack Weinberg wrote:

>>If it's realy true that also the stack pointer is passed identical to the
>>child process so they use really the same physical memory it is clear that
>>one of the processes cannot run right. In that case I have to allocate a
>>new selector for the PL3 Stack (hmm, maybe for the PL0 stack too?),
>[...]
>
>You're working too hard. All you have to do is change the user-space stack
>pointer to point at (the top of) a block of memory allocated for the
>purpose, and jump into a new function. If that function returns, make an

I have tried to use a new sp in my test program. It was like this:

int stack[10000];
pid=clone(&stack[5000],CLONE_VM);
:

this way the new stack sould become a free memory region (at the middle of
the vector). But no difference. The child did nothing I could see.

>exit() syscall. Obviously you do this only in the child.
>
>Or you can use glibc, which has a clone() wrapper that does all this for
>you.

What/where is glibc? Do you mean glib.h? There is no function called
clone.

Could you please modify my test program
(http://cip.physik.uni-bonn.de/~muenning/forktest.c) that way that the
child process does something and mail it to me? The way you describe it
sounds easy but I cannot see how it should work.

Another thing that I don't understand is why the child process becomes a
zombie when it exits (before the parent process). How can p.ex the shell
make child processes (call programs...) and when they exit they do not
become zombies? Or cron? My system should be full of zombies :-) but it
isn't.

OK, maybe I should describe the thing I am want to do with the
forking/cloning. There may be some other way to do it I don't know about.

I want to write some kind of specialized server app to wich a lot of
clients can connect (network). So far it is nothing special. But this
connection have to manage the clients and a data flow between them
(something like messages etc.). With clone and CLONE_VM I could make every
connection an own process but all would access the same "data pool". This
would work without CLONE_VM if there is a comparable way to make an
interprocess communication with N(>2) processes at the same time. I do not
know any. Another approach would be to make a chained list of objects for
every connection and to make something like a cooperative multitasking...
it would need a lot of "tricks" to make it fulfil all my needs an I don't
like it.

Some suggestions?

Thx!
Konstantin Münning ,,, uzs446@uni-bonn.de
-------------------------------/'^'\------------------------------------
www.muenning.com ( o o ) koko@muenning.com
--------------------------oOOO--(_)--OOOo-------------------------------
Ever notice that even the busiest people are never too busy to tell you
just how busy they are.
(-O-)
Measure with a micrometer. Mark with chalk. Cut with an axe.
(-O-)
Subtlety is the art of saying what you think and getting out of the way
before it is understood.
(-O-)
Don't take life too seriously -- you'll never get out of it alive.


-
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    [from the cache]
©2003-2011 Jasper Spaans. Advertise on this site