[collectd] Threads, pthreads, pth, ...
Florian Forster
octo at verplant.org
Fri Dec 16 21:50:16 CET 2005
Hi :)
On Fri, Dec 16, 2005 at 05:04:11PM +0100, Niki Waibel wrote:
> > Maybe I did get something wrong about `pth', but isn't one consequence
> > of userland-threads that you have only one process?
>
> all thread (pthreads, pth, etc) have 1 process.
Hm, my bad, by process I meant `kernel thread' or `LWP' or `point of
execution' or whatever you may want to call that. The main problem when
talking about threads is, in my opinion at least, terms.
> > That means that if one
> > thread is waiting the process is waiting. And that would mean that all
> > threads are "waiting"..
>
> no. that is the thing *all* threading implemmentations handle. (pth
> does that by overwriting the read/write/etc calls via its header
> file).
Okay, this explains a lot; you've convinced me that it would work.
Though I now think this is a dirty hack.. ;) That doesn't work with
libraries you link against, does it?
> i'd recommend you to read
> man pth
> it explains almost everything.
I've read <http://www.gnu.org/software/pth/pth-manual.html> which was
very general and didn't talk about how `pth' actually works. The manpage
is only a groff-version of the same text..
> the concepts / akademic books talk a lot about the kernel implementation.
> if you have a N->N a N->1 or a N->M model.
> pth does not need any of them. compleatly in userspace by overwriting
> (via define) some functions.
What's the difference between a `N->1' model and a thread library
completely in userland?
> > Also, I don't want to have multiple threads within plugins, because the
> > main programm should know as little as possible about the plugins.
>
> put i think that in the ping module you'll just need at least the pth threads.
We could implement the same master-thread / slave-threads model (the one
I've talked about in my last mail in this thread) within the plugin. The
main programm would never know.. But since that's a bit of work I might
as well look into patching libping to support multiple targets and use
switch there.. That'd be the fastest (performance wise) I guess..
> > Well, but I _do_ want to be convinced if I'm doing something wrong
> > or could do something better or easier.. ;)
>
> ok. i'd definitely would give pth a go. if it is not sufficient (fast
> enough) i'd use pthreads and implement the necessary locking.
I'll definitely have a look..
Regards,
-octo
--
Florian octo Forster
Hacker in training
GnuPG: 0x91523C3D
http://verplant.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20051216/e8349018/attachment.pgp
More information about the Collectd
mailing list