Asynchronous event handling mechanism: the context and flow of execution

First, asynchronous event handling mechanism

1, the event queue mechanism

2, interrupt mechanism

 

Second, abnormal, and asynchronous execution flow

1, an exception:

After switching to a new anomaly is execution flow, no longer stored original execution flow.

2, asynchronous:

Asynchronous execution is switching to a new flow, then switch to a finished original execution flow.

 

Third, the two core:

1. Context:

Context save execution flow (order); context is a description of the structure of the execution flow information.

2, execution:

Execution logic.

 

Fourth, the processing mechanism and thread

1, the thread event loop:

The context of the new execution flow of a message, the incoming message queue of the distribution;

2, interrupted

The original implementation of streamlined text saved by the interrupt stack.

Implementation of the new instruction stream.

After the implementation of switching to the original interrupt stack.

 

 

Five other supplements

Linux There are several stacks? Various stack memory location?

After describes the principles and purposes finished stack effect, we return to the Linux kernel up. The kernel stack is divided into four categories:

  • Process stack
  • Thread stacks
  • The kernel stack
  • Interrupt stack

 

Fourth, the interrupt stack

Process into kernel mode, the need to support the kernel stack kernel function calls. Interrupt, too, when the system receives an interrupt event, interrupt handling, also we need to support interrupt stack function calls. Because when the system is interrupted, of course, the system is in kernel mode, the interrupt stack and kernel stack can be shared. However, whether or shared, and it is closely related to the specific processing architecture.

 

https://blog.csdn.net/yangkuanqaz85988/article/details/52403726

 

Guess you like

Origin www.cnblogs.com/feng9exe/p/11726240.html