POV-Ray : Newsgroups : povray.off-topic : Tell me it isn't so! : Re: Tell me it isn't C Server Time
6 Sep 2024 15:17:49 EDT (-0400)
  Re: Tell me it isn't C  
From: Darren New
Date: 28 Jul 2009 23:57:25
Message: <4a6fc8a5$1@news.povray.org>
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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.