multithreaded tcp echo server problem & flips

Christian Helmuth ch12 at
Tue Aug 1 14:34:10 CEST 2006

Hello David,

On Tue, Aug 01, 2006 at 04:55:53AM -0700, David Silcott wrote:
> I've ported my multithreaded tcp server to L4 using
> flips but I am having some problems getting it to run
> properly. It is a quite a bit to explain so I've
> written a simple tcp echoserver to demonstrate my
> problem.

Ouch, already at this point I remember some limitations of the FLIPS
experiment and L4VFS. FLIPS supports concurrent blocking RPCs, e.g.
send() and recv(), only for calls using different L4VFS connections, see
l4vfs_init_connection(). If one uses the same connection for two blocking
calls the latter one is blocked in the underlying IPC in the microkernel.

L4VFS currently implements no extensive multi-threading support and
therefore initializes only one connection to FLIPS per task, see
l4/pkg/l4vfs/lib/libc_backends/socket_io/socket.c line 44 ff.

> The following happens when the server starts and the
> client connects and send data.
> 1. Echoserver starts and listens on port 2222
> 2. client connects, server creates a child_server
> thread to service client and starts listening again
> 3. client sends string to child_server thread which is
> received. child_server however is unable to complete
> send(echo), it seems to be blocked at this point.

I guess your server blocks in accept() and the child_server blocks during
its "send()" IPC in the kernel.

> 4. The send is only completed when another client
> attempts a connect(..and the server moves on from the
> accept(..) statement).

Now the thread in FLIPS replies the accept() request and enters an
ipc_wait(). The child_server "send()"-IPC is unblocked and the packet is

To fix this issue you should start in the before-mentioned socket.c file
and init L4VFS connections to FLIPS per thread.

Christian Helmuth

TU Dresden, Dept. of CS
Operating Systems Group

More information about the l4-hackers mailing list