Raspberry Pi Advanced Course 4: File System Cognition and Virtual File System, Linux Kernel Block Diagram

File system cognition and virtual file system, Linux kernel block diagram

1. File system

1. What is a file system?

General knowledge: the root directory
file system is used by the operating system to clearly organize files on the storage devicemethod.
The method mentioned above:File management system, Referred to as: file system.

2. What are the types of file systems?

FAT VFAT NTFS EXT1/2/3/4 HFS…
Windows:-----Properties----File system: NTFS
Linux: Command: df _T----File system: EXT4
Raspberry Pi command to view the file system :Df -T
VFAT: boot(bootloader kernel)
EXT4: root directory
TMPFS: memory file system

3. What is a partition?

Windows: random, for ordinary users
C (where the system is installed, files can also be stored), D, E disk
Linux: for developers,
files are stored strictly according to functions, and each partition strictly stores files.
Embedded systems can be divided into 4 Areas,
which are
bootloader: startup code
para: the location where the startup code passes parameters to the
kernel kernel: kernel partition,
root partition, etc.: file system structure

Windows: File paths are continuous
Linux: File paths are not continuous

4. What is the file system directory structure?

File system directory structure: Start from the root directory and use / to indicate.
The file name is case sensitive, the ones beginning with. Are hidden files, and the path is divided by / (use \ to divide in windows),
There are two types of files: Metadata and data itself. When operating a Linux system, the following hierarchical structure rules are usually followed:
LSB (Linux Standard Base) / FHS (Filesystem Hierarchy Standard)

Insert picture description here
/ The vertex directory of all linux operating systems, unlike windows, each partition has a vertex directory

/boot stores related files when the system starts, such as the kernel kernel, grub boot menu. (Do not delete.)

/bin stores all commands, but only ordinary users can execute them

/sbin Commands that the super administrator can execute.

/home stores the home directory of ordinary users

/root Home directory of the super administrator, normal users cannot enter

/etc The directory where configuration files are stored,

/etc/hostname hostname

/etc/hosts A way to resolve domain names locally

/etc/sysconfig/network-script/ifcfg-* Network card configuration file

/dev device directory, hard disk\hard disk partition\CD...

/dev/null black hole, receiving everything, only in but not out

/dev/zero Money tree, can produce a steady stream of data

/dev/random A device that generates random numbers

/dev/pts/0 Virtual Bash Shell terminal, provided to remote users to use 0, representing one terminal, 1 representing 2 terminals, and so on

/usr is similar to the windows directory under the C drive of windows

/usr/lib shared library files, all suffixes end with so, share object

/usr/lib64 64-bit shared library files, all suffixes end with so, share object

/usr/local Everyone puts the software in this directory in the morning, and windows C:\ProgramFile

/usr/bin

/usr/sbin

/var stores some changeable content, such as /var/log logs, which can be changed artificially or changed over time

/tmp stores temporary files, no matter which user can put

/proc Feedback the status information of the currently running process.

/run stores the pid file generated after the program runs

/media

/mnt provides a directory to mount

/opt The directory where the software of early third-party vendors is stored.

/srv Some files generated by physical devices
In Linux systems, there are several directories that are more important. You need to be careful not to delete or change internal files by mistake.

/etc: This is the configuration file in the system. If you change a file in this directory, the system may not start.

/bin, /sbin, /usr/bin, /usr/sbin: This is the default storage directory of the executable file. For example, ls is in the /bin/ls directory.

It is worth mentioning that /bin, /usr/bin are instructions for system users (pass users except root), and /sbin, /usr/sbin are instructions for root.

/var: This is a very important directory. There are many programs running on the system, then each program will have corresponding logs generated, and these logs will be recorded in this directory, specifically in the /var/log directory, in addition The default placement of mail is also here.

General knowledge: root directory, not partition, different from Windows

Reference blog post:
Linux file system and directory structure

5. What is a virtual file system?

Virtual File System (vfs): It is an abstraction of various file systems, which provides a common interface for various file systems.

6. What is the function of the virtual file system?

Simplify the development of application programmers,
regardless of the file type: regardless of the file is a disk or a device, only open read write is used for unified operations.

Insert picture description here

Linux system kernel block diagram:

Insert picture description here
Three levels can be seen: hardware level, kernel level and user level.
The user program completes the transition from user mode to kernel mode by trapping. As a user-level and kernel-level interaction method, system calls are divided into two parts: interaction with the file subsystem and interaction with the process control subsystem.
The file subsystem manages files. Including: allocating file space, managing free space, controlling access to files, and retrieving data for users.
The process control subsystem is responsible for process synchronization, inter-process communication, process scheduling and storage management.

The Linux kernel mainly includes 5 modules: process scheduling module, memory management module, file system module, inter-process communication module and network interface module.
1. Process scheduling module: used to control the use of CPU resources by the process.
2. Memory management module: used to ensure that all processes can safely share the main memory area of ​​the machine.
3. File system module: used to support the drive and storage of external devices. (Some are files)
4. Inter-process communication module: used to support a variety of information exchange methods between processes. Realize the information exchange between processes through system calls.
5. Network interface module: Provide access to multiple network communication standards and provide support for multiple network hardware.
All modules must be run through process scheduling

supplement: Linux system kernel block diagram
Flow chart type:
Insert picture description hereround type :

Insert picture description here

What is the Linux shell?

The shell is the user interface of the system,Provides an interface for the user to interact with the kernel. It receives the command entered by the user and sends it to the kernel for execution. It is a command interpreter. In addition, the shell programming language has many characteristics of ordinary programming languages, and shell programs written in this programming language have the same effect as other applications.

== Reference article==: Well written to show
you a real understanding of Linux system structure

Guess you like

Origin blog.csdn.net/weixin_40734514/article/details/108771534