novel idea

Andreas Ericsson ae at op5.se
Mon May 9 12:33:15 CEST 2005


Here's a sort of crude proof-of-concept for both the multiplexing and 
the multithreading model.

Both versions were compiled with gcc -O2 -fomit-frame-pointer -Wall

Sys-spec is Pentium III 866Mhz with 640Mb ram, running Linux 2.4.30 with 
LinuxThreads (obviously).
Both programs fire up 100 instances of /bin/ls -l /etc/{passwd,shadow} 
and properly collect return values and such.

mplex seems to have some issues handling the "last" of the 
filedescriptors. I'm sure it can be worked around in about 20 minutes or so.

time ./mthread
real    0m0.631s
user    0m0.270s
sys     0m0.320s

time ./mplex
real    0m1.668s
user    0m0.320s
sys     0m0.250s


Running both programs on an SMP enabled system (linux 2.4.30, 2 Pentium 
XEON with HT enabled) proved the unsurprising fact that mplex runs about 
the same, while mthread runs about three times faster.

Note that both programs are open for considerable optimizations with 
little effort.

Also notable is that the mthread model leaves all the complexity to the 
calling process (handling locks and such) while mplex executes in 
serial, although it requires some table-handling on behalf of the caller 
(slots must be reused, but they aren't in the simple POC).

Sean, it'd be interesting to compare this test with the dlopen() idea of 
yours. Make it time itself so that timing starts after dlopen() and each 
command just requires a table lookup, symbol lookup, fork, execution and 
collection.

Happy hacking.

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Lead Developer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mplex.c
Type: text/x-csrc
Size: 2514 bytes
Desc: not available
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20050509/55b3292d/attachment.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mthread.c
Type: text/x-csrc
Size: 1750 bytes
Desc: not available
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20050509/55b3292d/attachment-0001.c>


More information about the Developers mailing list