Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Why is Unix written in C instead of C++?

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains why Unix is written in C instead of C++. Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn why Unix is written in C instead of C++.

Some people will always say that C++ is not much more functional than C, but also has more functions. So why is Unix written in C instead of the more powerful C++? The obvious answer to why Unix is written in C instead of C + + is that C + + was born after C. Another reason is that the C language may actually have been invented to support the development of Unix.

The origin of C is closely related to the development of Unix OS. When the team migrated Unix to PDP- 11:00, it was still in the process of being assembled. Thompson and Ritchie want to use high-level languages in system programming so that programmers can express concepts clearly without having to bind to the architecture of a computer, but efficiently. Unix is implemented in a high-level language, thus breaking the idea that a system must be written in assembly language and that the system must be associated with a specific computer design, word length, or architecture. And for the first time, the entire programming environment, including file systems, kernels, application packages, utilities, and user interfaces, was moved to a completely different type of machine.

Thompson and Ritchie developed a programming language called "B" as early as 1969, which is essentially a simplified version of BCPL. Basically, BCPL removed unnecessary components to implement the storage capacity of minicomputers at the time (BCPL is a simplification of CPL, which itself is a simplification of Algol 60). Thompson and Ritchie are considering rewriting Unix in B language. However, B is unable to take advantage of some of the functions of PDP-11, especially byte addressing, which leads to the development of the "C" programming language. The name of C is simply chosen as the next letter after B.

The development of C began with the PDP-11 Unix system in 1972 and first appeared in Version 2 Unix. A large part of Unix is rewritten in C. Feedback from Unix developers is very helpful to C language development. The C language "merges with one of the system rewrites, so it is very suitable for writing systems". By 1973, with the addition of the "structure" type, C had become so powerful that most Unix kernels now use C. Unix became one of the first OS kernels implemented in non-assembly language.

Unix was first formally introduced to the outside world at the 1973 Symposium on operating system principles, where Ritchie and Thompson published a paper. This led to system requirements, but under the 1956 settlement agreement, AT&T (the parent company of Bell Labs) was prohibited from engaging in any business other than "public carrier communications services" in resolving antitrust cases. As a result, Unix cannot become a product. Bell Labs instead delivers the system at media and transportation costs.

Until then, however, Unix could only run on DEC systems. As more operating systems are rewritten in C (and C is extended to accommodate this situation), portability has also improved. In 1977, Bell Labs purchased Interdata 8 OS 32, which aims to port Unix to computers that are as different from PDP-11 as possible, thus making Unix more machine-independent in the process, thus realizing Thompson's dream of OS portability. All code specific to PDP-11 has been removed from the kernel and rewritten to make the transfer of Unix easier. After Interdata testing, they moved the Unix to the IBM / 370 mainframe. Through each trial, they learned more about Cjournal Unix and general portability. Gradually, Unix was ported to many other hardware systems, including Intel 8086-based computers, UNIVAC 1100 and so on.

At this point, I believe you have a deeper understanding of "Why Unix is written in C instead of C++". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report