Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Process mastery: process creation, termination, congestion, wake-up call and switching

2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

The secondary function of process mastery is to implement ineffective governance over all processes in fragmentation. It has functions such as creating new processes, revoking existing processes, and completing process form conversion. In the operating system, the program segment for process control is commonly called primitive, which is characterized by no infix during the performance period and is a basic unit of non-connection.

process creation

Allow one process to create another. The creator is called the parent process, and the created process is called the child process. A child process can inherit capital from its parent process. When a child process is withdrawn, it should lend to the parent the capital it has taken from the parent process. In addition, when you undo a parent process, you must undo all of its child processes at the same time.

In the operation system, end-user login system, homework adjustment, system service, user program use request, etc. all cause process creation. The process of creating a new process by operating the fragment is as follows (creation primitive):

Assign a unique process ID to the new process and request a blank PCB(PCBs are infinite). If PCB request fails, create failure.

Allocate capital for the process, allocate memory space (represented in PCB) needed for the program and data for the new process, and for the user stack. Note that if there is a shortage of capital (e.g., memory space), it is not the creation of failure, but in the "waiting mode," or "congestion mode," waiting for the memory of this capital.

The initialization PCB mainly contains initialization mark information, initialization handler form information, initialization handler master information, and priority of setting process.

If the new process can be retrieved from the process stall queue, the new process is pulled out of the stall queue and waits to be transferred.

its termination

The next things that cause process termination are: normal completion, performance of process obligations completed and ready to join operation. Exception completion refers to the process in operation, occurred some abnormal things, so that the program can not continue to run, such as memory area out of bounds, maintenance errors, legal instructions, privileged instructions wrong, I/O problems, etc. External interference refers to the termination of a process in response to external requests, such as operator or operator piecemeal interference, parent process requests, and parent process termination.

The process of manipulating the piecemeal termination process is as follows (Undo primitive):

According to the identifier of the terminated process, the PCB is retrieved and the form of the process is read from it.

If the terminated process is in the performance state, immediately terminate the performance of the process and allocate the disposal capital to other processes.

If the process has sub-processes, all sub-processes should be terminated.

The entire capital possessed by the process is lent either to its parent process or to the operating fragment.

Remove the PCB from the site queue (linked list).

Process congestion and wake-up calls

The process of being performed, because some things waiting have not occurred, such as requesting piecemeal capital failure, waiting for the completion of some operation, new data has not yet arrived or no new task to do, etc., then the piecemeal initiative to perform the congestion primitive (Block), so that I change from the operating state to the congestion state. It can be seen that congestion of a process is an automatic action of the process itself, and therefore only the process in operation (acquiring CPU) can be transformed into congestion.

The performance process of congestion primitives is:

Find the PCB corresponding to the identification number of the process to be congested.

If the process is in operation mode, maintain its site, change its mode to congestion mode, and stop operation.

Pull the PCB out of the queue for responding to events.

When the event for which a congested process is waiting appears, if the I/O operation it initiated has completed or the data it is waiting for has arrived, a wakeup primitive is appropriated by the process concerned (e.g., the process supplying the data) to wake up the process waiting for the event.

The fulfillment process of the wake-up primitive is:

Find the PCB for the response process in the waiting queue for this event.

Remove it from the waiting queue and place it in a suspended state.

Pull the PCB out of the queue and wait for the adjustment procedure.

It is important to note that Block primitives and Wakeup primitives are a pair of primitives that have opposite effects and must be used in pairs. Block primitives are self-appropriated by a congested process, while Wakeup primitives are self-appropriated by a process that cooperates with the awakened process or by another related process.

process switches

As for the daily process, its creation, revocation, and request I/O operations completed by fragmentary equipment are mostly applied to piecemeal appropriation into the kernel and then completed by the response handler in the kernel. Process switching is typically done under the support of the kernel, so it can be said that any process is mostly run under the support of the operating kernel, and is closely related to the kernel.

Process switching refers to the process machine from one process operation to another process operation, this process, the operation of the process has undergone a fundamental change.

The process of switching is as follows:

Keeper handler context, containing program counters and other storage.

Update PCB information.

Move PCBs of processes into queues for responses, such as stops, congestion at something, etc.

Select another process to perform and update its PCB.

Update data constructs for memory governance.

Restore handler context.

Note that process switching and processor form switching are divergent, and the processor can logically operate in a unified process when the form is switched. If the process due to infix or exception into the state of mind operation, after the completion of the process and return to the user state has just been infixed program operation, then the operation of piecemeal only to restore the process into the kernel when the preservation of the CPU site, do not need to change the process after the situation information. However, if the process is to be switched, the operation process will be changed later, and the information of the later process will also need to be changed.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report