jump to navigation

In Memory of Dennis Ritchie October 14, 2011

Posted by Peter Varhol in Software development, Software platforms, Software tools.
trackback

I woke up this morning to the news of the passing of Dennis Ritchie, computer science researcher at AT&T Bell Labs and inventor of the C programming language (he actually passed away last weekend).  The C Programming Language, a language manual by Brian Kernighan and Dennis Ritchie, was the bible for several generations of professional programmers.

The early 1970s saw the rise of multiprocessing, where multiple users shared the same computer in a timesharing arrangement.  The research state of the art at that time was MULTICS, an MIT research project.  Bell Labs took those concepts and Ken Thompson developed the Unix operating system (with Ritchie’s assistance).  Ritchie then designed the C language as a high-level language married closely to Unix and its underlying API and commands.

However, C was also created as a platform-independent language, a nod to the fact that Unix would eventually be ported to dozens (probably more like hundreds) of different processors and hardware architectures.  For example, it lacks a string library, because strings are implemented differently on different OSs.  So C programmers got used to doing an array of char to represent a string (third parties eventually came out with custom string libraries for different computers).

C has elements of both a high-level language and a systems programming language.  It had high-level constructs, but could also directly access memory locations through pointers.  It does no automatic allocation or deallocation of memory; malloc and free are among the first constructs learned by aspiring C programmers.  Further, C does essentially no type-checking; programmers could essentially copy data from one type to another, irrespective of the type size, at their own risk.

Functions are generally called by reference, by establishing the memory location of the function (called a pointer), and are called by referring the calling function to that location (called dereferencing the pointer).  This can make possible some extremely convoluted programming constructs.

These characteristics and others made C extremely flexible, but also extremely prone to programming errors.  When I was the BoundsChecker product manager at Compuware NuMega Labs, we determined that a large majority of C (and its object-oriented extension C++) programming errors were memory errors.  It is simply too complex for most C/C++ developers to fully understand and control how they are using memory.

C programs eventually became so unmanageable that many development teams now use managed languages such as Java or C#.  Both languages (as well as niche languages like Lisp and Smalltalk) automatically allocate memory when you define and use a variable, and reclaim that memory when there are no longer any links to it through a technique called garbage collection.  But many commercial applications still use C/C++, either for legacy or performance reasons.

I was a C programmer for a brief period of my career, and occasionally taught C++ as an academic.  During my time as an academic, I wrote a discrete event simulation application in Pascal (invented by Swiss computer scientist Nicolas Wirth), a similar language that provided much stricter type checking.  Despite the popularity (and to large extent necessity) of managed languages today, I still firmly believe that you can’t truly understand how to program a computer unless you have a clear picture of how your code is using memory.  And we owe that view of memory to Dennis Ritchie and C.

Advertisements

Comments»

1. immolator - October 15, 2011

About memory in memory of Dennis Ritchie. Great post.

Perhaps you’ve already seen this, but let me cite it here:

#include

int main()
{
printf(“goodbye, dad\n”);
return 0;
}

http://www.muppetlabs.com/~breadbox/rip-dmr.html


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: