Linux system architecture and file system

Source: Internet
Author: User
Tags comparison table

Linux system Architecture

Linux systems are typically made up of 3 main parts:kernel (kernel), command interpreter (shell or other operating environment), application (application or utility)

Kernel of the 1.Linux system

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M01/8F/62/wKiom1jcpALh3qY3AAKI9TKQGbk685.png-wh_500x0-wm_ 3-wmp_4-s_1441097172.png "title=" small Q-20170330141054.png "alt=" Wkiom1jcpalh3qy3aaki9tkqgbk685.png-wh_50 "/>

The kernel is the heart of the Linux system and is the core program for running programs and Disk Management as well as hardware devices such as printers. The operating environment provides the user with an operator interface that accepts commands from the user and sends commands to the kernel to execute. Because the kernel provides the most basic functions of the operating system, if the kernel is out of the question, the entire computer may crash.

The Linux kernel uses a modular architecture, where modules include: storage management, CPU and process management, file system management, device and driver management, network communication, system booting, system invocation, and so on.

When a Linux system is installed, a generic kernel is then transferred to the computer. This generic kernel can meet the needs of the vast majority of users, but it is also because it is universal or general applicability, so many of the specific model of the computer does not need such a large kernel (such as some special models of computer hardware drivers). For this part of the user, the Linux system allows users to customize the Linux kernel based on the actual configuration of their computer , thus effectively simplifying the kernel, freeing up more user space and increasing the system startup speed.

The Linux kernel has been updated very quickly with the tireless efforts of our Linux community, Daniel Linus Torvalds and his team. After installing Linux, users can download their latest version of the Linux kernel , and after the upgrade, they can use the latest version of the kernel features. Since the success or failure of the kernel customization and upgrade is directly related to whether our entire computer system can continue to operate, you must be very careful!


2.Linux Shell command Interpreter

The shell is the user interface of the system and provides an interface between the user and the Linux kernel for interoperability. The operating environment provides an operator interface between the kernel and the user, with the following interface: Desktop, Windows Manager (Window manager), Terminal (command line shell). It can be described as an interpreter (here you can interpret it as a translator, translate the instructions we humans can understand into a machine instruction that the computer can recognize, and then send the instructions to the kernel).

The shell is not only a command interpreter but also a programming language that allows a user to write a program composed of shell commands that integrates many of the features of a common programming language. Example: It can perform loop structures and branching control structures, and programs written in Shell have the same effect as programs written by other applications.

Here to explain to you the Shell and Linux itself has a lot of versions, currently has the following shell version

    1. Bourne Shell

    2. Bash

    3. Korn Shell

    4. C Shell

    5. Z Shell

    6. TC Shell


Linux text Parts System

Friends who have installed their Windows operating system should know that the file systems used in the previous versions of Windows98 (including Win98) are in fat format. The NTFS file system format was used after Windows 2000. may not have installed the old version of the system of friends to ask what the difference between the two I'm here to give you a brief description

    • Fat filesystem (file allocation table)

is a file system invented and patented by Microsoft for MS-DOS and is also used by all non-NT core Microsoft Windows. The FAT file system was not complicated because of the limited computer performance at the time, so almost all of the PC's operating systems were supported. This feature makes it ideal for floppy and memory card file systems, as well as for data exchange in different operating systems. Now, generally speaking, fat refers to FAT32. However, fat has a serious disadvantage: When a file is deleted and the new data is written, Fat does not organize the file into a full fragment and then writes it, and the long-term use causes the file data to become progressively dispersed, slowing down the read and write speed. Defragmentation is a workaround, but it must often be reorganized to maintain the efficiency of the FAT file system.

Cons:⒈ is too wasted on disk space

⒉ low-efficiency disk utilization

⒊ file storage is restricted,

⒋ does not support long filenames and can only support 8 characters.

⒌ Poor security

6.FAT32 Maximum partition capacity of 2TB in WIN2000 and XP systems

7. More disk fragmentation is generated

    • NTFS filesystem (New Technology File system)

is the file system of the WINDOWSNT environment. The new technology file system is the Windows NT family (for example, Windows 2000, Windows XP, Windows Vista, Windows 7, and Windows 8.1) such as the limited-level dedicated file system (the file system where the drive letter of the operating system must be formatted as NTFS file system, 4096 cluster environment). NTFS replaces the old FAT file system. NTFS has made several improvements to fat and HPFS, such as supporting metadata and using advanced data structures to improve performance, reliability, and disk space utilization, and to provide several additional extensibility features. The detailed definition of the file system is a trade secret and Microsoft has registered it as an intellectual property product.

