Shell learns 48 days----process builds

Source: Internet
Author: User

Process

Preface : A process refers to an instance of a program in execution . The new process consists of Fork () with the Execve () when the system call starts , and then execute , know that they have issued exit () until the system calls .

LinuxSystems support multiple processes.Although the computer looks like it's done a lot of things at once,but unless he's got multipleCPU,Otherwise, doing a lot of things at once is just an illusion ..in fact,Each process is allowed to execute only in a very short period of time,We call it time fragments .,then the process will be shelved first .,let the other waiting processes execute.very short time fragments,usually only a few subtle,so people rarely feel that the process is returning control to the kernel .,This text switch to another process.The process itself does not manage text switching.,There is no need to write a withdrawal of control in the programOSthe processing.

The part of the operating system kernel , called the Scheduler, is responsible for managing the execution of the process . when there are multiple CPu when , the scheduler tries to use all CPU working with workloads . users In addition to the improvement of response speed , I'm probably not aware of any difference . .

The process is assigned a priority , so that a process that has time to consider can be executed before a process that is not important . nice and renice command is used to adjust the priority of a process .

At any moment , the average of the process waiting to be executed is called the mean load , the simplest uptime command to display :

$uptime

20:30:35 up-min, 2 users, load average:0.05, 0.11, 0.05

Analysis : shows the time since power on , the number of users , and the average load .

Since the average load will always change , uptime will return three average time estimates for the last minute , five minutes , and a 10-minute estimate. . when the average load continues to exceed the available CPU the load-time , indicates that the system is more than it can load . , at this point the response may be stuck in a stagnant state .

Process Establishment

Many programs have shell launches : The first word in each command line is the one that identifies the program to be executed . a command Shell each process that starts , will start with the following guarantees :

1. The process has a kernel this article : data Structures in the kernel Record process-related information , making the kernel easy to manage and control process execution .

2. The process has a private protected virtual address space It could be as large as a machine addressable space but Other resource limitations on an instance memory and an external storage device. swap space combined size Other work in execution size or the local setting of the system tuning parameter

3. Three file descriptor ( standard input standard output , standard error output ) all open

4. Start in the chat mode Shell process , will have a control terminal , which plays three standard file data stream to the default source and destination . the control terminal allows the user to transmit the signal to the process .

5. Wildcard characters in command-line arguments are expanded

6. An environment variable region of memory exists that contains a string with the specified key and value , which can be obtained through the library call .

These assurances are without any differential treatment ; all processes executed at the same priority level are treated equally , and the process can be written by any program .

Private address space ensures that processes are not affected by other programs that are not thin other cities or cores interfere . operating systems that do not provide such protection are prone to errors .

These three open files are sufficient for most programs to use them without worrying about file opening and closing operations , Nor do you need to know any file name syntax or filesystem .

A wildcard string that is expanded by the Shell relieves a lot of the burden of the program and provides uniform command-line processing .

Environment space a different way of providing information to a process is provided by the command and input file .

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Shell learns 48 days----process builds

Related Article

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.