1. Comparison between Linux and other Unix-like kernels: a single-block kernel consists of several logically independent components. a single-block structure, most commercial Unix variants of data are also single-block; traditional Unix kernel compiled and statically connected: Linux can automatically and dynamically load and uninstall some kernel code as needed (... 1. Comparison between Linux and other Unix-like kernels:
Single-block kernel: it consists of several logically independent components. in a single-block structure, most commercial Unix variants of data are also single-block;
Compiled and statically connected traditional Unix kernels: Linux can automatically and dynamically load and uninstall some kernel codes (modules) on demand, while traditional Unix kernels only support static connections;
Kernel threads: Linux uses kernel threads to periodically execute several kernel functions in a very limited way, while some Unix kernels are organized into a group of kernel threads;
Multi-threaded application support: Linux defines its own lightweight process version to support multi-threaded applications, commercial Unix is based on kernel threads as the execution environment of multi-threaded applications;
Preemptible kernel: Linux2.6 provides the "preemptible kernel" compilation option. when this compilation method is used to compile the kernel, Linux2.6 can randomly interlace the execution stream in privileged mode, some traditional and general Unix systems, such as Solaris, are fully preemptible kernels;
Multi-processor support: some Unix kernel variants use the multi-processor system. Linux2.6 supports symmetric multi-processing in different storage modes, not only can use multi-processor, at the same time, each processor can process any task without any difference;
Note: "Symmetric Multi-Processing" (SMP) refers to a group of processors (multiple CPUs) integrated on a computer ), the memory subsystem and bus structure are shared among CPUs.
File System: The Linux standard file system supports multiple types of file systems. because of the object-oriented virtual file system technology, the external file system can be easily transplanted to the Linux kernel;
Note: a virtual file system (VFS) is an interface layer between a physical file system and a service. it abstracts all the details of each file system in Linux, so that different file systems are the same in Linux core and other processes running in the system. Strictly speaking, VFS is not an actual file system. It only exists in the memory and does not exist in any external storage space. VFS is established when the system is started and disappears when the system is shut down.
STREAMS: most Unix kernels contain the streams I/O subsystem, which is the preferred interface for writing device drivers, terminal drivers, and network protocols, but does not have a similar subsystem in Linux;
II. hardware dependency:
Linux tries to keep a clear line between hardware-independent source code and hardware-related source code. For this reason, Linux provides different support for different hardware platforms, currently, 23 different types of hardware platforms are supported.
III. basic concepts of the operating system:
When the operating system is started, the kernel is loaded into RAM. the kernel contains many core processes required for system operation. The kernel provides the main functions for everything in the system and determines many features of the high-level software.
The operating system has two main goals: to interact with hardware and to provide an execution environment for applications running on it.
Multi-user system:
Computers that can concurrently and independently execute several applications belonging to two or more users.
"Concurrency" means several applications can be active at the same time and compete for various resources;
"Independent" means that each application can execute its own tasks without considering what other users' applications are doing;
Features that must be included in a multi-user operating system:
L authentication mechanism for verifying user identity;
L prevent erroneous applications from interfering with the protection mechanism of other applications running in the system;
L protection mechanisms to prevent malicious user programs from interfering with or spying on activities of other users;
L The billing mechanism that limits the number of resources allocated to each user;
The preceding protection mechanism depends on the hardware protection mechanism related to the CPU privileged mode.
Users and Groups:
All users are identified by a unique user identifier.
To share data, a user group is introduced, which is identified by a unique user group identifier.
Any Unix-like operating system has a special root user, that is, a Super User. the operating system does not use the usual protection mechanism for her to access any file in the system, and interfere with any ongoing user program activity.
Process:
The execution context of a program ".
Unix is a multi-processor operating system with preemptible processes.
Unix-like operating systems adopt the process/kernel mode. every process thinks that it is the only process in the system and can exclusively occupy the services provided by the operating system. As long as the process sends a system call, the hardware changes the privileged mode from the user state to the kernel state, and then the process starts executing a kernel process for a very limited purpose.
Kernel architecture:
Most Unix kernels are in a single-block structure: each kernel layer is integrated into the entire kernel program and represents that the current process runs in the kernel state.
The microkernel operating system only requires a very small function set in the kernel, which usually includes several synchronization primitives, a simple scheduling program, and a communication mechanism between processes.
The microkernel operating system is generally less efficient than a single kernel. Therefore, explicit message transmission between different levels of the operating system takes a certain cost.
The microkernel operating system forces system programmers to adopt a modular approach, because any operating system layer is a relatively independent program, which must be defined by a clear software interface, to achieve interaction with other layers, and facilitate migration at the same time.
The microkernel operating system makes full use of RAM than a single kernel.
The Linux kernel provides modules. A module is a target file, and its code can be linked to or removed from the kernel at runtime. This type of target code is usually composed of a group of functions used to implement file systems, drivers, or other kernel upper-layer functions.
IV. Unix file system overview:
File:
Unix files are information carriers composed of byte sequences. the kernel does not interpret the file content.
The file or directory name consists of any ASCII character sequence except "/" and "\ 0". generally, it cannot exceed 255 characters.
When the file name is identified, "." and "." are used to identify the current working directory and parent directory respectively.
Hard link and soft link:
The file name contained in the directory is a hard link or short link to the file.
Soft links are short files that contain any path name of another file.
File type:
Unix files can be one of the following types:
L common files
L Directory
L symbolic link
L block-oriented device files
L character-oriented device files
L pipeline and command pipeline
L Socket)
File descriptor and index node:
The file content does not contain any control information.
All the information required by the file system to process files is contained in a data structure named index node.
The index node provides at least the following attributes:
L file type
L number of hard links related to files
L file length in bytes
L device identifier (the identifier of the device that contains the file)
L identify the index node number of a file in the file system
L file owner's UID
L user group ID of the file
L timestamps indicate the time when the status of the index node changes, the last access time, and the last modification time.
L access permission and file mode
L
File operation system call:
When a user accesses the content of a flexible file or directory file, it actually accesses some data on the hardware device. Therefore, the file system is a user-level view of the hard disk partition physical organization. Because processes in the user state cannot directly interact with the underlying hardware, all actual file operations must be performed in the kernel state.
When several processes open a file at the same time, the file system assigns each file a separate object to open the file and a separate file descriptor. In this case, the Unix file system does not provide any synchronization mechanism between I/O operations sent by processes on the same file.
For Common Unix files, they can be accessed sequentially or randomly. for device files and named pipe files, they can only be accessed sequentially.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service