I originally posted this at http://dtrace.org/blogs/brendan/2011/02/19/dtrace-pid-provider-links.
I've been writing posts to explain the DTrace pid provider. Not just its features, which are documented in many places, but also its hazards and limitations. Many of these I learned the hard way during the last six years of using this provider in test, development and production. The posts are:
- pid provider: entry probe
- pid provider: entry arguments
- pid provider: return
- pid provider: instructions
- pid provider: overhead
These may also serve as a practical introduction and tutorial to the pid provider.
I've been wanting to share some useful pid provider-based scripts, but first needed to explain some of the risks, as I have now done in these posts. You can really shoot yourself in the foot with this provider, especially regarding overhead in the short term and script stability in the longer term.
For advanced reading on the pid provider, see the following:
- pid provider exposed: internals by Adam Leventhal (creator of the pid provider)
- when magic collides: pid provider bug deep dive by Bryan Cantrill
To use this provider, you'll need a system with DTrace and the pid provider, and privilege to use it (which usually means root access). Joyent SmartMachines typically have access to DTrace and the pid provider from the root account, and privileges can be configured for other accounts to use it.