Linux System Overview _unix Linux

Source: Internet
Author: User
Tags syslog web services

This chapter outlines the Linux system. The primary service provided by the operating system is described first. The program that implements these services is then described with a considerable lack of detail. The purpose of this chapter is to understand the system as a whole and to elaborate each section later.

Different parts of an operating system

A UNIX operating system consists of a core program kernel and some system program systems programs. There are also some applications that do something application programs. The core is the heart of the operating system. It tracks files on disk, launches programs and runs them, allocates memory and other resources to different processes, receives and sends packets from the network, and so on. The core rarely works on its own, but it provides the tools to build all the services with these tools. It also prevents anyone from accessing the hardware directly, forcing everyone to use the tools it provides. In this way, the core provides protection between each user and other users. The core-provided tools are used by system call calls, and to learn more about this, see section II of the man page.

The System program uses the core provided tools to implement the different services required by the operating system. System programs and all other programs run on top of the core, called user mode. The difference between the system program and the application is the purpose: the application intends to do some useful work (or game), while the system program is needed for the system to work. Word processor is an application; Telnet is a system program. The distinction is often somewhat blurred, perhaps, just to force categorization.

Although the programming language does not have to be part of the operating system, the operating system can include compilers and their associated libraries (under Linux are GCC and C libraries). Documents, and sometimes even games, can be part of the operating system. Traditionally, the operating system has been defined as the installation of tape or disk content, and Linux is less clear because it is distributed around the world's FTP sites.

Important parts of the core

The Linux core consists of several key components: process management, memory management, hardware device drivers, file system drivers, network management, and other different parts. Figure 2.1 shows some of them.

Perhaps the most important parts of the core (none of which can work) are memory management and process management. Memory management is responsible for allocating the process's memory area and swap space area, core components and buffer cache. Process management generates processes that multitask by switching the active processes on the processor.

At the lowest level, the core includes a hardware device driver for each of the hardware it supports. Because there are a lot of different hardware in the world, the number of hardware device drivers is enormous. There are many different hardware, so the software control method is different. But its similarity may be classified as driving, supporting similar operations; Each member of each class has the same interface with the other parts of the core, but the implementation is different. For example, all hard drives are the same as the other parts of the core, i.e. they have initialization drives, read n sectors, and write n sectors.

Some of the software services provided by the core themselves have similar abstract properties, so they can be abstracted into categories. For example, different network protocols have been abstracted into a programming interface: the BSD socket library. Another example is the virtual filesystem (VFS) layer, which abstracts file system operations from the file system operation implementation. Each file system type provides an implementation of each file system operation. When some entities attempt to use a file system, the request is sent through the VFS, which sends the request to the appropriate file system driver.

Primary services for UNIX systems

This section describes some of the most important UNIX services, but not very detailed. This will be explained in more detail in future chapters.

Init

The most important service in the UNIX system is provided by Init. Init is the first process that each UNIX system starts at the core boot. After Init starts, it does different startup work to continue the boot process (check and Mount file system, start the waiting program, etc.)
The list of specific things that Init does depends on the user's will; init has multiple startup choices. The concept of single user mode is typically provided, where no user can log in, and Root uses a shell in the console; the usual pattern is called multiuser mode multiuser modes. This is generally referred to as run-level run levels; Single-user and multiuser mode can be understood to be 2 run levels, and there can be other running levels, for example, running X on the console.

In normal operations, Init confirms that Getty is operating properly (allowing the user to log in) and adopts an orphan process (a process in which the parent process is dead; in Unix, all processes must be in a tree, so the orphan process must be adopted).

When the system shuts down, Init is responsible for killing all other processes, unmount all file systems and stopping the processor, depending on the settings.

Log on from the terminal

Logging in from the terminal (via serial line) and the console (when not running X) is provided by the Getty program. Init initiates a separate Getty instance for each terminal that allows logins Getty read the username and run the login program, which reads the password. If the username and password are correct, login runs the shell. When the shell terminates, that is, the user logs off, or login is terminated due to incorrect username and password, Init knows and starts a new Getty instance. The core does not have the concept of login, which is handled by the system program.

Syslog

The core and many system programs generate errors, warnings, and other information. It is often important to see this information later, even after a long time, so they should be written to a file. This program is syslog. It can be set to sort information into different files based on the program or degree of importance of the output information. For example, core information is often separated from other information and directed to a separate file, because core information is often more important and needs to be read regularly to determine the problem.

