B Programming Language
By: Website Developer
Tags: Old Programmers, B Programming, Origins Of B Code, Programming Languages, B Language

B is the work of two colleagues, Ken Thompson and Dennis Ritchie

Dennis Ritchie was an American computer scientist born in Bronxville, New York, in 1941. And passed away on October 12, 2011. He helped develop B which would go on to be upgraded into C and the Unix Operating System. He graduated from Harvard University in 1968 with a bachelor’s in physics and a doctorate in applied mathematics.

Ken Thompson was another pioneer of computer science who was born in New Orleans, Louisiana, in 1943. He contributed to the development of the C programming language and co-created the Unix operating system. Ken went to the University Of California where he graduated with a Bachelors’s and Masters’s in science between 1965 and 1966. Ken retired on December 1st, 2000

Together they have won several awards such as the Turing award, the computer science equivalent of a Nobel prize. He also won the U.S National Medal Of Technology in 1999, and the Japan Prize in 2011.

Origins

Bell Laboratories is a technologies research and development company based in New Jersey, Murray Hill. The company is known for the development of radio astronomy, laser technology, and the Unix OS. It is also the birthplace of the programming languages B, C, C++, and S. The company persists today, winning a total of 9 Nobel prizes, but it’s been renamed to Nokia Bell Labs.

Ken joined Bell labs in 1967 where he started working on Multics, a high-speed time-sharing operating system. In 1969, the parent company of Bell Labs dropped out of the project.

Dennis was a colleague who also worked on the Multics project and partnered with Ken.

They wanted to develop a more flexible operating system for Bell Lab’s PDP-7 minicomputers. In 1970 they created the Unix operating system.

Unix in reality is just a scaled-down version of what was the Multics project. Not just smaller to fit in minicomputers, but also to combat the complexity of Multics that frustrated the team. Multics was built as a time-sharing operating system. This meant multiple users were able to work on the exact same computer and had to share the same resources. Like if 3 users were sharing the same computer at the same time. Unix was simplified by keeping it down to a single-tasking system. Meaning it could only run one program at a time. The reasoning behind its final name “Unix”, is mostly unknown. It started unnamed, then went by “Unics” for Uniplexed Information and Computing services. Dennis and Ken created a new language to program the new operating system. This was the birth of the B programming language. And it would accompany Unix in the early days of its original version.

Purpose

Ken Thompson designed B based on the previous language he worked with when he worked on Multics called BCLP. But components Ken found unnecessary were removed.

BCPL (Basic command Prompt Language) was a language primarily used to write small simple compilers for other programming languages.

Its compiler’s structure, in the front end, turned the written source code into O-code, another programming language, then it’s back end turned the newly created O-code into machine code for whatever system it was targeted for. As a result, this made the language easily portable to other machines due to you only really having to rewrite the machine code translation process to support new systems.

Ken also made other changes to BCPL’s syntax for his convenience. The assigner that changes one variable to equal another was changed from `:= ` to just `=`. This resulted in the equality operator being changed from `=` to `==`. Following these, Ken invented operators for increments and decrements, these were `++` for increments and ` — ` for decrementing. In 1971 Dennis Ritchie expanded B by changing its compiler to directly turn into machine code without using O-code. Including adding more data type variables.

With the inclusion of support for more data types, it grew out of its old name and became “NB”. It meant “New B”. The language continued to expand until it reached the end of its life cycle being known as a B language. In 1972 came the birth of the original C programming language. C was general-purpose, meaning it wasn’t for any specific kind of application or software, it can be used for almost anything. It was implemented in version 2 of the Unix operating system. And because of its B heritage, it maintained its portability strengths.

Platforms

PDP-7 minicomputer

Released by DEC(Digital Equipment Corporation) in 1965. The PDP-7 cost 72 thousand dollars. In its time it was considered cheap but powerful. It was the first of the PDP computers to have something called wire-wrapped. Having wire-wrapping was easier to manage so more reliable than traditional printed circuits. They’re more sturdy and can better handle damage from vibrations, physical stresses, and could take in more electricity. It was an 18-bit machine and It had 9 kilobytes of storage capacity but could expand to 144KB. And took 1.17 milliseconds to get random access memory. It was one of the first DEC computers to use Unix as its operating system.

