About Linux system architecture

Source: Internet
Author: User

Source: Huangguisu    

Links: http://blog.csdn.net/hguisu/article/details/6122513

Linux systems generally have 4 main parts:

cores, shells, file systems, and applications. The kernel, shell, and file systems together form a basic operating system structure that allows users to run programs, manage files, and use the system. part of the hierarchy is shown in 1-1.

1. Linux kernel

Kernel is the core of the operating system, has many basic functions, it is responsible for managing the system's processes, memory, device drivers, files and network systems, determine the performance and stability of the system.

The Linux kernel consists of the following components: memory management, process management, device drivers, file systems, and network management .

System invoke Interface: The SCI layer provides some mechanism for performing function calls from user space to the kernel. This interface relies on architecture, even within the same processor family.

The SCI is actually a very useful function call multiplexing and multi-channel decomposition service. In./linux/kernel you can find the implementation of the SCI and find the architecture-dependent parts in./linux/arch.

2. Memory Management

For any computer, its memory and other resources are limited. To allow limited physical memory to meet the application's large memory requirements, Linux uses a memory management approach called virtual memory.

Linux divides memory into easy-to-handle "memory Pages" (4KB for most architectures). Linux includes ways to manage available memory, as well as the hardware mechanisms used by physical and virtual mappings.

However, memory management can manage more than 4KB buffers. Linux provides an abstraction of the 4KB buffer, such as the slab allocator. This memory management mode uses 4KB buffers as cardinality, then allocates structures from it, and tracks memory page usage, such as which pages are full, which pages are not fully used, and which pages are empty. This allows the pattern to dynamically adjust memory usage as required by the system.


In order to support the use of memory by multiple users, there are times when available memory is consumed by light. For this reason, the page can be moved out of memory and placed on disk. This process is called swapping because the page is swapped from memory to the hard disk. The source code for memory management can be found in./linux/mm.

3. Process Managementa process is actually a running entity for a particular application. In the Linux system,to be able to run multiple processes concurrently, Linux achieves "multitasking" by running these processes in a short interval of time.

This short time interval is called the "time Slice", the method that lets the process rotate is called "process Dispatch", the program that completes the dispatch is called dispatcher.


Process scheduling controls the process's access to the CPU. When the next process needs to be selected to run, the scheduler chooses the process that is most worth running.

A running process is actually a process that waits only for CPU resources, and if a process waits for another resource, the process is not running. Linux uses a relatively simple priority-based process scheduling algorithm to select a new process.


with a multi-tasking mechanism, each process can assume that only its own computer is exclusive, thus simplifying program writing. Each process has its own separate address space and can only be accessed by this process, so that the operating system avoids interference between processes and the possible harm that a "bad" program can cause to the system. In order to accomplish a particular task, it is sometimes necessary to synthesize the functions of two programs, such as one program output text and the other to sort the text. For this reason, the operating system also provides inter-process communication mechanisms to help accomplish such tasks. Common inter-process communication mechanisms in Linux are signals, pipelines, shared memory, semaphores, sockets, and so on.


The kernel provides an application programming interface (API) through the SCI to create a new process (fork, exec, or portable Operating System Interface [Posⅸ] function ) . Stop the process (Kill, exit) and communicate and synchronize between them (signal or posⅸ mechanism ).

4. File system

Unlike DOS and other operating systems, a separate file system in a Linux operating system is not identified by a drive letter or drive name (such as A: or C:, etc.). Conversely, like the UNIX operating system, the Linux operating system combines a separate file system into a hierarchical tree structure, and a separate entity represents the filesystem. Linux mounts a new file system to a directory with a "mount" or "hang" operation, allowing different file systems to be combined as a whole. an important feature of the Linux operating system is that it supports many different types of file systems. The most commonly used file system in Linux is Ext2, which is also a native Linux file system. However, Linux can also support different types of file systems, such as FAT, VFAT, FAT32, MINIX, and so on, which makes it easy to exchange data with other operating systems. Because Linux supports many different file systems, it organizes them into a unified virtual file system.


virtual file System (VIRTUALFILESYSTEM,VFS): Hides the specifics of various hardware, separating file system operations from the specific implementation details of different file systems, for all devices provides a unified interface, VFS provides up to dozens of different file systems. Virtual file systems can be divided into logical file systems and device drivers. A logical file system is a file system supported by Linux, such as Ext2,fat, which refers to a device driver module written for each hardware controller.


Virtual File System VFS is Linux a very useful aspect of the kernel because it provides a common interface abstraction for the file system. VFS provides a switching layer between the SCI and the file systems supported by the kernel. That is, VFS provides a switch layer between the user and the file system.

