Creating the concept of process and process - process management (a)

process

What is the process?

Once the program is up and running is a process, a process is an instance can run.

Each process has its own virtual CPU, but in fact there is only one CPU, its just a quick switch between the various processes, such rapid switching is called multiprogramming

Processes and procedures What is the difference?

Example: a computer scientist to make a cake for his daughter, he has to do with the cake recipe, the kitchen has a lot of raw materials, such as vanilla, eggs, flour, sugar and so on. Which is a recipe program, it is a way. Computer scientists is the CPU, do the cake is the raw data.

Process that cooks read recipes, and take to the sum of all kinds of raw materials and then baking a cake and a series of actions.
Cpu data acquisition process is, according to the sum of a series of processes of program execution, it is dynamic. Programs is static, it is something similar to a process specification.

Process interrupt : Now his son ran a computer scientist who was stung by a bee ( higher priority things happen ), computer scientists will first record the cake now done (where the current state of the preservation process ), turn to deal son's injury, when finished with his son's injury, and then return to continue to make a cake, continue to do the cake according to a previously saved state .

Note that a program is performed twice, then count the two processes .

Create a process

The reason the creating process

Four reasons leading to the process to be created:

1. System Initialization

Start the operating system will be created when multiple processes, which some processes in the foreground, in addition is the background process, this process is known as daemons , most of its time in sleep, only in a specific event occurs the time was only called. For example, wait for the program to receive mail.

2. The process running the calling process creation system call

The process has been started, you can call the system call to create a process to help it work better. For example, there is such a web application, it is to deal with large amounts of data and then create a process to help him put the data into the designated area, and let another process removed and processed, it will be better, because it was better than help Without any help is good.

3. User request to create a new process

User types a command in cmd window, or user double-clicks the icon, you can start a program, this will also start a process.

4. A batch job initialization

In this case mainframe batch systems main application, users submit batch jobs towards the system, the operating system think it's sufficient resources can create a process of time, it will create a process.

UNIX and Windows to create a process

UNIX process is created

unix system has only one system call can be used to create a new process is fork command.

Windows creates process

A win32 CreateProcess function call not only handles the creation process, is also responsible for the correct program into the new process.

Space parent and child processes

After the process is created, the parent and child processes are different address spaces, if the address space of a process modifies a word, so that their child process is not visible.

Guess you like

Origin www.cnblogs.com/mengxiaoleng/p/11604828.html