Tag Info

Hot answers tagged

19

Here's a high-level view of the low-level processing. I'm describing a simple typical architecture, real architectures can be more complex or differ in ways that don't matter at this level of detail. When an interrupt occurs, the processor looks if interrupts are masked. If they are, nothing happens until they are unmasked. When interrupts become unmasked, ...


10

A hardware interrupt is not really part of CPU multitasking, but may drive it. Hardware interrupts are issued by hardware devices like disk, network cards, keyboards, clocks, etc. Each device or set of devices will have its own IRQ (Interrupt ReQuest) line. Based on the IRQ the CPU will dispatch the request to the appropriate hardware driver. (Hardware ...


10

In simple terms, you can think of make as having a (possibly large) number of steps, where each step takes a number of files as input and creates one file as output. A step might be "compile file.c to file.o" or "use ld to link main.o and file.o into program". If you interrupt make with CtrlC, then the currently executing step will be terminated which will ...


9

This is covered in chapter 10 of Linux Device Drivers, 3rd edition, by Corbet et al. It is available for free online, or you may toss some shekels O'Reilly's way for dead tree or ebook forms. The part relevant to your question begins on page 278 in the first link. For what it's worth, here is my attempt to paraphrase those three pages, plus other bits I've ...


8

Gilles already described the general case of an interrupt, the following applies specifically to Linux 2.6 on an Intel architecture (part of this is also based on Intel's specifications). An interrupt is an event that changes the sequence of instructions executed by the processor. There are two different kinds of interrupts: Synchronous interrupt ...


7

All modern operating systems support multitasking. This means that the system is able to execute multiple processes at the same time; either in pseudo-parallel (when only one CPU is available) or nowadays with multi-core CPUs being common in parallel (one task/core). Let's take the simpler case of only one CPU being available. This means that if you ...


7

Ctrl+C causes a SIGINT to be sent to the process running. This signal can be caught by the process. In the make source code you can find a trap for this signal in commands.c: /* If we got a signal that means the user wanted to kill make, remove pending targets. */ if (sig == SIGTERM || sig == SIGINT ... remove childrens ... /* Delete any ...


5

watch -n0.1 --no-title cat /proc/interrupts


5

System calls, messaging passing (as described in the Wikipedia article), and interrupts are all things that cause a context switch or a switch from user to kernel mode. As you likely know: kernel mode: programs have a flat or real view of memory, and programs can read/write freely to all memory and all hardware devices directly without restriction. user ...


4

Interrupts are handled by the operating system, threads (or processes, for that matter) aren't even aware of them. In the scenario you paint: Your thread issues a read() system call; the kernel gets the request, realizes that the thread won't do anything until data arrives (blocking call), so the thread is blocked. Kernel allocates space for buffers (if ...


4

System calls can be interrupted through the use of signals, such as SIGINT (generated by CTRL+C), SIGHUP, etc. You can only interrupt them by interacting with the system calls through a PID, however when using Unix signals and the kill command. rt_patch & system calls @Alan asked the following follow-up question: Is the possibility to interrupt ...


3

Message passing is a higher level concept of one process sending a message to another. It is implemented by a system ( kernel ) call, asking the kernel to pass the message to the other process. System calls ask the kernel to perform various services for the process. They are implemented by a software interrupt / system trap, which causes the cpu to save ...


3

The Linux kernel is reentrant (like all UNIX ones), which simply means that multiple processes can be executed by the CPU. He doesn't have to wait till a disk access read is handled by the deadly slow HDD controller, the CPU can process some other stuff until the disk access is finished (which itself will trigger an interrupt if so). Generally, an interrupt ...


3

As of today, you can mostly forget about the SA_INTERRUPT flag. In between 2.6.18 and 2.6.24 it was just a migration helper for the new IRQF_DISABLED flag. 2.6.24 removed all SA_* flags and replaced them with IRQF_* flags. 2.6.35 marked this "new" flag as deprecated. If you have a kernel before 2.6.18, you'll probably won't use it (see Justin's answer). ...


3

I can try to trap the Interrupt at a lower level and inform the gtkmm application. No, that is a kernel space activity. Fortunately, the kernel does report the outcome of certain events via interfaces accessible from userland. It's a little ambiguous in your question whether you want to detect when a block device is attached, or when a filesystem is ...


3

The Unix V7 ed(1) source code is a primitive 1,762-line C program with just a few comments, one of which is this highly-enlightening header comment: /* * Editor */ Given that the source code itself does not provide any rationale, you're only going to get it from the program's author. ed was originally written by Ken Thompson in PDP-11 assembly, but ...


3

Ctrl+C sends SIGINT. The conventional action for SIGINT is to return to a program's toplevel loop, cancelling the current command and entering a mode where the program waits for the next command. Only non-interactive programs are supposed to die from SIGINT. So it's natural that Ctrl+C doesn't kill ed, but causes it to return to its toplevel loop. Ctrl+C ...


2

There is a good write up here: Older versions of the Linux kernel took great pains to distinguish between "fast" and "slow" interrupts. Fast interrupts were those that could be handled very quickly, whereas handling slow interrupts took significantly longer. Slow interrupts could be sufficiently demanding of the processor, and it was worthwhile to ...


2

From the kernel documentation: nointremap [X86-64, Intel-IOMMU] Do not enable interrupt remapping. [Deprecated - use intremap=off] For information about IOMMU, have a look at the Wikipedia page.


2

The timer ISR doesn't call schedule() directly. It ends up calling update_process_times() so the scheduler process accounting information is up to date. The scheduler is eventually called when returning to userspace. If the kernel is preemptive, it is also called when returning from the timer interrupt to kernelspace. As an example, imagine a process A ...


2

Linux provides two mechanism for monitoring file system events; dnotify and inotify. The older of the two, dnotify, was introduced in kernel version 2.4.0. It allows applications to register to receive notifications on changes in a directory via the fcntl() interface. The notifications themselves are delivered via signals. The dnotify mechanism is limited ...


2

I don't think it's possible to receive a signal on a file change. However inotify, https://en.wikipedia.org/wiki/Inotify, should allow you to write a program that receives events as a file changes. This site has a good write up about inotify: http://www.win.tue.nl/~aeb/linux/lk/lk-12.html. It also has a sample example that monitors events in the current ...


2

For example the 82093AA IO-APIC has I/O redirection table registers (IOREDTBL) which have a writeable bit specifying the trigger mode (which can be level or edge sensitive). These registers seem to be reflected by struct IO_APIC_route_entry in the kernel source. Digging a bit through the 2.6.18 kernel source, one comes across a function ...


2

As with any performance tuning there are no absolute rules. Due to the nature of it, there are a few rules that you can make with sufficient qualification but only a few. So bear that in mind. How you should control for hardware interrupts really depends on how your workload behaves For your question, you also have to control where the interrupts are sent. ...


2

Normally, the NIC will only interrupt the CPU if it needs to send the received packet to the system. In non-promiscuous mode, this would only be for packets addressed to its MAC address, the broadcast address ff:ff:ff:ff:ff:ff, or a multicast address to which it has been subscribed. It also does validation before sending the packet to the CPU: the normal ...


1

The words "good documentation" is very abstract. IMHO, I have some links for you: http://www.xml.com/ldd/chapter/book/ch09.html http://www.cs.columbia.edu/~krj/os/lectures/L07-LinuxEvents.pdf http://www.tldp.org/LDP/tlk/dd/interrupts.html


1

Seems like a fairly easy issue to resolve, I would just run top or htop and see what process is consuming resources during one of these boundaries between the 15 minute windows where you're seeing the issue crop up. You can also use a tool like nethogs to identify which process is consuming the most network resources. Example To monitor my wireless ...


1

How fast can you type? ;-) Both USB and network are easy ways to generate interrupts: if you have a USB audio or video device, recording might to the trick use ping -f or a TCP or UDP flood tool, e.g. (tcpflood If you have the equipment and a suitable kernel, a square-wave generator hooked up to one of the GPIO ports should work too. You might also be ...


1

Of course interrupts can interrupt system calls, unless an appropriate spinlock is taken, or interrupts are disabled in some other way: spin_lock_irq*() gets a spinlock and disables hardware interrupts (and, consequently, also software interrupt and tasklet processing). spin_lock_bh() gets a spinlock and disables software interrupt and tasklet processing. ...


1

The systemtap stuff is supposed to let you drill down into the kernel, and lately also applications, for tracing, troubleshooting, and debugging. Haven't used it myself. High interrupt traffic for high network traffic might be due to less-than-bright network card or driver, perhaps a higer-end card gives better results. The kernel's handling of networking ...



Only top voted, non community-wiki answers of a minimum length are eligible