PDP-11 minicomputer

Also created by the Digital Equipment Corporation, the PDP-11 were 16-bit minicomputers released in 1970. It was considered the most sold minicomputer at the time, selling over 6 hundred thousand units. With its improved instruction set and additional general-purpose registers, it was the easiest PDP computer to program yet. It also made external devices easier to implement using their direct memory access. The earliest model was priced at around 20 thousand dollars. It had a processing speed of 800 nanoseconds and had 1.7 microseconds on RAM speed. Making B work in PDP-11 was a challenge because B could not access many of the computer’s data types. These challenges are what prompted Dennis and Ken to start making changes to B.

GE-645 mainframe

The GE-645 was the 5th model of the GE-600 series. Originally built by General Electric in the 1960s, hence the “GE” in the name, the series was sold to Honeywell. It was a 32-bit mainframe computer which Honeywell used mostly as the base machine for the Multics operating system. The GE-645 model is the result of Multics requiring more out of its CPU. The GE-645 ran on the GCOS operating system. Later seeing the implementation of Unix. Traces of GCOS still remain Unix’s modern iterations.

Benefits & downsides

Strengths

The B programming language was designed for writing non-numeric applications. A non-numeric design means traditional numbers from 0–9 aren’t accounted for. The program only counts words such as a, b, c, and d. This could help make program code more readable by being able to use regular words.

It also helped B write machine-independent programs. Something being machine-independent in software development meant that they were not confined to a single computer system. B compiled its code into O-code, which could then easily be turned into machine code. This method was developed to help make B a very portable language. So whenever a new computer comes into Bell Lab’s possession, support for B can take less time to implement.

Weaknesses

Because B is so non-numeric oriented, the only data type it had to speak of was a word. Data types are properties in data. they tell computers how to interpret data so the programmer can use that data for a different purpose. Words are a neutral data type. If you store data called “Apple”, it is always a fixed size, nothing special. The word length can also determine the number of bits it takes to store. In B, a word was used to store either an integer or a reference to any desired memory location.

Most languages can store and process multiple types of data, not just integers. This includes floating numbers which are estimator values, strings, characters, and bools. B’s words cannot store “Apples”, “Bananas”, and “Oranges” under an array or list for fruit. In B they are all unrelated indefinitely. And with advancing technology that more commonly utilize these data types, B would prove obsolete.

As computers grew stronger, more support was needed for character data types like strings, which became more important. B simply had no implementation or support for any other data types. So it could not afford to support these newer systems. This is what led Ken and Dennis This led Ken and Dennis to start expanding the language’s capabilities. But it expanded to the point it no longer was the original B language.

To summarize, B’s lack of data types made it obsolete compared to other languages. This made it an almost impossible language to use for most modern-day applications. Which led it to be turned into what would become the C programming language.

Code examples

If-statements

When it comes to if statements, a unique property of writing in B is having arguments inside parentheses following if.

In B, if statements would look like:

If ( a < b ) {

/* statements here */

}

Loops

In loop statements such as while and for loop the same parentheses are present as well. Using the check, a is less than b, this is how a while loop looks like in B.

while( a < b){

/* execute code here */

}

Other

Comments in B are incapable between ‘/*’ and ‘*/’ respectively. The former is written before the text and the latter ends the line.

Another property B has is its use of curly braces. Following if statements, loops, and functions can be a pair of curly braces `{}` which hold groups of code together.

Trends

Today B lives on through C, its successor. And by extension C# and C++.

Despite being 48 years old, C is as common as ever. Originally intended for use in Unix, it’s a very portable language and was used to birth other OS. It was used to write most of Windows, Linux, Mac, Android, and IOS!

Even though Unix’s primary programming language designed for it created its competitors, Unix has also stuck around. Today it’s being used to run web-servers, mainframes, and super-computers. Modifications have also been made to Unix so it can run mobile devices like tablets and smartphones. Also personal computers. Originally Unix wasn’t made to be portable outside Bell labs computers. But Its integration with C has allowed it to be almost as portable.

However, B has seen some recent use in GCOS mainframes in 2014. B doesn’t need much to run on and has extensive libraries. It does its job well enough which is why it’s stuck around seeing use in embedded systems since the 2000s.