Looking through the articles for translation.
Byby. I came across an offer to translate an
GNU or Linux article
? by
David Chisnall . The author proposes to understand what is more in the OS - GNU or Linux? Actually translation of this article and is offered to your attention.
GNU or Linux?
No other system has experienced such disputes around its name. A huge number of flame wars began after the FSF announced that distributions such as Ubuntu and Fedora should be called GNU / Linux, instead of Linux. Did they simply try to make money on someone else's labor, or were their arguments not unfounded?
')
To understand this question, let's take a look at what happens when you start a GNU / Linux system — how much GNU code is used, and how much Linux code is used. The developer uses a huge amount of GNU code, for example GCC and GNU Make, but how much is this true for the end user?
What is the core doing?
Before you begin to figure out where the GNU bits are, and where Linux is, it's important to understand what the kernel is doing. The kernel performs two main tasks:
* Frees developers from having to learn low-level architecture. To do this, you must have a large number of drivers for devices and common interfaces to these drivers. A good example is the Socket interface. When you write a network code, you simply open the socket and write data to it. You do not need to care about the type of network equipment of the user and the underlying protocols.
* Isolates running programs from each other. Isolating processes using a platform-independent method is simple: Allow processes to use only unprivileged processor instructions. Unfortunately, this approach will make it impossible for any input / output operations for programs, which makes all programs meaningless. To remove this limitation, there is a system call — a mechanism that allows a running process to query the kernel to perform a privileged operation on behalf of the requesting process. Common examples are writing to a file (virtual disk), allocating memory, or accessing a screen or keyboard.
The mechanism used by the system call is platform dependent. On the x86 platform, the common method was to call an exception, although new processors from AMD and Intel provide instructions that allow you to do this even faster. In doing so, control passes to the kernel, which decides how to interpret the values in the registers and on the stack, as well as what actions to take.
View from the developer.
An important standard when programming for * NIX or in * NIX is the uniform UNIX specification - the superset of POSIX, which includes everything that should be in a UNIX system. The code written according to this standard is portable among a number of UNIX-like systems.
The standard does not describe system calls. On the contrary, it describes the C-functions that serve as a wrapper for system calls. When a programmer wants to call the open () function, he doesn't need to know that he will put the pointer in EBX and the value 2 in EAX, and then call the interrupt 80h; the standard C library implements all of these functions. Any non-trivial Linux program will refer to the C library (libc, for short). There are several options for implementing the standard C library. Each member of the BSD family has its own implementation, just like any commercial UNIX system. Which version of the standard C library is used in Linux depends on the use; There are several versions for embedded systems, but most Linux desktop distros use GNU libc.
By the amount of code, the core and libc are almost equal. For two, they provide a developer interface to the system. Since the standard defines only interfaces, and not system calls, most of the code is written using the standard C library. This rule also applies to other languages; if you, for example, run some java or python code, it will get access to the kernel through the C library. For some languages, there is a standard library from the GNU Project. For example, any C ++ code will use GNU libstc ++ on GNU / Linux platforms. Some distributions also include GNU implementations for Java libraries, although this practice is no longer so popular, given that the Sun versions have become open source. Even if you use the Sun Java library, you still use the GNU libc on these platforms for any Java application.
C C ++ has even more nuances than with other languages. When you link two modules (for example, an executable file and a library), several standards at once describe the interaction model of these two modules. When calling a function from another module, you must explicitly determine the order of the arguments on the stack and in the registers, who will clear the memory afterwards and so on. In C ++, a lot of things must be explicitly defined for the use of classes in different modules. This set of standards is called the Application Binary Interface (ABI). In Linux, C ++ ABI is defined in GCC, which is a GNU package, as mentioned earlier. Compiled C ++ code, regardless of which compiler was used, must comply with the GNU standards, otherwise such code will not be able to be reused by other C ++ code.
System load
Modern GNU / Linux distributions begin the boot process with GRUB (GRand Unified Bootloader), which is also part of the GNU project. (Although technically, booting begins in the BIOS or other firmware, and this applies to all systems that run on a hardware platform.) GRUB was not created specifically for Linux. It can run other operating systems and is the standard for running some systems on the x86 architecture, including OpenSolaris and the Xen hypervisor.
GRUB then transfers control to the kernel, which continues to initialize the system and configure the drivers. The kernel in turn transfers control to the init process. This process is responsible for creating other processes.
On Linux systems, init is a very small program that does more than just run a script. In some dist distributions, init has been replaced by Upstart, a program that is neither part of Linux nor part of GNU, and has a more complex event-driven model. Scripts run by init or Upstart are simply a set of commands interpreted by the shell.
The POSIX specification contains a description of the minimum shell functionality. If you want to write portable shell scripts, you can stay within this limited functionality, and, as a result, get scripts that will run on all UNIX-like systems.
However, most init scripts are not portable. They use the extended command shell functionality found in most Linux distributions - Bash, the GNU command shell.
What is standard?
The single UNIX specification contains much more than just a set of C functions. In particular, the standard defines a set of user utilities that are required to be present on UNIX-like systems. Many programs use these utilities through shell scripts or other calls. Most of them are contained in the GNU root utility package. Again, comparing the number of lines of code, the size of the root utilities is comparable to the size of the kernel.
It can be assumed that these utilities are not such an important part of the system, but this is not the case. Without utilities, most init scripts simply won't start (even with Bash), and the system will be unusable. Most installers will also not start, which means that you can not install any programs. Even basic functionality, such as copying files, uses root utilities.
Single UNIX Specification provides a list of 175 programs that must be present in each UNIX system. Most of which (with some exceptions, such as vi) are created by GNU and are present in most Linux distributions. Some of them are never used by ordinary users; for example, the standard prescribes the availability of c99 and fort77 utilities for compiling programs written in C and Fortran (both utilities are provided by GNU).
What else should you pay attention to?
Earlier, I said that the kernel has two roles. The main role in providing user programs access to the hardware. Therefore, most Linux code (and most other kernel code) consists of device drivers. But, separately it is worth mentioning the chart.
The old XFree86 driver model was weakly dependent on the kernel. The x-server was launched as a privileged process and got direct access to the hardware. I myself saw a living example of this when I tried to use the Matrox binary Linux driver under FreeBSD. Although the driver was written for Linux, it stood up perfectly on FreeBSD, because it directly interacted with the X server and hardware, and not with the FreeBSD kernel at all.
New drivers use Direct Rendering Infrastructure (DRI). This system consists of two components, called DRI and DRM. DRI is a user environment driver that commands hardware and provides APIs to other user programs. DRM, in turn, is a small kernel module that checks commands and transfers them to the hardware.
Often when holivarah on the topic "is Linux ready for the desktop" people ask, and how well does 3D work in Linux? In fact, 3D processing is not a Linux task on most systems. Linux only provides a direct interface to the hardware, and already X.Org writes drivers. The same drivers can be run on FreeBSD, OpenBSD, and several other systems. In the world of GNU / Linux systems, Linux is not developing drivers for one of the most complex parts of the hardware component of a modern laptop / laptop.
With the invention of FUSE, which also works on FreeBSD, NetBSD, and Mac OS X, the kernel often stops providing all the drivers for file systems, which further detracts from the “Linux” role in the system.
Uninstall GNU or Linux.
Perhaps the most truthful test for the importance of a particular component of the system is how easy it is to do without this component in the system. Some Linux platforms do not use as many GNU programs; for example, using busybox for command line utilities and uclibc for the standard library. Part of the GNU platforms, such as Nexenta or Debian GNU / kFreeBSD, do not use the Linux kernel.
To appreciate the importance of Linux, let's take a look at a Linux compatible environment in FreeBSD. When running Linux programs on FreeBSD, a modified system call handler is installed that calls the functions of the FreeBSD kernel in response to Linux system calls. This hike allows you to run programs written under Linux, without changing them.
In order for this method to work, often install a stripped-down version of Linux in a separate environment. Programs written for Linux will eventually be able to find all the necessary libraries and utilities, including GNU utilities, GNU grep, Bash, and other packages.
What does this mean? This suggests that if you want to run a GNU / Linux program on another system, then this is easily doable without Linux, but it’s not easy to do without GNU.
Of course, most programs will run successfully without any compatibility mode, if you recompile them. In this case, they will not use GNU libc, GNU utilities, or bash. Some programs for successful compilation require the GNU compiler or GNU Make, however, after compiling these programs will no longer require any GNU utilities, except:
- programs that use C ++, which are likely to use GNU libstdc ++.
- programs that explicitly use one of the many GNU libraries.
So removing GNU from GNU / Linux seems much more difficult than removing Linux. PC-BSD or Nexenta are good desktop operating systems without a drop of Linux code inside, but with a lot of GNU code. Those Linux systems that are not so dependent on GNU code are completely integrated systems whose names are not familiar to users of desktop and server versions of Linux.
So how do you say, Linux, GNU or GNU / Linux? I call GNU because, as a programmer and user, I use, for the most part, the tools that are developed by GNU. When I port code from FreeBSD, problems arise only in root utilities or in the standard C library. If I wanted to run the same code on a HURD or any other GNU system, then I would use the same interfaces.
In general, I prefer to allocate distributions, such as Fedora or Ubuntu, and not to mention GNU or Linux. The system includes a huge amount of code from various sources. Among the biggest code providers are the GNU Project and X.org, but Ubuntu GNOME / X.Org / GNU / Linux sounds a bit long. And including in the names of the system such a small and easily removable part as Linux does unfairly in relation to many developers whose code is also present in the system.
-
translated.by/you/gnu-or-linux/into-ru/transOriginal (English): GNU or Linux? (http://www.informit.com/articles/article.aspx? p = 1339466)