VFS provides a switch layer between the user and the file system:

Above the VFS is a generic API abstraction for functions such as open, close, read, and write. Below the VFS is the file system abstraction, which defines how the upper function is implemented.

These are plug-ins for a given file system (more than 50). The source code of the file system can be found in./linux/fs.


Below the filesystem layer is the buffer cache, which provides a common set of functions for the file system layer (independent of the file system).

This cache layer optimizes access to physical devices by keeping the data for a period of time (or by reading the data in advance so that it is available as needed). Under the buffer cache is the device driver, which implements the interface for a particular physical device.


As a result, users and processes do not need to know the file system type in which the files reside, but only need to use them just like files in the Ext2 file system.

5. Device driver device drivers are a major part of the Linux kernel. Similar to the rest of the operating system, the device driver runs in a highly privileged processor environment, allowing direct manipulation of the hardware, but because of this, any device driver errors can cause the operating system to crash. The device driver actually controls the interaction between the operating system and the hardware device.

The device driver provides a set of operating systems that understand the abstraction of interface completion and the interaction between the operating system, and the specifics of hardware-specific operations are done by the device driver. In general, device drivers and device control chips, for example, if the computer hard disk is a SCSI hard disk, you need to use the SCSI driver instead of the IDE driver.6. Network Interface NetProvides access to a variety of network standards and support for a variety of network hardware.Network interface can be divided into network protocol and network driver. The Network Protocol section is responsible for implementing each of the possible network transport protocols. As is known to all, the TCP/IP protocol is the standard protocol for the Internet and is also the de facto industry standard.

The Linux network implementation supports BSD sockets and supports all TCP/IP protocols. The network portion of the Linux kernel consists of BSD sockets, network protocol layers, and network device drivers.The Network device driver is responsible for communicating with the hardware device, and each of the possible hardware devices has a corresponding device driver. 7.Linux ShellThe shell is the user interface of the system and provides an interface for users to interoperate with the kernel. It receives the command entered by the user and sends it to the kernel to execute, which is a command interpreter. In addition, Shell programming languages have many features of common programming languages, and Shell programs written in this programming language have the same effect as other applications.

Currently, the following versions of the shell are mainly available.
1. Bourne Shell: It was developed by Bell Labs.
2. BASH: Is the GNU Bourne Again Shell, which is the default shell on the GNU operating system, and most Linux distribution kits use this shell.
3. Korn Shell: The development of the Bourne Shell, which is compatible with the Bourne shell in most of the content.
4. C Shell: Is the BSD version of Sun's shell.

8.linux File System

A file system is an organization method that files reside on storage devices such as disks. Linux systems can support a variety of currently popular file systems such as EXT2, EXT3, FAT, FAT32, VFAT, and ISO9660.

8.1 File types

Linux The following file types are mainly:
1) Ordinary files: C-language meta-code, shell scripts, binary executable files, etc. Divided into plain text and binary.
2) directory Files: directories, the only place where files are stored.
3) Linked file: A file that points to the same file or directory.
4) device files: Related to system peripherals, usually under/dev. Divided into block devices and character devices.

5) pipeline (FIFO) file: A way to provide process-building communication
6) Socket file: This file type is related to network communication

You can view information about the type of file by Ls–l, file, Stat, and several commands.

8.2 Linux Directory

A file structure is a method of organizing files on storage devices such as disks. Mainly embodied in the organization of files and directories. The directory provides a convenient and effective way to manage files.

Linux uses a standard directory structure that, when installed, has created a file system for the user and a complete and fixed directory composition, specifying the role of each directory and the file types in it.


The complete directory tree can be divided into smaller sections, which can be stored on their own disks or partitions separately. In this way, relatively stable parts and frequently changing portions can be stored separately in separate partitions for easy backup or system management . The main parts of the directory tree are root,/usr,/var,/home, and so on (Figure 2). This layout makes it easy to share portions of the file system between Linux computers.

Linux uses a tree-based structure. The top level is the root directory, and all other directories are generated from the root directory.


Microsoft DOS and Windows also adopt a tree structure, but in DOS and windows such a tree structure root is the disk partition of the letter, there are several partitions there are several tree structure, the relationship between them is tied.

At the top are different disks (partitions), such as: c,d,e,f, etc.

However, in Linux, there is only one directory tree that manages several disk partitions, regardless of the operating system. Structurally, the tree catalogs on each disk partition are not necessarily tied.






About Linux system architecture

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.