nathan
nathan

Reputation: 844

atomic context and process context/interrupt context

in Linux Device Driver3 and Understanding the Linux Kernel. Some buzzword appear many times without definition

process context: referenced in both books, but no definitions

interrupt context: Understanding the Linux Kernel gives definition

atomic context: only appear in LDD3 and without definition. "it specifies that the kernel is currently executing either an interrupt handler or a deferrable function"

when reading tutorial, these three buzzword are referenced by many things. So I think the most important thing is to try figure out the exact definition, then I can understand those references.

I also did some search online, no very clear sources.Could any one gives good definition and the source of that definition? Thanks so much

Upvotes: 3

Views: 2794

Answers (2)

livinston
livinston

Reputation: 1338

This article gives an excellent explanation. Let me summarize it here:

  1. Process Context - Regular processes and syscall invocations execute in this context and it can be interrupted by IRQs
  2. Atomic Context - IRQs are generally executed in this context and they don't belong to any specific process, but rather are invoked by some device(ignore exceptions for simplicity). Once the interrupt context sleeps or gives up the CPU, it cannot be awakened. So it is also called atomic context.

A basic principle of the kernel is that in an interrupt or atomic context, the kernel cannot access user space, and the kernel cannot sleep.

Quoting from the book Linux Kernel Programming by Kaiwan N Billimoria: enter image description here

Upvotes: 4

Tony Tannous
Tony Tannous

Reputation: 14866

Process context is the values of the registers. When a context switch occurs, one process is put off, the content of the registers is saved, so that when the proccess runs again, you can continue running from the same spot. Stack pointer, instruction pointer and so on.

Upvotes: 2

Related Questions