Linux shell execution principle, linuxshell execution

Source: Internet
Author: User

Linux shell execution principle, linuxshell execution
Shell Introduction

Shell is a system user interface that provides an interface for users to interact with the kernel. It receives user-input commands and sends them to the kernel for execution.

Running background

A basic linux System Structure

B. It can be seen that shell is in an intermediate level in the system. It provides a solution for the interaction between users and kernel.

C. Many advantages of layered structure:

1. developers can only pay attention to one of the layers in the entire structure;
2. It is easy to replace the original implementation with the new implementation;
3. The dependency between layers can be reduced;
4. conducive to standardization;
5. facilitate the reuse of logic at each layer.

Disadvantages:

1. Reduced system performance.

2. Sometimes cascade modifications

Shell Command Execution Principle

The general practice of understanding the surface layer is to open the terminal, enter the command, press enter, and wait for the command to run. The result is displayed.

So what are the details of this process?

Open the terminal, enter the command, and press ENTER ---- IO interrupted

Waiting process:

Shell Analysis commands and parameters ---- shell (an interpreter at a terminal location)

Fork copies pcb-related resources nearby and prepares for command execution ---- system call

Exec executes the command in the fork sub-process.

After the execution is complete, return result ---- stack protection, stack frame Note: When the execution command such as ls &

& Symbol indicates that the command is executed in the background. When the command is executed, we cannot just enter the command because the parent process executes the shell command at fork, wait until the sub-process ends, unless the user actively Ctrl + C Stop command execution or Ctrl + z put into the background for execution.

 

Reference http://my.oschina.net/u/866271/blog/232840

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.