|
 |
Nicolas Alvarez wrote:
> Darren New wrote:
>> I've always wondered why people think C is good for writing kernel-level
>> code, as the only facility in C that actually deals with the sorts of
>> things you do in a kernel is "volatile".
>
> http://www.mjmwired.net/kernel/Documentation/volatile-considered-harmful.txt
That's why Ada distinguishes volatile, atomic, and "protected" (which means
basically critical section/monitor/atomic/Java-synchronized). Using
"volatile" to mean "other CPUs can modify this" isn't what it's for in C.
It's for hardware modifications, like status registers, not something you
can lock other CPUs running kernel code against.
"The spinlock primitives act as memory barriers" unless the shared data
structure is a UART status register.
--
Darren New, San Diego CA, USA (PST)
"We'd like you to back-port all the changes in 2.0
back to version 1.0."
"We've done that already. We call it 2.0."
Post a reply to this message
|
 |