run more slowly than languages that are harder for the programmer but
faster at runtime, such as C or Fortran.
For some programs, such as short shell scripts or quick one-liners in Perl to
search text in a file, the difference in runtime speed is negligible. On a
desktop computer, it might not matter that your music player is written in
Python, and if it seems slow, buying a newer, faster desktop system might
be an acceptable solution.
There are some applications, however, where the time needed to run your
program can make a big difference. For example, using a slow-to-run
language to perform calculations on scientific data, especially if you are
doing it on high-performance computing (HPC) resources like a
supercomputing cluster, is foolish; to take advantage of the platform, it is
both time- and cost-effective to use the fastest language available to you,
like C.
This idea was reinforced in a 2011 conversation between Matthew Helmke
and Dan Stanzione, then deputy director of the Texas Advanced Computing
Center at the University of Texas at Austin. Stanzione said that HPC
resources are expensive, so it is often wiser to spend grant money to hire a
good C programmer for a year than it is to run a bioinformatics program
written in Perl or Python on an HPC system. As he put it, “If your
computer costs $2,000, the programmer’s time is the dominant cost, and
that is what drives software development. If your computer costs $100
million or more, then having a programmer spend an extra month, or year,
or decade working on software optimization is well worth it. Toughen up
and write in C.”
Programming in C with Linux
C is the programming language most frequently associated with UNIX-like
operating systems such as Linux and BSD. Since the 1970s, the bulk of the
UNIX operating system and its applications have been written in C. Because
the C language doesn’t directly rely on any specific hardware architecture,
UNIX was one of the first portable operating systems. In other words, the
majority of the code that makes up UNIX doesn’t know and doesn’t care
which computer it is actually running on. Machine-specific features are
isolated in a few modules within the UNIX kernel, which makes it easy for
you to modify them when you are porting to different hardware architectures.
Because C is so important to UNIX and Linux, we use it in the examples in
this section. Much of what is discussed here also applies to other languages,