Home  >  Article  >  Operation and Maintenance  >  What parts can linux be divided into?

What parts can linux be divided into?

青灯夜游
青灯夜游Original
2022-05-12 19:29:2111308browse

Linux can be divided into 4 parts: 1. Kernel, which controls all hardware and software on the computer system and is mainly responsible for system memory management, software program management, hardware device management, and file system management; 2. GNU Tools, necessary tools other than kernel-controlled hardware devices, such as shell; 3. Desktop environment, such as KDE; 4. Application software.

What parts can linux be divided into?

#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.

Linux is a free and open source UNIX-like operating system. It is mainly inspired by the ideas of Minix and Unix. It is a POSIX-based multi-user, multi-task, multi-thread and multi-CPU operating system. Linux can be divided into the following four parts:

  • Linux kernel
  • GNU tools
  • Graphical desktop environment
  • Application software

The figure below is a basic structural block diagram, showing how each part works together to form a complete Linux system.
What parts can linux be divided into?

1.Linux kernel

The core of the Linux system is the kernel. The kernel controls all hardware and software on a computer system. The kernel is mainly responsible for the following four functions:

  • System memory management
  • Software program management
  • Hardware device management
  • File system management

1.1 System Memory Management

One of the main functions of the operating system kernel is memory management. The kernel not only manages the physical memory available on the server, it can also create and manage virtual memory (that is, memory that does not actually exist). The kernel implements virtual memory through the storage space on the hard disk. This area is called swap space. The kernel is constantly swapping the contents of virtual memory between swap space and actual physical memory. This makes the system think it has more memory available than physical memory.
What parts can linux be divided into?

The memory storage unit is divided into many blocks according to groups, and these blocks are called pages. The kernel places each memory page in physical memory or swap space. The kernel then maintains a memory page table, indicating which pages are located in physical memory and which pages have been swapped to disk.

The kernel will record which memory pages are in use, and automatically copy memory pages that have not been accessed for a period of time to the swap space area (called swapping out) - even if there is still available memory. When a program wants to access a memory page that has been swapped out, the kernel must swap out another memory page from physical memory to make room for it, and then swap in the requested memory page from the swap space. Obviously, this process takes time and slows down the running process. As long as the Linux system is running, the process of swapping out memory pages for running programs will never stop.

1.2 Software program management
The Linux operating system calls running programs a process. The kernel creates the first process (called the init process) to start all other processes on the system. When the kernel starts, it loads the init process into virtual memory. When the kernel starts any other process, it allocates a private area in virtual memory to the new process to store the data and code used by the process.
The init system of the Linux operating system adopts a run level. The run level determines that the init process runs certain types of processes defined in the /etc/inittab file or the
/etc/rcX.d directory. The Linux operating system has 5 startup run levels.

When the run level is 1, only basic system processes and a console terminal process are started. We call this single-user mode. Single-user mode is usually used for emergency file system maintenance when there is a system problem. Obviously, in this mode, only one person (usually the system administrator) can log in to the system to manipulate data.

The standard startup run level is 3. At this run level, most application software, such as network support programs, will start. Another common runlevel in Linux is 5. At this run level, the system will start the graphical X Window system, allowing users to log in to the system through the graphical desktop window.

Linux system can control the functions of the entire system by adjusting the startup run level. By adjusting the run level from 3 to 5, the system can be changed from a console-based system to a more advanced graphical X Window system.

1.3 Hardware device management
Another responsibility of the kernel is to manage hardware devices. Any device that a Linux system needs to communicate with needs to have its driver code in the kernel code. The driver code acts as a middleman between the application and the hardware device, allowing data to be exchanged between the kernel and the device. There are two methods for inserting device driver code in the Linux kernel:

  • Device driver code compiled into the kernel
  • Device driver module that can be inserted into the kernel

Linux system treats hardware devices as special files, called device files. There are 3 categories of device files:

  • Character device file: refers to a device that can only process one character at a time when processing data. Most types of modems and terminals are created as character device files
  • Block device file: refers to a device that can handle large chunks of data at a time, such as a hard disk.
  • Network device files: refers to devices that use data packets to send and receive data, including various network cards and a special loopback device.

1.4 File system management
The Linux kernel supports reading and writing data from the hard disk through different types of file systems. Table 1-1 lists the standard file systems used by Linux systems to read and write data.
What parts can linux be divided into?

2.GUN tools

