ArticleslgStudy

computer science

SystemTap

SystemTap is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand SystemTap rather than just read about it. In short: In computing, SystemTap (stap) is a scripting language and tool for dynamically instrumenting running production Linux-based operating systems. System administrators can use SystemTap to extract, filter and summarize data in order to enable diagnosis of complex performance or functional problems.

SystemTap — main illustration
SystemTap — illustration

Key takeaways

  • SystemTap belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect SystemTap to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of SystemTap from memory before moving on to harder problems.

Reference excerpt

In computing, SystemTap (stap) is a scripting language and tool for dynamically instrumenting running production Linux-based operating systems. System administrators can use SystemTap to extract, filter and summarize data in order to enable diagnosis of complex performance or functional problems. SystemTap consists of free and open-source software and includes contributions from Red Hat, IBM, Intel, Hitachi, Oracle, the University of Wisconsin-Madison and other community members.

History SystemTap debuted in 2005 in Red Hat Enterprise Linux 4 Update 2 as a technology preview. After four years in development, SystemTap 1.0 was released in 2009. As of 2011, SystemTap runs fully supported in all Linux distributions including RHEL / CentOS 5 since update 2, SLES 10, Fedora, Debian and Ubuntu. Tracepoints in the CPython VM and JVM were added in SystemTap 1.2 in 2009. In November 2019, SystemTap 4.2 included prometheus exporter.

Usage SystemTap files are written in the SystemTap language (saved as .stp files) and run with the stap command-line. The system carries out a number of analysis passes on the script before allowing it to run. Scripts may be executed with one of three backends selected by the --runtime= option. The default is a loadable kernel module, which has the fullest capability to inspect and manipulate any part of the system, and therefore requires most privilege. Another backend is based on the dynamic program analysis library DynInst to instrument the user's own user-space programs only, and requires least privilege. The newest backend is based on eBPF byte-code, is limited to the Linux kernel interpreter's capabilities, and requires an intermediate level of privilege. In each case, the module is unloaded when the script has finished running. Scripts generally focus on events (such as starting or finishing a script), compiled-in probe points such as Linux "tracepoints", or the execution of functions or statements in the kernel or user-space. Some "guru mode" scripts may also have embedded C, which may run with the -g command-line option. However, use of guru mode is discouraged, and each SystemTap release includes more probe points designed to remove the need for guru-mode scripts. Guru mode is required in order to permit scripts to modify state in the instrumented software, such as to apply some types of emergency security fixes. As of SystemTap version 1.7, the software implements the new stapsys group and privilege level.

Simple examples The following script shows all applications setting TCP socket options on the system, what options are being set, and whether the option is set successfully or not.

Many other examples are shipped with SystemTap. There are also real-world examples of SystemTap use at the War Stories page.

Importing scripts from other tracing technologies SystemTap can attach to DTrace markers when they are compiled into an application using macros from the sys/sdt.h header file.

See also

Kernel marker dprobes LTTng strace ProbeVue

References

External links Official website SystemTap Wiki SystemTap Language Reference (PDF) SystemTap project analysis by Ohloh Dynamic Tracing with DTrace & SystemTap Systemtap tutorial Frank Ch. Eigler SystemTap Beginner's Guide Don Domingo, William Cohen Problem Solving With Systemtap, Ottawa Linux Symposium Archived 2008-09-13 at the Wayback Machine 2006 Problem Solving with SystemTap Archived 2012-02-22 at the Wayback Machine, Eugene Teo, presented at the Red Hat Summit 2007 (scripts) Dynamic Tracing and Performance Analysis Using SystemTap, Joshua Stone, presented at the LinuxWorld Conference 2008 SystemTap Tutorial, Jim Keniston, presented at the Linux Plumbers Conference 2008

Illustrations

SystemTap illustration

Worked examples

Example 1 — a first encounter with SystemTap

Start with the simplest possible case. Write down what SystemTap claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to SystemTap before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about SystemTap ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of SystemTap

In research
SystemTap appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses SystemTap in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
SystemTap is common in secondary-school and first-year university syllabi. It links to neighbouring topics Debuggers, Free software programmed in C++, Free system software, so understanding it makes those chapters shorter.
In everyday life
Look for SystemTap outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “SystemTap” →

How to study SystemTap in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what SystemTap means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain SystemTap out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is SystemTap in simple terms?

In computing, SystemTap (stap) is a scripting language and tool for dynamically instrumenting running production Linux-based operating systems. System administrators can use SystemTap to extract, filter and summarize data in order to enable diagnosis of complex performance or functional problems.

Why does SystemTap matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study SystemTap?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on SystemTap.

Tags

  • Debuggers
  • Free software programmed in C++
  • Free system software
  • Linux-only free software
  • Linux kernel features

Keep exploring