8th. Abnormal control Flow

Source: Internet
Author: User

8th. Abnormal control Flow

Control transfer sequence is called the control flow of the processor

Modern systems react to these situations by causing mutations in the control flow, known as Anomaly Control flows (ECF). The exception control flow occurs at all levels of the operating system.

8.1 Exceptions

Exceptions are a form of exception control flow, partially implemented by hardware, and partly by the operating system.

An exception is a mutation in the control flow that responds to certain changes in the processor state. In a processor, a state change is called an event.

In any case, when the processor detects that an event occurs, he makes an indirect procedure call (exception) through a jump table called the exception table, to an operating system subroutine (exception handler) specifically designed to handle such events.

8.1.1 Exception Handling

Each of the possible types of exceptions in the system is assigned the exception number of a unique non-negative integer . at system startup, the operating system allocates and initializes a jump table called the exception table so that the entry k contains the address of the handler for the exception K.

The exception number is the index to the exception table, and the starting address of the exception table is placed in a special CPU register called the exception table base register.

Exceptions are similar to procedure calls, but there are some important differences.

If an exception is interrupted by a user program, the state reverts to user mode .

Categories of 8.1.2 Exceptions

Exceptions can be categorized into four categories: interrupts, traps, failures, and terminations.

1. Interrupt

Interrupts occur asynchronously and are the result of a signal from an I/O device outside the processor.

The exception handlers for hardware interrupts are often referred to as interrupt handlers .

2. Traps and system calls

Traps are intentional exceptions and are the result of executing an instruction. The trap handler returns control to the next instruction. The most important use of traps is to provide a process-like interface between the user program and the kernel, called a system call .

3. Fault

The fault is caused by an error condition and may be corrected by a faulty program. When a failure occurs, the processor transfers control to the handler. If the handler is able to fix the error, it will control the return of the instruction that caused the failure and re-execute it.

4. Terminate

Termination is the result of an unrecoverable fatal error, usually a hardware error.

8.1.3 exceptions in the LINUX/IA32 system

1. LINUX/IA32 Failure and termination

L Division Error

L General Protection failure

L pages

L Machine Check

2. LINUX/IA32 system Call

8.2 Process

The classic definition of a process is an instance of an executing program. Each program in the system is running in the context of a process.

We will focus on the key abstractions that the process provides to the application:

8.2.1 Logic Control Flow

If you want to step into the program with the debugger, we see a series of values for the program counter (PC) that uniquely correspond to the instructions contained in the executable target file of the program, or to a shared object that is dynamically linked to the program at run time. The sequence of this PC value is called a logical control flow , or simply a logical stream .

8.2.2 Concurrent Streams

The execution of one logical flow overlaps with another stream in time, called a concurrent stream, which is known to run concurrently.

Multiple streams perform common phenomena concurrently, called concurrency. A process and other processes running concepts in turn are called multi-tasking. A process performs a part of his control flow for each time period called the time slice. Multitasking is also called time slicing.

If two streams run concurrently on a different processor core, or

8th. Abnormal control Flow

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.