


Five stages of the system startup process: 1. Kernel boot stage; when the computer is turned on, the first is the BIOS power-on self-test. According to the startup device (usually the hard disk) set in the BIOS ) to start. During the system startup phase, the init process runs as the starting point for all processes. Without this process, no process in the system can start. 3. System initialization phase; call rc to complete some system initialization work. 4. Establish the terminal stage. 5. User logs into the system.
Linux system startup process
The startup process of the Linux system is not as complicated as everyone thinks. The process can be divided into 5 stages:
(1) Kernel boot.
(2) Run init.
(3) System initialization.
(4) Create a terminal.
(5) User logs in to the system.
1. Kernel boot
After the computer is turned on, it will first perform a BIOS power-on self-test, and then proceed according to the preset boot device (usually a hard disk) in the BIOS. to start. When the operating system takes control of the hardware, its first task is to load the core files in the /boot directory.
2. Run init
(1) The init process is the starting point of all processes in the system. You can compare it to the system The ancestor of all processes, without this process, no process in the system will start. The init program needs to read the configuration file /etc/inittab first.
(2) Run level: Many programs need to be started at boot. They are called "services" in Windows and "daemons" in Linux.
A major task of the init process is to run these programs that are started at boot. On different occasions, specific programs need to be started. For example, when used as a server, Apache needs to be started, but when used as a desktop, it is not required.
Linux allows different boot programs to be allocated for different occasions, which is called "runlevel". In other words, the runlevel determines which programs need to be run at startup.
(3) The Linux system has 7 runlevels (runlevel):
Runlevel 0: System shutdown state, system The default run level cannot be set to 0, otherwise it will not start normally.
Run level 1: single-user working state, root authority, used for system maintenance, remote login is prohibited
Run level 2: Multi-user state (without NFS)
Run level 3: Complete multi-user state (with NFS), enter the console command line after logging in Mode
Run level 4: The system is not used, reserved
Run level 5: X11 console, enter the graphical GUI mode after logging in
Run level 6: The system shuts down and restarts normally. The default run level cannot be set to 6, otherwise it cannot start normally.
3. System Initialization
There is such a line in the init configuration file: si::sysinit:/etc/rc.d/rc.sysinit It calls and executes /etc/rc.d/rc.sysinit. rc.sysinit is a bash shell script, which mainly completes some system initialization work. rc.sysinit is an important script that must be run first at every run level.
The main tasks it completes are: activating the swap partition, checking the disk, loading hardware modules and other tasks that need to be performed first.
4. Establish a terminal:
After rc is executed, return to init. At this time, the basic system environment has been set up and various daemon processes have been started. init will then open 6 terminals so that users can log in to the system.
5. User login system:
3 types: command line login, ssh login, graphical interface login
Attachment: Linux shutdown
1. The correct shutdown process is: sync > shutdown > reboot > halt
2. The shutdown command is: shutdown, you can take a look at man shutdown Help documentation.
3. Example:
<code>sync # 将数据由内存同步到硬盘中。<br/><br/>shutdown –h 10 ‘This server will shutdown after 10 mins’ <br/>#这个命令告诉大家,计算机将在10分钟后关机,并且会显示在登陆用户的当前屏幕中。<br/><br/>shutdown –h now # 立马关机<br/>shutdown –h 20:25 # 系统会在今天20:25关机<br/>shutdown –h +10 # 十分钟后关机<br/>shutdown –r now #系统立马重启<br/>shutdown –r +10 #系统十分钟后重启<br/>reboot # 就是重启,等同于 shutdown –r now<br/><br/>halt # 关闭系统,等同于shutdown –h now 和 poweroff<br/></code>
4. Whether you restart the system or shut down the system, you must first run the sync command to write the data in the memory to the disk.
The commands for shutting down include shutdown –h now, halt, poweroff and init 0, and the commands for restarting the system include shutdown –r now, reboot and init 6.
5. Shutdown will schedule a time for the system to shut down. It can be used to stop, shut down, and restart the machine.
shutdown -p now # 关闭机器 shutdown -H now # 停止机器 shutdown -r 09:35 # 在 09:35am 重启机器
To cancel an upcoming shutdown, just enter the following command:
shutdown -c
使用 halt 命令能够让 CPU 停止运行,但仍然保持通电状态。你可以用它使系统处于低层维护状态。注意在有些情况会它会完全关闭系统。
# halt ### 停止机器 # halt -p ### 关闭机器、关闭电源 # halt --reboot ### 重启机器
poweroff 会发送一个 ACPI 信号来通知系统关机。
# poweroff ### 关闭机器、关闭电源 # poweroff --halt ### 停止机器 # poweroff --reboot ### 重启机器
reboot 命令 reboot 通知系统重启。
# reboot ### 重启机器 # reboot --halt ### 停止机器 # reboot -p ### 关闭机器
The above is the detailed content of What are the stages of the Linux system startup process?. For more information, please follow other related articles on the PHP Chinese website!

