Which OS Was C Designed to Rewrite?

The C programming language was originally created to rewrite the Unix operating system. Developed in the early 1970s at Bell Labs by Dennis Ritchie, C provided the low-level memory control of assembly language alongside the structure and portability of a high-level language. Rewriting Unix in C transformed operating system design, allowing Unix to move beyond machine-dependent assembly code and become portable across diverse computer architectures.

The Origins of Unix and Assembly Language

In 1969, Ken Thompson, Dennis Ritchie, and other researchers at AT&T's Bell Labs began developing the Unix operating system on a Digital Equipment Corporation (DEC) PDP-7 minicomputer. Like nearly all systems of that era, the earliest implementations of Unix were written entirely in assembly language.

Writing an operating system in assembly offered complete control over hardware registers and execution speed. However, it presented a severe drawback: assembly code is tied directly to the instruction set architecture of a single processor. When Bell Labs acquired a newer DEC PDP-11, developers had to rewrite large portions of the operating system from scratch to make it run on the new hardware.

From B to C

To solve the portability problem, Ken Thompson initially created the B programming language, based on BCPL (Basic Combined Programming Language). B was a typeless language that treated all data as machine words.

While B worked for basic utility programs, it lacked the data types and hardware-level precision necessary to handle the memory structures and hardware features of the PDP-11 kernel. Dennis Ritchie extended and overhauled B by introducing a formal type system, structures, and direct pointer mechanics. This evolved language became known as C between 1971 and 1973.

The Historic 1973 Rewrite of Unix

In 1973, Dennis Ritchie and Ken Thompson took the unprecedented step of rewriting the entire Unix kernel in C. At the time, conventional wisdom held that high-level languages were too slow and consumed too much memory for core operating system tasks.

The rewrite proved that the slight performance overhead of a compiled language was vastly outweighed by the advantages:

  • Portability: Moving Unix to a new hardware platform required only writing a C compiler for that target architecture, rather than rewriting the entire operating system line by line.
  • Maintainability: Code written in C was significantly easier to read, debug, and expand than sprawling assembly files.
  • Ecosystem Growth: Developers could write system utilities and applications using the same language as the operating system kernel, creating a cohesive software environment.

The Long-Term Impact

Rewriting Unix in C established a design paradigm that defined modern computing. Unix became the first widely adopted, portable operating system, eventually giving rise to the BSD family, macOS, and Linux. Concurrently, C became the foundational systems programming language for decades, serving as the basis for Windows NT, modern operating system kernels, embedded devices, and language runtimes worldwide.