Fundamentals of Linux Process Control theory

Source: Internet
Author: User
Tags mutex

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

characteristics of the process
Dynamic: The essence of a process is the process of execution of a program. The process is dynamically generated and dies dynamically.
Concurrency: Any process can execute concurrently with other processes
Independence: A process is a basic unit that can run independently, and also an independent unit for allocating resources and scheduling.
Asynchrony: Because of the inter-process constraints, the process has a discontinuity of execution, that is, the process at its own independent, unpredictable speed ahead
Structure characteristics: Process consists of three parts, program, data and Process control block

three basic states of the process
The process typically has 3 basic states: Run, ready, and blocked.
1) Running state: When a process is running on a processing machine, it is said to be running. The number of processes in this state is less than or equal to the number of processors, and for a single processor family, there is only one process in the running state. When no other process can execute, such as when all processes are in a blocking state, the idle process of the system is usually performed automatically.
2) Ready state: When a process obtains all the resources except the processor, once the processing machine can be run, it is said that the process is in a ready state. A ready process can divide queues by multiple priorities. For example, when a process enters a ready state because the time slice is exhausted, it is queued to the low priority queue, and the high priority queue is queued when the process I/O operation completes and enters the ready state.
3) Blocking state: Also known as the waiting or sleep state, a process is waiting for an event to occur (such as requesting I/O and waiting for I/O completion, etc.) and temporarily stop the operation, the instant processor allocated to the process can not run, it is said that the process is blocked.

Process ID
Process ID (PID) is a unique number that identifies a process
The parent process ID is called Ppid, and the user ID of the startup process is called UID.

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 that consumes it.

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

critical Section
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.

dead Lock
Multiple processes are deadlocked by competing resources, and without external forces, these processes will never be pushed forward.

Process Synchronization
A process in which a set of concurrent processes executes in a certain order is known as inter-process synchronization. A set of concurrent processes that have a synchronization relationship is called a cooperative process, and the signals that are sent between the cooperating processes are called messages or events.

Process Scheduling
Concept: Select one of the running processes from a set of algorithms to occupy the CPU.

Dispatch Mode
Non-preemptive: The dispatcher assigns the processor to another process once it has been assigned to a process and keeps it running until it is known that the process is complete or has been blocked for some time.

Preemptive: When a process is running, the system can, based on some principle, deprive the processor that has been assigned to it and distribute it to other processes. The principle of deprivation is: priority principle, short process priority principle, time slice principle.

Scheduling Algorithm
Scheduling in the operating system refers to a resource allocation, and thus the scheduling algorithm refers to the resource allocation algorithm according to the system resource allocation policy. For different system and system targets, we usually use different scheduling algorithms, for example, in batch processing system, in order to take care of a large number of segments, a short job first scheduling algorithm should be used, and in time-sharing system, in order to ensure that the system has reasonable response times, the rotation method should be used for scheduling. There are many scheduling algorithms, some algorithms are suitable for job scheduling, and some algorithms are suitable for process scheduling, but some scheduling algorithms can be used for job scheduling as well as for process scheduling.

First of all, the service scheduling algorithm: Assign the CPU according to the order of job submission or process becoming ready state, the current job or process consumes CPU, until after execution or blocking, the CPU (non-preemption mode). After a job or process wakes up (such as I/O completion), it does not immediately resume execution, usually until the current job or process has transferred the CPU.

Short process priority scheduling algorithm: The algorithm selects the next "CPU execution period shortest" process from the ready queue and assigns the processor to it.

High priority priority scheduling algorithm: gives the process a certain priority, one at a time from the highest priority element and executes.

Time slice Rotation: each process is given a running time slice, and when the time slice is taken, an element is removed.

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

Fundamentals of Linux Process Control theory

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.