Timed execution commands: cron and at

Users and system administrators often need to run commands regularly. For example, a system administrator might want to run a program that clears the directory of staging files (/tmp and/var/tmp) from old files to avoid full disk because not all programs clean up their staging files correctly.

Cron service is doing this. Each user has a crontab that lists the commands he wants to perform and the time he wants to execute. The cron daemon is responsible for initiating the command at a specific time.

The at service is similar to cron, but it only executes once: the command executes at a given time, but it cannot be automatically duplicated.

GUI for graphical user interface

UNIX and Linux do not integrate user interfaces into the core, but are implemented using user-level programs. The user interface provides both a text and a graphics environment.

This arrangement makes the system more flexible, but has the disadvantage of easily implementing different user interfaces for each program, making the system more difficult to learn.

The main graphics environment used by Linux is called the X Window System (abbreviated as X). X also does not implement the user interface; It implements only one window system, that is, a tool that can implement graphical user interfaces. The 3 most popular user interface styles based on X implementations are Athena, motif, and open look.

Internet

The network connects 2 or more computers to enable them to communicate with each other. The actual methods of connecting and communicating are somewhat complex, but the results are very useful.

UNIX operating systems have many network characteristics. The most basic services: File system, printing, backup, etc. can be done through the network. This makes system management simpler because it allows centralized management while gaining the benefits of minicomputer and distributed computing, such as cost reduction and better fault tolerance.

However, this book only outlines the network; see the Linux Administrator's Guide for more information, including a basic description of how a network operates.

Network Login

Network logins are a bit different from normal logins. Each terminal that can log on has a separate physical serial line. Each person logged on from the network has a separate virtual network connection and can have any number of them. Therefore, it is not possible to run a separate Getty for each possible virtual connection. There are several different ways to log on over a network, and Telnet and Rlogin are the main methods in the TCP/IP network.

Network logins provide a separate Houcheng for each login method (telnet and rlogin use different Houcheng) rather than a group of Getty to listen for all input login attempts. When a login attempt is found, a new instance of itself is initiated to handle the attempt; The original instance continues to listen for other attempts. The new instance works like Getty.

Network File system

One of the most useful things about Web services is to share files through the network file system. This service is typically network file system, or NFS, with the Web file systems developed by Sun.

With a network file system, any file operation can be sent by a single program of a machine to any other machine via the network. This fooled the program into thinking that all the files on the other machine were on the machine where the program was running. This greatly simplifies information sharing because it does not require any modification to the program.

Mail

E-mail is usually the most important way to communicate over a computer. An electronic letter is stored in a file in a specific format, using a specific mail program to send and receive messages.


Each user has one Inbox incoming mailbox (a file in a particular format), and all new messages exist here. When someone sends a message, the mail program locates the recipient's mailbox and adds a letter to the mailbox file. If the recipient's mailbox is on another machine, the letter is sent to the machine, which is used to deliver the mailbox in the way it feels most appropriate.

The mail system includes many programs. Post a message to a local or remote mailbox using a program (mail transfer agent or MTA, for example, SendMail or Smail), while users use a number of different programs (mail user agent or MUA, such as pine or elm). Mailboxes generally exist in/var/spool/mail.

Print

Only one person can use a single printer at the same time, but it is not economical for users to share the printer. Therefore, the printer is managed by the software to implement a print queue: All print tasks are placed in a queue, the printer completes a task and automatically prints the next one. This does not require the user to organize the print queue, avoiding direct control of the printer.

The print queue software also spools the printout to disk, that is, when the task is in the queue, the printout exists in a file. This allows the application to quickly complete a print task to the print queue, and the application can continue without waiting for the print task to actually complete. This is really handy because it allows you to print out a version and continue to modify a new version without having to print it.

File System layout

The file system is divided into many parts, usually from the root file system:/bin,/lib,/etc, Dev, and some other; USR file system contains program and unchanged data;/var file system contains changed data (such as log file);/home file system contains each user 's personal files. Depending on the hardware configuration and system administrator's decision, the method is different, and even everything may be in a file system.

Chapter 3 describes the file system layout in more detail, as described in more detail in the Linux file system standard (Linux filesystem Standard).

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.