i'm not sure if i understood what you mean
Quote:
Then you have one process with two threads and a second process.
|
i don't realy understand this:
Process 1 (P1) creates a thread
P1 forks();
why should P1 have now 2 threads and P2 0 threads? (but i think i misunderstood)
i thought if i fork P1 with a thread, P2 will also have the same thread at exactly the same position as P1
so if Thread1 (T1) is waiting for data T2 will wait too, but only one thread will get the data, right?
Quote:
The first two threads are sharing the data, and all three would share the file descriptors (including sockets).
|
which FIRST two?
which THREE? (three processes, threads? why three?)
Quote:
File locks are not inherited to the child process (from fork()). The important aspect here is that the new process inherits from the calling thread.
|
i think it's more important to know what happens to the threads?
does P2 have a thread?
the problem with the synchronization will be, that i have to sync many processes with many threads
it's like a many to many synchronization
and that's the challenge, because how could i know if
many equals "everybody who needs it"
because maybe some thread does something different
what i want to do is create a high configurable server
the server forks childs (e.g. 5 childs)
and childs have some threads listening on a port
now i don't want to have 5 childs
i want 6
this means i have to fork a new child
but the main server itself will have some threads at this time
so i would fork a process with some threads
i know that one possibility is "just don't do it"
but i want to try
thx@ll