Support for SMP --------------- It's actually going to be quite easy to modify rws so that it supports SMP - even though the underlying threading library is lightweight user threads. The plan is as follows, I'm just waiting for the patch! Support should probably go directly into pthrlib/src/pthr_server.c so that it can benefit all pthrlib-based servers. At start up, based on some command line flag and/or autodetection of the number of CPUs, the server should fork N times where N is the number of CPUs. This results in N+1 processes. Process 0 (the parent) will have the listening socket. Processes 1-N will be connected by Unix domain sockets back to process 0. Processes 1-N will have special modified listen threads listening on their respective Unix domain socket. (NB. Use the socketpair function to create each Unix domain socket). When process 0 receives a connection, based on some hashing function of the peername, it should decide which of the 1-N processes will handle the request. The important thing is that the hashing function must always assign the same client to the same process, which is why the hash should be based on the peername. When a new client connection arrives at process 0, let's say it decides to pass this to process n (1 <= n <= N). It should pass the file descriptor over the corresponding Unix domain socket to process n using the sendmsg(2) function (see cmsg(3) for details). Process n will receive the file descriptor and can then continue to handle the request. This method should scale up over small numbers of processors (eg. up to 8).