Comprehensive Analysis of Linux Components

Source: Internet
Author: User

Linux was nothing in Microsoft's eyes today. Over the past decade, Microsoft has officially taken a look at Linux. This article gives you a detailed description of the main components of Linux and plays a role in learning the main components of Linux. Linux is mainly composed of several parts: storage management, process management, file system, and inter-process communication. In terms of many algorithms and implementation policies, Linux draws on the success experience of Unix, however, they also have their own characteristics.

1. Storage Management

Linux uses a page-based storage management mechanism. The size of each page varies with the processor chip. For example, an Intel 386 processor page can be 4 kb or 2 MB, while an Alpha processor page can be 8 KB, 16 KB, 32 KB, or 64 KB. The selection of page size has a certain impact on the address transformation algorithm and the structure of the page table, for example, the valid length of Alpha virtual addresses and physical addresses varies with the size of the page, this change will be reflected in address translation and page table items.

In Linux, each process has a virtual space that is much larger than the actual physical space. To establish a ing between the virtual space and physical space, each process retains a page table, it is used to convert the virtual address in the local space into a physical address. The page table also specifies the access permissions for the physical page, defines which pages can be read and written, and which pages are read-only pages, in Linux, the access permission specified in the page table is used to determine whether the process accesses the physical address legally, so as to achieve storage protection.

Linux storage space allocation follows the principle of never allocating physical space when there are actual needs. When a program is loaded and executed, Linux only allocates virtual space for it. It allocates physical space only when a page is interrupted when a virtual address is accessed, in this way, some pages have never been loaded into the memory after some programs are completed. The benefits of this storage allocation policy are obvious because it maximizes the use of physical storage.

Although Linux is very cautious with the use of physical storage resources, there is still a shortage of physical storage resources. In Linux, a process named kswapd is responsible for page switching. When the number of idle pages in the system is smaller than a certain number, kswapd selects some pages based on a certain elimination algorithm, or directly discard (the page is not modified), or write it back to the hard disk (the page has been modified ). This method is different from the old version of Unix. It writes all the pages of a process back to the hard disk. In contrast, Linux is more efficient.

2. Process Management

In Linux, processes are the basic unit of resource allocation, and all resources are allocated with processes as objects. During the life cycle of a process, it will use many system resources, run its commands with the CPU, store its commands and data with the memory, and open and use files in the file system, therefore, Linux has designed a series of data structures that can accurately describe the status of processes and their resource usage, in order to use system resources fairly and effectively. The scheduling algorithm of Linux ensures that some processes do not wait endlessly because they occupy excessive system resources.

Process Creation is a very complex process. Generally, You need to allocate physical space for the child process and copy the content of the parent process space to the child process space. The overhead is very high. In order to reduce the overhead of Process Creation, Linux adopts the Copyonwrite technology, that is, copying the parent process's page table instead of copying the space of the parent process, so that the parent process and the child process share the physical space, and set the access permission of the shared space to read-only. When a write operation is performed by a parent process and a child process, Linux detects an illegal operation and copies the pages to be written. This avoids the replication of read-only pages, thus reducing the overhead.

3. File System

One of the most important features of Linux is that it supports multiple different file systems. We have seen that Linux currently supports more than 10 file systems. Over time, this number is still increasing.

In Linux, a separated file system is not accessed by a device identifier (such as a drive letter or drive name), but is integrated into a single directory tree and accessed through a directory, this is very similar to Unix. Linux uses the installation command to install a new file system to a directory in a single directory tree. Once the installation is successful, all contents in this directory will be overwritten by the newly installed file system. When the file system is detached, the files in the installation directory will be restored.

Linux's initial file system was Minix. The file system has too many file restrictions and has low performance. For example, the file name length cannot exceed 14 characters and the file size cannot exceed 64 MB. To solve these problems, Linux developers have designed a Linux-specific file system EXT. EXT relaxed a lot of requirements on files, but did not significantly improve the performance, so there was the next EXT2 file system. The EXT2 file system is a very successful file system. It does not discuss whether it limits files or is significantly better than the EXT file system in terms of performance. Therefore, EXT2 has been the most common file system in Linux since its launch.

To support multiple file systems, Linux uses an interface layer called Virtual File System (VFS) to split the real file system from the operating system and system services. VFS allows users to install multiple different file systems transparently at the same time.
VFS masks the differences between different file systems, making all file systems equivalent to operating systems and user programs. 4. inter-process communication:

Linux provides a variety of communication mechanisms between processes. Among them, signals and pipelines are the most basic. In addition, Linux also provides System V inter-process communication mechanisms, including message queues, signal lights, and shared memory. To support process communication between different machines, Linux also introduces the BSD Socket mechanism. I hope this article will help you with the main components of Linux.

  1. Linux design purpose and Method
  2. Various Linux releases
  3. Linux Kernel and GNU Program
  4. A Brief Introduction to the Linux operating system
  5. Help you understand Linux FAQs

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.