Re: kernel question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Nov 23, 2002 at 03:58:44AM -0800, earl wrote:
> What does it mean when one says that a
> "kernel is interruptible but not reentrant"?

A process running in the kernel can be pre-empted by an interrupt
handler whenever an interrupt occurs and interrupts are not currently
blocked. (cli()/sti() and friends.) (This happens whether or not the
pre-empt kernel patch has been applied.)

However, I'm not sure about the part of the statement that says, "not
reentrant". Re-entrancy is normally when a specific function is called
and, while running, gets blocked or pushed to the side in some fashion
for another task to run -- which needs to run the same function.

(A classic example of a function that is not re-entrant is strtok(3)
from the standard C library; it uses a static variable internally,
limiting an address space to running only one strtok(3) function at a
time. A multithreaded application would need to use strtok_r(3) instead,
which does not use static storage.)

So, kernel functions that use static or otherwise global storage are not
re-entrant unless they have been programmed with care to be re-entrant.
Considering that most linux kernels are designed to run on SMP systems,
I'm not sure if the sentence as a whole is true. But that is for smarter
people to answer. :)

-- 
It seems the power has been robbed from the founding fathers and is now
firmly in the hand of the funding fathers -- Rik van Riel

Attachment: pgp00220.pgp
Description: PGP signature


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux