Re: pcp updates: libpcp multithreading - documentation and tools for call graphs & lock analysis

"Frank Ch. Eigler" <[email protected]> Mon, 09 Jan 2017 16:12:13 -0500
Newsgroups gmane.comp.sysutils.pcp
Message-ID <[email protected]>
kenj wrote:

> [...]
>  src/libpcp/doc/glibc.unsafe       |   17 +
> [...]
>         The algorithm here is a leaf to root approach to removing nodes
>         that are themselves unconditionally thread-safe (meaning they acquire
>         no locks and call only thread-safe routines), and remove all incoming
>         arcs to these nodes.
> [...]

It sounds like you're really keen on a "bottom-up" sort of approach to
the problems, starting to look at how libpcp makes use of other
libraries, rather than concurrency controls on its own internal shared
data .  Then it becomes important to classify functions etc.  properly
in the libpcp/doc/*.{safe,unsafe} lists, so that no effort is wasted or
missed.

So for example I wonder why the tsearch* related functions are listed in
glibc.unsafe.  These do not refer to shared state within another
library, so don't have nor need internal concurrency controls.  In the
way we call them in libpcp (pdubuf), we hold -a- lock to denote the
critical section of the shared libpcp data (the tree root pointers).

Yes, this lock shouldn't be the big libpcp lock (and isn't in the
fche/multithread branch), but that's not because of tsearch* etc. being
somehow unsafe.  In this context, they're exactly as safe or unsafe as
any other operation on a shared pointer - as a C level assignment or
dereference or whatever.

Maybe the .unsafe lists should only include functions that are
inherently MT-unsafe (such as fighting over hidden shared data), which
-must- be protected with some auxiliary lock, no matter what.  The
pdubuf's subsystem's use of tsearch* wouldn't be in that category.

- FChE

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links:

You receive all messages sent to this group.

View/Reply Online (#14958): https://groups.io/g/pcp/message/14958
View All Messages In Topic (5): https://groups.io/g/pcp/topic/3819767
Mute This Topic: https://groups.io/mt/3819767?uid=174580
New Topic: https://groups.io/g/pcp/post
-=-=-
pcp mailing list
[email protected]
https://groups.io/g/pcp/messages
-=-=-
Change Your Subscription: https://groups.io/g/pcp/editsub?uid=174580
Group Home: https://groups.io/g/pcp
Contact Group Owner: [email protected]
Terms of Service: https://groups.io/static/tos
Unsubscribe: https://groups.io/g/pcp/leave/354243/563757577/xyzzy
-=-=-=-=-=-=-=-=-=-=-=-