Operating system interrupts, exceptions, system calls

//Interrupt:
*Hardware:
Set the interrupt flag (CPU initialization)
1. Set the interrupt flag for internal and external events
2. Interrupt event ID
* Software:
1. Save the current processing state
2. Clear the interrupt flag
3. Restore the previously saved Processing status
// Exception: Exception number
1. Save site
2. Exception handling
* Kill the program that generated the exception
* Re-execute the instruction that generated the exception
3. Restore the site
// System call:
1. Program access is through a high-level API interface , Instead of directly making system calls
//Usually, the sequence number associated with each system call, the system call interface maintains the index of the table according to these sequence numbers

//System call interface, call the expected system call in the kernel mode, and return the status of the system call and any other return values

//Users don’t need to know how to implement the system call, they only need to obtain the API and understand what the new system will return as a result.
Most of the details of the operating system interface are hidden in the API and managed by the library supported by the running program (using Contains the library of the compiler to create the function set)

//The cost of crossing the operating system boundary
1. The cost of execution time exceeds the program call
2. The cost:
*The initialization cost of
establishing the mapping relationship between the interrupt/exception/system call number and the corresponding service routine *Establishing the kernel stack
*Verifying parameters
* The kernel mode is mapped to the address space of the user mode, and the page mapping permissions are updated
*Kernel mode independent address space
*CacheTLB

Guess you like

Origin blog.csdn.net/Vodka688/article/details/113925941