Operating System-Process (1), operatingsystem

Source: Internet
Author: User

Operating System-Process (1), operatingsystem

This article describes one of the core concepts of the Operating System: Process. The main content is as follows:

1. What is basic information about process 1.1

A process is an instance of the execution program. It is an abstract action of a running program, including all program counters (PCS), registers, and variables of the current running program: the commands and data required for running the program.

If the program is a recipe, the process is the process of cooking.

Process instance running on my current system (windows 10)

If a program runs multiple times at the same time, the operating system will create multiple processes (which do not affect each other). For the operating system, multiple processes just run the same program. Google Chrome is an example (multiple instances do not affect each other, but consume memory resources ..)

1.2 Why Process

Why does the operating system introduce the concept of a process? Isolation is mentioned above, but isolation is not the primary driving force for process introduction. The primary driving force for introducing processes is to increase the system response time.

The CPU can only do one thing at a time, and only one process can run on the CPU. But why do we feel that the computer has many things at the same time? We typed in the Word over and received an email notification in the lower right corner.

The operation system uses its own scheduling policy to switch the CPU between Word and Email. Because the switching speed is very fast, the user feels that the CPU has a lot to do at the same time, in this way, the system response is increased.

User perception

Processes a, B, and c are executed simultaneously.

 

 

Actual execution

A, B, and c are only executed at the same time.

1.3 Process Scheduling

An example shows a father preparing to cook a cake for his son. He has a recipe for making a cake. He is cooking a cake according to the recipe. Then his son comes in and says to him: "Dad, I want to drink milk ". The father stopped his cake, poured milk to his son, heated it in the microwave oven, and finally gave the milk to his son. Finally, the father returned to the original place where the cake was made and continued to complete the cake.

The CPU switches between process A and process B based on the current situation (policy. My father poured milk and continued to make the cake. The progress here is that the CPU first saves the status of the current process before switching between processes. When switching to this process again, it runs from the previously saved status (the overhead of process switching can also be seen ).

Ii. Process Creation (Creation) 2.1 Process Creation Time 2.2 Creation process

The above three processes are created at the same time: an existing process skips a system call to complete the process creation.

This system call will inform the operating system to create a process.

The process that initiates a system call is the parent process, and the created process is the child process. The Parent and Child processes are independent of each other, and their address space is completely different.

2.3 Hierarchy)

As described above, the new process is completed by sending a call to the creation process like the OS. The created process is now called child process. This child process may send a request to the OS again to create a child process ..... And so on, there will be a process inheritance chain.

The above process that becomes a chain will exist as a process group in unix. However, in Windows, these processes are completely independent. The inheritance relationship is not very important in the process.

3. Process termination)

After a process is created, it will eventually terminate. The process will be terminated under the following conditions, which is relatively easy to understand:

In some operating systems, when a process is terminated, processes created by the process will also be killed.

4. Process status (State) 4.1

There are three statuses after a process is created:

Blocked refers to the process waiting for external stimulation (not related to CPU), such as the Console program, which is always waiting for user input.

Ready indicates that a process can run without waiting for any resources, but the CPU is occupied by other processes and has no CPU resources.

4.2 status Switching

Running-"Blocked: other external resources are required during the process.

Blocked-Ready: the resources required by the process are met.

Ready-"Running: determined by the CPU's Scheduler. The CPU can be used by the current process.

Running-Ready: it is determined by the Scheduler of the CPU. the CPU is allocated to other processes for use. (for example, in the preceding example, Dad stops the cake being made to give his son hot milk. At this time, the cake is in ready state)

 

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.