The five core components of the Linux operating system are: 1. Kernel, 2. System libraries, 3. System tools, 4. System services, 5. File system. These components work together to ensure the stable and efficient operation of the system, and together form a powerful and flexible operating system.

The five core elements of Linux are: 1. Kernel, 2. Command line interface, 3. File system, 4. Package management, 5. Community and open source. Together, these elements define the nature and functionality of Linux.

Linux user management and security can be achieved through the following steps: 1. Create users and groups, using commands such as sudouseradd-m-gdevelopers-s/bin/bashjohn. 2. Bulkly create users and set password policies, using the for loop and chpasswd commands. 3. Check and fix common errors, home directory and shell settings. 4. Implement best practices such as strong cryptographic policies, regular audits and the principle of minimum authority. 5. Optimize performance, use sudo and adjust PAM module configuration. Through these methods, users can be effectively managed and system security can be improved.

The core operations of Linux file system and process management include file system management and process control. 1) File system operations include creating, deleting, copying and moving files or directories, using commands such as mkdir, rmdir, cp and mv. 2) Process management involves starting, monitoring and killing processes, using commands such as ./my_script.sh&, top and kill.

Shell scripts are powerful tools for automated execution of commands in Linux systems. 1) The shell script executes commands line by line through the interpreter to process variable substitution and conditional judgment. 2) The basic usage includes backup operations, such as using the tar command to back up the directory. 3) Advanced usage involves the use of functions and case statements to manage services. 4) Debugging skills include using set-x to enable debugging mode and set-e to exit when the command fails. 5) Performance optimization is recommended to avoid subshells, use arrays and optimization loops.

Linux is a Unix-based multi-user, multi-tasking operating system that emphasizes simplicity, modularity and openness. Its core functions include: file system: organized in a tree structure, supports multiple file systems such as ext4, XFS, Btrfs, and use df-T to view file system types. Process management: View the process through the ps command, manage the process using PID, involving priority settings and signal processing. Network configuration: Flexible setting of IP addresses and managing network services, and use sudoipaddradd to configure IP. These features are applied in real-life operations through basic commands and advanced script automation, improving efficiency and reducing errors.

The methods to enter Linux maintenance mode include: 1. Edit the GRUB configuration file, add "single" or "1" parameters and update the GRUB configuration; 2. Edit the startup parameters in the GRUB menu, add "single" or "1". Exit maintenance mode only requires restarting the system. With these steps, you can quickly enter maintenance mode when needed and exit safely, ensuring system stability and security.

The core components of Linux include kernel, shell, file system, process management and memory management. 1) Kernel management system resources, 2) shell provides user interaction interface, 3) file system supports multiple formats, 4) Process management is implemented through system calls such as fork, and 5) memory management uses virtual memory technology.


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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Dreamweaver Mac version
Visual web development tools

WebStorm Mac version
Useful JavaScript development tools

Dreamweaver CS6
Visual web development tools

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

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.
