AlgoViz

Tracing waits across the user–kernel boundary

medium 6 min

A syscall trace records a thread entering and returning from kernel operations.

Video lesson · Chapter 1 of 4

A worker appears frozen between jobs

0:00 / 2:03

Theory

Read or listen first. About 1 min.

What it is

A syscall trace records a thread entering and returning from kernel operations. Elapsed time in a blocking call includes the wait for an event. Library-call tracing observes a different boundary and can miss inlined or directly invoked operations. A trace of one thread can also miss the worker that actually owns the request.

Why it exists

A worker stops completing jobs while process CPU remains low. Choose an affected thread and the shortest capture interval that can show a stall. Compare timestamps with application events and capture aggregate counts where arguments are unnecessary. Interpret a long poll on an idle worker differently from the same wait with work already queued.

An empty queue during the long wait is consistent with a healthy idle worker. Follow the producer instead.

A worker appears frozen between jobs

Worker → Wait queue (sleep until notified). Job producer → Wait queue (enqueue and signal). Wait queue → Worker (wake worker)
Worker → Wait queue (sleep until notified). Job producer → Wait queue (enqueue and signal). Wait queue → Worker (wake worker)

Inside this chapter

System Call Tracing with strace
Strace observes syscalls and signals. Compare entry, result, duration and count for a bounded affected interval. Its observation overhead can be significant for syscall-heavy workloads.
Library Call Tracing with ltrace
Ltrace follows supported dynamic library calls. Inlining, static linkage or direct syscalls can leave gaps. An absent observation can reflect instrumentation coverage.
Kernel Messages with dmesg
Kernel messages can reveal device resets, memory pressure and driver errors. Align messages to the correct boot and time window before connecting them to an application alert.
Systemd Logs with journalctl
Journalctl can filter by unit, boot and interval. Use structured identity fields to avoid joining logs from old and new instances solely by a shared service name.

How it works

Step through the idea, or press Play.

Step 1 of 4

Select an affected thread. Identify the worker handling known queued work.

Understand it

Worked incident

A worker appears frozen between jobs

ObservationObserved wait duration (ms)Interpretation
Baseline4A notification wakes the worker soon after enqueue.
Incident800Work is queued while the worker waits until an 800 ms timeout.
After intervention8Restore the enqueue notification and measure enqueue-to-wakeup delay in the same flow.
Illustrative measurements from the same workload at three checkpoints.

Choose the next investigation

An empty queue during the long wait is consistent with a healthy idle worker. Follow the producer instead.

Summary

The whole topic in one minute.

Waiting is expected for an idle event loop. The missing wakeup matters when eligible work is already present.

An empty queue during the long wait is consistent with a healthy idle worker. Follow the producer instead.

Sources