Linux Process Control Program design

Source: Internet
Author: User

First, the Process Control theory Foundation

Process: is a running activity of a program with a certain independent function. The program is static and the program runs as a process.

1, the characteristics of the process:

Dynamic: Distinguishing features from the program

Concurrency: Multiple processes can execute concurrently

Independence: Independent

Async: Asynchronous operations can be performed between processes and processes

2, process three states:

Process ID (PID): A unique number that flags the process.

Parent process ID (PPID)

User ID (UID) of the startup process

3. Process Mutex

Process mutex is when a shared resource is used by a number of processes, at most one process is allowed at any time, and the other process that uses the resource must wait until the resource is freed by the resource.

Critical resources: At the same time, a resource that only allows one process to access is called a critical resource.

Critical section: The program code that accesses a critical resource in a process becomes a critical section.

In order to achieve mutually exclusive access to critical resources, it is necessary to ensure that each program enters its critical section successively .

4. Process synchronization

The process of executing a set of concurrent processes in a certain order (in a fixed order) is known as inter-process synchronization.

A set of concurrent processes with a synchronization relationship is called a cooperative process.

Signals that are sent to each other in the process of cooperation become messages or events.

5. Process scheduling

According to a certain algorithm, from a set of processes to run to choose one to occupy the CPU operation.

Dispatch mode:

1) Preemptive: A B process, A is executing, B is ready, but the priority of B is high, then a pauses, B runs

2) Non-preemptive: a B process, A is executing, B is ready, but B has a high priority, but waits until a ends and B runs.

Scheduling algorithm

1) first come first service

2) Short process priority (short run time preferred)

3) High priority priority

4) Time slice rotation method: Divide the time slice, each process in the time slice, in turn occupies the CPU.

6. Deadlock

A stalemate in the process of competing resources, without external forces, will never be able to move forward.

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.