* old_regs = set_irq_regs (struct pt_regs *) regs );Irq_enter ();_ Do_irq (IRQ );Irq_exit ();Set_irq_regs (old_regs );Return 1;}It can be seen from the do_irq () function that when hard interrupt _ do_irq (IRQ) is executed, the irq_exit () function is executed,* Exit an interrupt context. Process softirqs if needed and possible:*/Void irq_exit (void){Account_system_vtime (current );Trace_hardirq_exit ();Sub_preempt_count (irq_exit_offset );If (! In_interrupt () local_softirq_pending () // you
program to handle the interruption.3. In ISR, the interrupt control register is read and the peripheral registers are used to identify the interrupt and process the interrupt accordingly.4. Clear interruption: Read and Write related interrupt control registers and peripheral related registers are implemented.5. It is best to restore the environment of the interrupted program and continue execution.Key interrupt program process:Initialization1. Set the port corresponding to the key to interrupt
Linux system programming (23)-signal blocking, linux23
The processing action of the actually executed signal is called the Delivery, the State between the signal generation and the Delivery, and the Pending ). A process can Block a signal. When a blocked signal is generated, it remains in the pending state until the process unblocks the signal. Note that blocking and ignoring are different. As long as the
Implementation and use of Linux kernel signals
Send some things that you have written before and learn from them.
1, basic data structure
* Linux Signal number structure
In-depth understanding of the 3rd edition of the Linux kernel, the "signals" chapter of the figure
{Task_struct} [...] [Signal]------------------------------[sighand][blocked][real_balocked][saved_sigmask][pending][notifier][ Notifier_mask][...]
* Signal processing data structure
colleagues on different CPUs.In general, there are four actions that can be performed on a deferred function:Initialize (initialization): Defines a new deferred function, which is usually done when the kernel itself initializes or loads the module.Activation (activation): marks a deferred function as "pending" (executed in the next round of scheduling of the deferred function). Activation can be done at any time (even if the interrupt is being proces
All threads share the same signal processing methodThe main thread sets the processing mode of the SIGINT signal in order to capture, then all the secondary threads share this processing, and if one of the threads changes the way the signal is processed, then all the threads will share the change.Recalling "signal shielding word" and "pending signal word"Role"Signal shielding word" and "pending signal word"
the default processing action of the signal is to terminate the current process.
The program will keep counting in 1 seconds and print the counter, and 1 seconds will be signaled SIGALRM . Because of the computer configuration and so on, each computer in a second counted the number is different generally is different.
#include
alarmThe return value of the function is 0 or the time remaining for the alarm clock was last set.
Blocking signal
1. Signal in the kernel of the exp
the ev_watcher struct can be considered as the base class for all ev_type structures, which contains the same fields in all Ev_type.
These structures are defined in the code as follows, and I have restored some of the macros for ease of understanding. Only partial macros are restored, not all, because these macros embody the idea of the author designing these structures.
Related macros
1
2
3
4
5
6
7
8
9
17
This macro defines all parts of the Ev_type beginning
#define Ev_watcher
used by MySQL is the following principle:* If there is no write lock on the table, put a read lock on it.* Otherwise, the lock request is placed in the read lock queue.When a lock is released, the lock can be obtained by the thread in the write lock queue, and then the thread in the lock queue is read. This means that if you have many updates on a table, the SELECT statement waits until there are no more updates.In MySQL, these two locks are maintained mainly through four queues: two hold the r
(unsigned int seconds), call alarm function can set an alarm, is to tell the kernel in senconds seconds to send the current process SIGALRM signal, the default action is to terminate the current process, The return value of the function is 0 or the number of seconds remaining for the previously set alarm time.
Third, the way to deal with the signal
① Ignore this signal
② the default processing action for performing signals, typically terminating a process
③ Capture Signal
Iv. recursion and b
, which is to create signal set function, set signal shielding function and signal function that query is shelved (pending). Creating a signal set function simply creates a collection of signals, sets the signal shield function to mask the signals in the specified signal set, and queries the used signal function to query the current "pending" signal set. The signal Set function group is not able to complete
executed serially, meaning that the same type of tasklet cannot be run concurrently on two CPUs. However, different types of tasklet can be run concurrently on different CPUs. Because of this feature of Tasklet, functions in Tasklet do not have to be reentrant. In general, there are several things that can be deferred functions:Initialization: Defines a new, deferred function. Typically this work is done during kernel initialization or when the module is loaded. Activation: marks a delay functi
after the Inventory module accounting period, Because the Inventory module sales out of the library needs to be transferred to the AR Invoice Interface table, N5, asset module Accounting period must be closed after the Purchase module and Inventory Module accounting period, because the fixed asset information or data may be derived from the Inventory module and procurement module; N6, the fiscal period for all submodules is closed, and the general ledger accounting period is closed.II. detailed
two. In addition, page-level locks are the same as row-level locks, causing deadlocks.
In the process of locking resources in a database, as the granularity of locked resources decreases, the amount of memory required to lock data of the same data volume is increasing, and the implementation algorithms become more and more complex. However, as the granularity of locked resources decreases, the possibility of Lock wait for access requests of applications also decreases, and the overall concurren
processingfunction _ _do_softirq is a one-time processing of all soft interrupts (subtext, soft interrupts not nested) from high to low in the vector table_ _do_softirq () Call timing:1. Irq_exit () hardware interrupt is finished, call on return
DO_IRQ ()-->irq_exit ()
-->local_softirq_pending ()
-->_ _DO_SOFTIRQ ()
2. KSOFTIRQD () is used to assist the kernel thread that handles soft interrupts, and a KSOFTIRQD is running on each of the CPUs.
Start_kernel ()-K
I don't know if you remember the concept of blocking and pending signal sets in the process of signal processing, if you have forgotten, please refer to the "blocking signal and pending signal" in the article. 1. The signal in the multithread program
In multiple threads, each thread has its own set of blocked and pending signals. When one thread derives another t
;setup_policy(do_clear_all_soft_refs); } else { // collect() below will enable discovery as appropriate }
(6). gc is completed by memory generation
_gens[i]->collect(full, do_clear_all_soft_refs, size, is_tlab);
(7) add inaccessible Reference objects to the pending linked list of the Reference
if (!rp->enqueuing_is_done()) { rp->enqueue_discovered_references(); } else { rp->set_enqueuing_is_d
by one.
SIGSTOP pause Program Execution
SIGCONT Recovery Program Execution
3.1 process Signal Processing
A process can set a separate processing method for each signal. It can ignore the signal, set its own signal processing program (called capture), or do nothing about the signal, execute the default system action when the signal occurs.
The process can also set blocks for certain signals. If a signal is set to be blocked, it will be delivered to the process like a normal signal when the signa
). Shared:In this status, the database can be read but cannot be written. At the same time, there can be any number of processes holding shared locks on the same database, so read operations are concurrent. In other words, as long as one or more shared locks are active, database file write operations are no longer allowed.3). Reserved:If a Process intends to perform write operations in the current database at a certain time in the future, but only reads data from the database, we can simply unde
above, the following signals are used in this article, and others are not listed one by one.
Sigstop pause Program Execution
Sigcont Recovery Program Execution
3.1 process Signal ProcessingA process can set a separate processing method for each signal. It can ignore the signal, set its own signal processing program (called capture), or do nothing about the signal, execute the default system action when the signal occurs.
The process can also set blocks for certain signals. If a signal is set to
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.