In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
Today, the editor will share with you the relevant knowledge about what the basic structure of linux is. The content is detailed and the logic is clear. I believe most people still know too much about this, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.
Linux can be divided into four parts: 1, the kernel, which controls all the hardware and software on the computer system, mainly responsible for system memory management, software program management, hardware device management, file system management; 2, GNU tools, in addition to the hardware devices controlled by the kernel, 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 multi-user, multi-task, multi-thread and multi-CPU operating system based on POSIX. Linux can be divided into the following four parts:
Linux kernel
GNU tool
Graphical desktop environment
Application softwar
The following figure is a basic structural block diagram showing how the various parts work together to form a complete Linux system.
1.Linux kernel
The core of the Linux system is the kernel. The kernel controls all the hardware and software on the computer system. The kernel is mainly responsible for the following four functions:
System memory management
Software program management
Hardware equipment 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, but also creates and manages virtual memory (that is, memory that doesn't actually exist). The kernel implements virtual memory through the storage space on the hard disk, which is called swap space. The kernel constantly swaps the contents of virtual memory between swap space and actual physical memory. This makes the system think that it has more available memory than physical memory.
Memory storage units are divided into blocks in groups called page. The kernel places each memory page in physical memory or swap space. The kernel then maintains a memory page table that indicates which pages are in physical memory and which pages are replaced to disk.
The kernel records which memory pages are in use and automatically copies memory pages that have not been accessed for a while to the swap space area (called swap out, swapping out)-even if there is available memory. When a program wants to access a memory page that has been swapped out, the kernel must swap 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 not stop.
1.2 Software Program Management
The Linux operating system calls running programs processes. 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 proprietary area to the new process in virtual memory to store the data and code used by the process.
The init system of Linux operating system adopts the running level. The run level determines whether the init process runs the / etc/inittab file or
Certain types of processes defined in the / etc/rcX.d directory. The Linux operating system has five startup runlevels.
At run level 1, only the basic system process and one console terminal process are started. We call it single-user mode. Single-user mode is usually used for emergency file system maintenance when there is a problem with the system. Obviously, in this mode, only one person (usually a system administrator) can log in to the system and manipulate the data.
The standard startup run level is 3. At this runtime level, most applications, such as network support programs, start. Another common runlevel in Linux is 5. At this runtime level, the system starts the graphical X Window system, allowing users to log in to the system through a graphical desktop window.
The Linux system can control the function of the whole system by adjusting the startup operation level. By adjusting the run level from 3 to 5, the system can change 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 with which a Linux system needs to communicate needs to include 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 ways to insert device driver code in the Linux kernel:
Device driver code compiled into the kernel
Device driver module that can be plugged into the kernel
Linux system treats hardware devices as special files, which are called device files. There are three categories of device files:
Character device file: a device that can process only one character at a time when processing data. Most types of modems and terminals are created as character device files
Block device file: a device that can handle large chunks of data at a time when processing data, such as a hard disk.
Network device file: refers to the device that uses 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 tool
In addition to the kernel controlling the hardware devices, the operating system also needs tools to perform some standard functions, such as control files and programs. This set of core tools for Linux systems is called the coreutils (core utilities) package. The GNU coreutils package consists of three parts:
Tools for processing documents
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 start programs, manage files in the file system, and processes running on Linux systems. At the heart of shell is the command line prompt. The command prompt is the part that shell is responsible for interacting with. It allows you to enter text commands, then interpret them, and execute them in the kernel. You can also put multiple shell commands into a file to execute as a program. These files are called shell scripts.
On Linux systems, there are usually several Linux shell available. Different shell have different features, some are better for creating scripts, and some are better for managing processes. The default shell for all Linux distributions is bash shell. Bash shell is developed by the GNU project and is regarded as the standard Unix shell.
Type of 2.1.1shell
What kind of shell program the system starts depends on your personal user ID configuration. In the / etc/passwd file, the default shell program is listed in the seventh field of the user's ID record. As soon as the user logs in to a virtual console terminal or starts the terminal emulator in GUI, the default shell program starts running. For example, the user root uses / bin/bash (bash shell) as his default shell program.
[root@node1 bin] # cat / etc/passwdroot:x:0:0:root:/root:/bin/bashbin:x:1:1:bin:/bin:/sbin/nologindaemon:x:2:2:daemon:/sbin:/sbin/nologinadm:x:3:4:adm:/var/adm:/sbin/nologinlp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
However, another default shell is / bin/sh, which serves as the default system shell for system shell scripts that need to be used at startup. You will often see some distributions use soft links to set the default system shell to bash shell, such as CentOS distributions:
$ls-l / bin/sh
Lrwxrwxrwx. 1 root root 4 Mar 18 15:05 / bin/sh-> bash
/ bin/sh is equivalent to / bin/bash-- posix, and using sh to execute the script is equivalent to opening bash's POSIX standard mode, and the differences between them all come from the differences between POSIX standard mode and bash.
The father-son relationship of 2.1.2shell
The default interactive shell that starts when logging in to a virtual controller terminal or running the terminal emulator in GUI is a parent shell.
When you enter the / bin/bash command or other equivalent bash command at the CLI prompt, a new shell program is created. This shell program is called a child shell (child shell). The child shell also has a CLI prompt and also waits for command input.
For example: using ps-f
[root@node1 bin] # ps-fUID PID PPID C STIME TTY TIME CMDroot 727 711 0 11:01 pts/0 00:00:00-bashroot 4385 727 0 12:06 pts/0 00:00:00 ps-f
When using ps-f, two processes are shown. The process ID of one of the processes is 727, running the bash shell program. The process ID of the other process is 4385, corresponding to the command ps-f.
[root@node1 bin] # bash [root@node1 bin] # ps-fUID PID PPID C STIME TTY TIME CMDroot 727 711 0 11:01 pts/0 00:00:00-bashroot 4492 727 0 12:08 pts/0 00:00:00 bashroot 4512 4492 0 12:08 pts/0 00:00:00 ps-f
After typing the command bash, a child shell appears. The second ps-f is executed in the child shell. You can see from the display that there are two bash shell programs running. The first bash shell program, the parent shell process, has an original process ID of 727. The second bash shell program, the child shell process, has a PID of 4492. Notice that the parent process ID (PPID) of the child shell is 727, indicating that the parent shell process is the parent process of the child shell. When a child shell process is generated, only part of the environment of the parent process is copied to the child shell environment.
3.Linux desktop environment
1.KDE (K Desktop Environment,K Desktop Environment) was first released as an open source project in 1996. It creates a graphical desktop environment similar to Microsoft Windows.
The KDE desktop allows you to place application and file icons in a specific location on your desktop. Click the application icon and the Linux system will run the application. Click the file icon, and the KDE desktop determines which application to use to process the file.
2.GNOME (the GNU Network Object Model Environment,GNU Network object Model Environment) is another popular Linux desktop environment. GNOME was first released in 1999 and is now the default desktop environment for many Linux distributions.
3.Unity Desktop
If you are using a Ubuntu Linux distribution, you will notice that it is a little different from KDE and GNOME desktop environments. To be exact, this is because the company responsible for developing Ubuntu decided to adopt its own set of Linux desktop environment called Unity.
The Unity desktop gets its name from the project's goal-to provide a consistent desktop experience for workstations, tablets, and mobile devices. Ubuntu,Unity desktops are used in the same way whether you are on a workstation or on your mobile phone.
These are all the contents of the article "what is the basic structure of linux?" Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.