Thursday, September 16, 2010

C Programming Language

HISTORICAL VIGNETTE

C (along with its extension C++) has become one of the most popular programming languages around town. It is famous for its amazing duality. It is both a high level programming language and a low level one. It is also both special and general porpose. Unlike some before him, such as the creators of ALGOL, Dennis Ritchie did not set out to develop a popular programming language. How wanted to design a better operating system.
Back in the sixties, Ritchie was a Harvard physics major. After completing his undergraduate work, he specialized in the study of mathematics, like most computer science pioneers. In 1986, he went to work for Bell Labs (now Lucent Technology) and was teamed up with ken Thompson. Thompson, who had grown up with ham radios and chess, received his undergraduate and graduate degrees in electrical engineering from the University of California at Barkeley. The two were given a compelling task: to think about interesting problems in computer science. The duo began to think about OS (Operating Systems).

At the time, scientists at Bell were experimenting with an operating system called MULTiplexed Information and Computing Service (MULTICS). This multiuser, time-share system became the instant friend of programmers who were used to doing things the hard way. Instead of giving a stack of punch cards to an operator and waiting an hour or more for a prontout of results, MULTICS allowed users to type commands at a keyboard and get an instant response. There was, however, one big problem: MULTICS was very expensive to run. Everyone was using it, and that cost money. Bell Labs, to the dismay of many, decided to abandon MULTICS. But Ritchie and Thompson couldn't get used to doing things the old way again. They decided to design system just for themselves and their fellow programmers at the lab. This operating system would soon be known to the world as UNIX, a takeoff on the MULTICS name.

Thompson, excited about the new project, turned in a proposal to his superiors. After the MULTICS financial disaster, they were wary of OS projects, and he was turned down. Refusing to be discouraged, he found a discarded, obsolote DEC PDP-7 and began work with Dennis Rithcie. The work was not easy, but the two soon had a complete IS in their hands. The knew it was unlikely that their work would be usable by others "as long as it ran only on an antiquated computer of which only a few existed" [Slater, 1987]. To get his hands on an up-to-date computer, Thompson sent in a proposal to develop an editing system for office tasks. It was approved, and Ritchie and Thompson had a PDP-11 to work with. In 1971, UNIX was completed, and its use inside Bell Labs began to grow, starting with the patent departement. Problems developed, however. UNIX had been written in assembly language, which meant that it was not portable to machines other than the PDP-11. In the sixties there were two types of languages. Low level assembly languages allowed a programmer to control a particular computer, since he or she could manipulate individual bits of the store. High level languages wew easier to use and wew implemented on a variety of hardware. A programmer need not worry about messy low level details and could concentrate on good algorithm design. A joint committe from the University of London Computer Unit and the University Mathematical Laboratory at Cambridge decided to design a language that was both high and low level. It would be high enough so it wouldn't be tied to a particular computer, but low enough to allow the manipulation of specific bits. The resulting language was called Combined Programming Language (CPL). It was never popular, since it was a very large and difficult language, but a pared-down version, Basic CPL (BCPL) attracted some users.

Back at Bell Labs, Thompson created an even smaller version of BCPL, called B (perhaps symbolizing that he only needed part of BCPL). Ritchie later transformed B into C by restoring some of  the CPL features, such as rich data typing UNIX was then re-written in C. The resulting portability made UNIX a computer industry standard in the mid-eighties. Rithcie refuses to solve the mystery of C's name. He leaves it for us to decide "whether he was following Thompson in pulling out the next lettwe in the name BCPL or taking C as the next letter in the alphabet following B" [Baron, 1986].

C, like its ancestor CPL, is both low and high level. It is a special-purpose language designed for systems programming,i.e., UNIX, and general-purpose as wll. Rithcie states that "C is a general-purpose programming Language... Although it has been called a 'systems programming language' because it is useful for writing operating systems, it has been used equally well to write major numerical, text processing, and database programs" [Kernighan, 1978].
C is known as a programmer's language, written by a programmer for programmers. This is appent when you look at some of C's characteristics, which are short instead of pretty. For example, instead of  begin....end, brackets {....} are used. This makes for faster programming, but it also makes less readable code. Another example of C's orientation toward experienced programmers is its permissive data typing. If you make mistakes, you won't get neat error messages. You will probably have to hunt down your own errors-no small challange. Later versions, however, do include a "lint" program that dose error checking.

Ritchie and Thompson have collaborated in several editions of the ever-evolving UNIX. Considering their past successes, the two were given almost unlimited freedom at Bell Labs. One can't help but wonder what they will come up with next.

No comments:

Post a Comment