Explore Linux Space Time

If you’ve ever wondered how much memory a process uses, you’ve probably used a form of task manager or system monitor. System monitors can be useful to identify resource hogs, but are often less versatile if you want more details about just one process. If you’ve ever faced this problem, then [Fabien Sanglard]’s Space-Time explorer is for you!

The wonderfully punny Space-Time tool records physical memory usage, time spent in user space vs. kernel space and even threads and subprocesses created. These words may not mean much to some readers, so let’s quickly go over them: Physical memory usage is the actual amount of RAM given (not always the same as requested). The kernel (which lives in kernel space) is the supervisor to all processes on a computer. In contrast, every process lives in it’s own “user space”, a way of protecting the kernel. Finally, a subprocess (or “child process”) is simply a process started by another process (the “parent”).

In their blog post, [Fabien] starts with a simple test program: allocating 1 GiB and setting each byte individually. What would seem like a simple task that shouldn’t take much more than 10ms actually takes over a second and [Fabien] explains that the kernel doesn’t actually immediately give 1 GiB, but actually waits until the memory gets used. [Fabien] also compares the Space-Time footprints of hello world programs in C and C++ (both clang and GCC), Rust, Java and Go, which yields surprising results. [Fabien] also tries some more “real-world” tasks like a browser (chromium), curl, wget and even a compiling a “medium-size” project (Git) from source. Finally, [Fabien] finishes off by briefly explaining how Space-Time explorer works and why what pushed them to create the tool in the first place.

If you’re looking to improve you Linux arsenal, how about building a better ls?

7 thoughts on “Explore Linux Space Time

    1. You said that!
      And I add: few books inspired me to fire up again my C-skills as the “Doom Engine Black Book” did. If you want a really intriguing book, between the historical and the technical, this is a must!

  1. For clarification, the blog post doesn’t compare hello world programs, it compares *compiling* hello world programs. It’s comparing the performance of the build tools, not the performance of the hello-world executable build products.

  2. There are often two versions of “time” installed on Linux machines. Bash has its own version which gives real, user, and system time spent on the process (posix compliant output). There’s also a stand-alone version (/usr/bin/time on Ubuntu) which will show much more (files used, memory usage, stack usage, context switches, page fault, etc.)

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.