safe usage of clone() ?

From: Frederick Barnes (frmb2@ukc.ac.uk)
Date: Wed Apr 19 2000 - 10:04:17 EST


Hello all,

I've got a program which creates 10 clone()s of itself, sharing
VM, FS info and file descriptors (CLONE_VM|CLONE_FS|CLONE_FILES).
One of these clones repeatedly calls accept() on a TCP socket,
and passes the returned descriptor to one of the other clones
which then reads from the socket. Due to the way it's implemented,
the accept() call will tend to move between the clones, as will
read()s. To make things safe, I'm using semaphores and shared memory
to `dispatch' the calls to accept() and read().

The problem I'm having is that occasionally something gets stuck,
and the clone who should be blocked in accept() is in the kernel's
`tcp_data_wait'. Shortly afterwards (timeout in tcp_data_wait ?),
it segfaults.

The problem could well be in my code, but I've not spotted it yet.
If anybody has any ideas as to what the problem might be, I'd be
most grateful, cos it's giving me headaches.

TIA,
  Fred.

-- 
Fred Barnes, PhD research student, UKC.  http://nuked.xylene.com/
frmb2@ukc.ac.uk         http://www.cs.ukc.ac.uk/people/rpg/frmb2/

- 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/



This archive was generated by hypermail 2b29 : Sun Apr 23 2000 - 21:00:15 EST