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.
#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.
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.
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.
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.
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.
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.
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!

linux设备节点是应用程序和设备驱动程序沟通的一个桥梁;设备节点被创建在“/dev”,是连接内核与用户层的枢纽,相当于硬盘的inode一样的东西,记录了硬件设备的位置和信息。设备节点使用户可以与内核进行硬件的沟通,读写设备以及其他的操作。

区别:1、open是UNIX系统调用函数,而fopen是ANSIC标准中的C语言库函数;2、open的移植性没fopen好;3、fopen只能操纵普通正规文件,而open可以操作普通文件、网络套接字等;4、open无缓冲,fopen有缓冲。

端口映射又称端口转发,是指将外部主机的IP地址的端口映射到Intranet中的一台计算机,当用户访问外网IP的这个端口时,服务器自动将请求映射到对应局域网内部的机器上;可以通过使用动态或固定的公共网络IP路由ADSL宽带路由器来实现。

在linux中,交叉编译是指在一个平台上生成另一个平台上的可执行代码,即编译源代码的平台和执行源代码编译后程序的平台是两个不同的平台。使用交叉编译的原因:1、目标系统没有能力在其上进行本地编译;2、有能力进行源代码编译的平台与目标平台不同。

在linux中,eof是自定义终止符,是“END Of File”的缩写;因为是自定义的终止符,所以eof就不是固定的,可以随意的设置别名,linux中按“ctrl+d”就代表eof,eof一般会配合cat命令用于多行文本输出,指文件末尾。

linux查询mac地址的方法:1、打开系统,在桌面中点击鼠标右键,选择“打开终端”;2、在终端中,执行“ifconfig”命令,查看输出结果,在输出信息第四行中紧跟“ether”单词后的字符串就是mac地址。

在linux中,可以利用“rpm -qa pcre”命令判断pcre是否安装;rpm命令专门用于管理各项套件,使用该命令后,若结果中出现pcre的版本信息,则表示pcre已经安装,若没有出现版本信息,则表示没有安装pcre。

在linux中,rpc是远程过程调用的意思,是Reomote Procedure Call的缩写,特指一种隐藏了过程调用时实际通信细节的IPC方法;linux中通过RPC可以充分利用非共享内存的多处理器环境,提高系统资源的利用率。


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

SublimeText3 Linux new version
SublimeText3 Linux latest version

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

WebStorm Mac version
Useful JavaScript development tools

SublimeText3 English version
Recommended: Win version, supports code prompts!