In addition to controlling hardware devices by the kernel, the operating system also requires tools to perform some standard functions, such as control files And procedures. This core set of tools for Linux systems is called coreutils (core utilities) package. The GNU coreutils software package consists of three parts:

  • Tools for processing files
  • Tools for manipulating text
  • Tools for managing processes

2.1 shell

GNU/Linux shell is a special interactive tool. It provides users with a way to launch programs, manage files in the file system, and processes running on Linux systems. The core of the shell is the command line prompt. The command line prompt is the interactive part of the shell. It allows you to enter text commands and then interpret the commands and execute them in the kernel. You can also put multiple shell commands into a file and execute them as a program. These files are called shell scripts.

On a Linux system, there are usually several Linux shells available. Different shells have different features, some are better for creating scripts, and some are better for managing processes. The default shell for all Linux distributions is the bash shell. The bash shell was developed by the GNU project and is regarded as a standard Unix shell.

2.1.1 Types of shell

What kind of shell program is started by the system depends on your personal user ID configuration. In the /etc/passwd file, the default shell program is listed in the 7th field of the user ID record. As soon as the user logs into a virtual console terminal or starts a terminal emulator in the GUI, the default shell program starts running. For example: user root uses /bin/bash (bash shell) as its default shell program.

[root@node1 bin]# cat /etc/passwdroot:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin

But there is another default shell is /bin/sh, which is used as the default system shell for those A system shell script that needs to be used at startup. You often see some distributions using soft links to set the default system shell to the bash shell, such as CentOS distributions:
$ ls -l /bin/sh

lrwxrwxrwx. 1 root root 4 Mar 18 15:05 /bin/sh -> bash

/bin/sh equivalent For /bin/bash --posix, using sh to call the execution script is equivalent to turning on the POSIX standard mode of bash. The various differences between them are from the differences between the POSIX standard mode and bash.

2.1.2 Shell’s parent-child relationship

is the default interactive shell started when logging into a virtual controller terminal or running a terminal emulator in the GUI. is a parent shell.
When you enter the /bin/bash command or other equivalent bash command after the CLI prompt, a new shell program is created. This shell program is called a child shell. The subshell also has a CLI prompt and will also wait for command input.
For example: use ps -f

[root@node1 bin]# ps -fUID        PID  PPID  C STIME TTY          TIME CMD
root       727   711  0 11:01 pts/0    00:00:00 -bash
root      4385   727  0 12:06 pts/0    00:00:00 ps -f

When using ps -f, two processes are displayed. The process ID of one of the processes is 727, and it is running the bash shell program. The process ID of another process is 4385, which corresponds to the command ps -f.

[root@node1  bin]# bash[root@node1  bin]#  ps -fUID        PID  PPID  C STIME TTY          TIME CMD
root       727   711  0 11:01 pts/0    00:00:00 -bash
root      4492   727  0 12:08 pts/0    00:00:00 bashroot      4512  4492  0 12:08 pts/0    00:00:00 ps -f

After entering the command bash, a subshell appears. The second ps -f is executed in a subshell. You can see from the displayed results that there are two bash shell programs running. The original process ID of the first bash shell program, which is the parent shell process, is 727. The second bash shell program, the subshell process, has a PID of 4492. Note that the parent process ID (PPID) of the subshell is 727, indicating that this parent shell process is the parent process of the subshell. When a subshell process is generated, only part of the environment of the parent process is copied to the subshell environment.

3.Linux Desktop Environment

1.KDE (K Desktop Environment, K Desktop Environment) was originally released as an open source project in 1996. It generates a graphical desktop environment similar to Microsoft Windows.
What parts can linux be divided into?
KDE Desktop allows you to place application icons and file icons at specific locations on the desktop. Click the application icon and the Linux system will run the application. Click a file icon and the KDE desktop determines which application to use to handle the file.

2.GNOME (the GNU Network Object Model Environment, the GNU Network Object Model Environment) is another popular Linux desktop environment. GNOME was first released in 1999 and has become the default desktop environment for many Linux distributions.

What parts can linux be divided into?

3.Unity Desktop

If you are using the Ubuntu Linux distribution, you will notice that it is somewhat different from the KDE and GNOME desktop environments no the same. To be precise, this is because the company responsible for developing Ubuntu decided to adopt its own Linux desktop environment called Unity.

Unity Desktop gets its name from the project's goal - to provide a consistent desktop experience for workstations, tablets, and mobile devices. Whether you're using Ubuntu on a workstation or a mobile phone, the Unity desktop works the same way.

What parts can linux be divided into?

Related recommendations: "Linux Video Tutorial"

The above is the detailed content of What parts can linux be divided into?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn