Search for processes by start time

Conclusions

If you compare all the solutions with regard to functionality and our original objectives, all variants with the exception of Bash variant 3 provide useful results. In terms of program size, Bash variant 2 wins; the Go variant is the longest with more than 140 lines. The Python implementation falls in the lower middle range.

Opinions differ significantly on comprehensibility and readability. Especially with Listing 11 (the compact Perl variant), even die-hard Perl programmers need a moment (and the documentation for the module we used) to understand it. The implementations in Python or Go may be longer, but can be more quickly understood even by beginners.

In terms of run time, we found no significant differences in the solutions; all of them usually delivered a result within one to a maximum of one and a half seconds. This is fine for everyday use.

Both the Python script, as well as the Perl and Go implementations, make use of a matching library that offers easy access to the process information. The libraries for Python and Perl proved to be the most comprehensive. The Go library, however, still has room for extension. Functions that are already integrated in the Python library had to be built in the Go variant.

Thanks

We would like to thank Tobias Klauser for his go-sysconf package and support in optimizing the Go variant.

The Author

Frank Hofmann mostly works on the road, preferably from Berlin, Geneva, and Cape Town, as a developer, trainer, and author. He is currently the Linux system administrator for the scientific computing cluster at the Mésocentre de Calcul at the Université de Franche-Comté in Besançon.

Axel Beckert works as a Linux system administrator and specialist for network security with the ETH Zurich's central IT services. He is also a volunteer with the Debian GNU/Linux distribution, the Linux User Group Switzerland (LUGS), the Hackerfunk radio show and podcast, and in various open source projects.

Hofmann and Beckert have also authored a Debian package management book [11].

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Exploring /proc

    The Linux /proc virtual filesystem offers a window into a running system – look inside for information on processes and kernel activity.

  • Command Line: Processes

    Innumerable processes may be running on your Linux system. We’ll show you how to halt, continue, or kill tasks, and we’ll examine how to send the remnants of crashed programs to the happy hunting grounds.

  • Command Line: sort

    sort helps you organize file lists and program

    output. And if you like, you can even use this small

    but powerful tool to merge and sort multiple files.

  • Command Line: Process Control

    What is happening on your Linux machine? Various shell commands give you details about system processes and help you control them.

  • Command Line – Probing /proc

    The mysterious /proc virtual filesystem is a rich mine of information about everything in your system.

comments powered by Disqus

Direct Download

Read full article as PDF:

Price $2.95

News