Advantages: Good performance, strong security, can compress all files in NTFS, set permissions, quotas, support a single file greater than 4GB, and so on.

Disadvantages: 1. Compatibility is not good, many operating systems are not recognized, data exchange inconvenient

2. File fragmentation (less fragmentation compared to FAT vs. fat32 file system)

3. Read and write frequently

EXT2 File System

Linux's filesystem is typically EXT2 (Linux second extended file system,ext2fs). An upgraded version of the EXT3 and Ext4 file system is then presented.

We often hear that Windows requires disk defragmentation, but Linux does not. What is the difference between the two?

The reason is that they have different ways of accessing data. Such as:

650) this.width=650; "src=" Http://ww2.sinaimg.cn/mw690/81b78497jw1eic3rqwb6mj20qj0dzwfu.jpg "width=" 690 "height=" 363 "title=" File System "alt=" 81b78497jw1eic3rqwb6mj20qj0dzwfu.jpg "/>

Assuming that a file's properties and permissions information is stored in the Inode number 3rd, and the actual file data is stored in the 1, 4, 6, 11 of the four blocks, then when the operating system to access the file, it can arrange the reading order of the disk, you can scan the contents of 4 blocks read out. This type of access is called an indexed file system (indexed allocation). and ext has quite a lot of free space between each of the two files. When files are modified and the volume increases, they usually have enough space to expand. Therefore, to a certain extent, the access range of block is guaranteed not to span very large, reducing the moving distance of the head.

What about the file system of Windows? We use FAT as an example to illustrate.

650) this.width=650; "src=" Http://ww4.sinaimg.cn/mw690/81b78497jw1eic3rr7syaj20nv0azwf8.jpg "width=" 690 "height=" 317 "alt=" 81b78497jw1eic3rr7syaj20nv0azwf8.jpg "/>

When you save a file to the FAT file system, the system tries to keep it close to the disk where it started. When you deposit a second file, it is next to the first file. When you make frequent deletion changes, the block is particularly fragmented. The FAT file system does not have an inode, so it is not possible to read all blocks of the file at the beginning. Each block number is recorded in the previous block, forming a block chain. When we need to read the file, we have to read the block one at a time, such as 1, 6, 3, 12. This causes the head to not be able to get all the data on the disk, and sometimes it takes several laps to read the file, resulting in poor file read performance. That's why Windows often needs defragmentation--bringing discrete data together while the NTFS file system is smart enough to allocate some "buffering" space around the file, but after a period of use, the NTFS file system still forms fragments. Since ext is an indexed file system, it is generally not necessary to defragment the disk frequently.

EXT2/EXT3 File System

We know that file data, in addition to the actual contents of the file, usually includes a very large number of attributes, such as file permissions (rwx) and file attributes (owner, user group, time, size, and so on) in Linux. The Ext file system stores these two parts in different blocks, and the permissions and attributes are stored in the inode, and the actual data of the file is stored in block blocks. There is also a super block that records the overall system of the entire file system.  Each inode and block has its own number. The ext file system is basically differentiated into blocks (block group) when formatted, and each block group has its own Inode/block/super block system. The overall display is as follows:

650) this.width=650; "src=" http://ww2.sinaimg.cn/large/81b78497jw1eic3rpycyxj20l60b1myh.jpg "width=" 762 "height=" 397 "alt=" 81b78497jw1eic3rpycyxj20l60b1myh.jpg "/>

The meanings of each block are as follows:

Super BLOCK: record the overall system of this file system, including the total number of inode and block, usage, remaining amount, and file system type.

File System Description: File System Description description. The block number that describes the start and end of each block group.

block Bitmap: block comparison table. Used to quickly find the block blocks available.

inode Bitmap: inode table. Used to quickly find the available inode blocks.

inode table: the place where the inode blocks are stored. They are key to the file system. Records the properties of a file, a file occupies an inode, and contains multiple pointers, pointing to each data block block belonging to the file

Data BLOCK: where the data is actually stored. The file is too general to occupy more than one block.

Summarize

This article focuses on the Linux system architecture and the differences between the Linux file system architecture and the Windows file system. The Ext file system format Disk Addressing is also described in detail in the file system. We hope to learn from the Inode and block can understand thoroughly!

Resources:

Jark ' s Blog  

Brother Bird's Linux private dish. Basic Learning

Marco Education


This article is from the "Night sky" blog, be sure to keep this source http://firstshell.blog.51cto.com/8761954/1911853

Linux system architecture and file system

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.