Re: "Aiee: scheduling in interrupt 00111dd2" problem

Richard B. Johnson (root@chaos.analogic.com)
Fri, 18 Dec 1998 08:51:53 -0500 (EST)


On Fri, 18 Dec 1998, Foo Chun Choong wrote:

> Am I right to say that the locking structures are mainly used to prevent
> race conditions. Why does the kernel hang when some of these are broken?
>

Observe a typical linked-list operation when the list in increasing in
size (length) ....

link = memory_from_somewhere();
link->next = NULL;

Now, look while it is decreasing in size...

while(link != NULL) {
save_next = link->next;
memory_from_somewhere_free(link); /* (A) */
link = save_next; /* (B) */
}

If another "thread" were to access ``link'' between A and B, it
would be accessing invalid memory. If the first procedure was
executing and didn't finish, before the next procedure was executed,
all bets are off. This is a typical problem with multitasking, not
just SMP. Some operations must complete before others are allowed.

This if often called a "race" condition when, in fact it's no race
at all, it's a "crash" condition, pure and simple.

Cheers,
Dick Johnson
***** FILE SYSTEM WAS MODIFIED *****
Penguin : Linux version 2.1.131 on an i686 machine (400.59 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/