Process Control theory, Wang Ming learning Learn

Source: Internet
Author: User
Tags function prototype ming mutex

Process Control theory

First, the process

A process is a run-time activity of a program with a certain independent function.

1.1 Process Features

1. Dynamic: The essence of the process is a process of execution, the process is dynamic generation, the dynamic extinction of

2. Concurrency: Any process can execute concurrently with other processes

3. Independence: The process is a unit that can operate independently, but also a system to allocate resources and scheduling of independent units

4. Asynchrony: Due to inter-process constraints, the process has a discontinuity of execution, that is, the process is moving forward at its own, unpredictable speed.

Structure characteristic: The process consists of three parts, the program, the data and the process Control block.

1.2 Process state diagram

1.3 Process ID

Process ID (PID): A unique number that identifies a process

ID of the parent process (PPID)

User ID (UID) of the startup process

1.4 Process Mutex

A process mutex is when a resource is used by a number of processes, but the resource is allowed at most one process at the same time, and other processes must wait until the resource is freed by the resource that consumes it.

1.5 Critical resources

A resource that allows only one process access at a time in the operating system is called a critical resource.

1.6 Critical Area

The program code that accesses critical resources in a process is called a critical section. In order to achieve mutually exclusive access to critical resources, the processes should be guaranteed to enter the respective critical areas.

1.7 Process Synchronization

A process in which a set of processes executes in a certain order is called inter-process synchronization. This set of processes with a synchronous relationship is called a collaborative process, most notably producer and consumer processes

1.8 Process Scheduling

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

1.9 Scheduling algorithm

In the operating system, the common scheduling algorithms are:

1. First come first serve

2. Short process priority scheduling

3. High-Priority priority scheduling

4. Time Slice Rotation method

1.10 According to the scheduling timing can be divided into

1. Preemptive scheduling: high-priority processes preempt the processor and leave the process being processed in the ready queue.

2. Non-preemptive scheduling: When the highest priority of a process in the ready queue is higher than the highest priority of a process running in the processor, it does not leave the running process out of the processor, but rather the header of the high-priority queue at the ready.

1.11 Dead Lock

Multiple processes are deadlocked as a result of competing resources, resulting in the inability of these processes to proceed forward.

1.12 Function Learning

Getpid () is used to obtain the process identification code for the current process, and many programs use this value to create temporary files to avoid the same problems as temporary files.

Function prototype: pid_t getpid (void)

Function: Returns the PID of the process that called the function

Owning header file:<sys/types.h> <unistd.h>

function parameter: None

function return value: The ID of the process that called the function

Process Control theory, Wang Ming learning learn

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.