Re: Macros for Spinlocks, Mutexes, Semaphores, etc
- From: "randyhyde@xxxxxxxxxxxxx" <randyhyde@xxxxxxxxxxxxx>
- Date: 5 Sep 2005 20:09:36 -0700
Chewy...@xxxxxxxxxxxxxxxx wrote:
>
> For my own OS...
>
> Essentially I want to add 'spinlock', 'mutex' and 'semaphore' type
> keywords to B0 (the language I am working on), for OS development work.
It's expensive (get it used!), but I'd suggest grabbing a copy of this:
http://www.amazon.com/exec/obidos/tg/detail/-/0471694665/qid=1125975976/sr=1-1/ref=sr_1_1/104-8961450-1232737?v=glance&s=books
> PS. For most OS's wouldn't the following be appropriate for threaded
> apps:
>
> ; Spinlock:
No, spinlocks are reasonable only in a few places, such as in interrupt
handlers and other kernel routines where blocking is not reasonable.
Applications should almost always block, not spinlock. Mutexes,
semphores, events, and monitors (as provided by the OS) generally put a
thread or process on a queue until the event that they are waiting for
occurs (that is, the thread/process is *blocked*) and then puts them
back on the run queue when the thing they are waiting on occurs.
Cheers,
Randy Hyde
.
- Follow-Ups:
- Re: Macros for Spinlocks, Mutexes, Semaphores, etc
- From: Chewy509
- Re: Macros for Spinlocks, Mutexes, Semaphores, etc
- References:
- Macros for Spinlocks, Mutexes, Semaphores, etc
- From: Chewy509
- Re: Macros for Spinlocks, Mutexes, Semaphores, etc
- From: hutch--
- Re: Macros for Spinlocks, Mutexes, Semaphores, etc
- From: Chewy509
- Macros for Spinlocks, Mutexes, Semaphores, etc
- Prev by Date: Re: Macros for Spinlocks, Mutexes, Semaphores, etc
- Next by Date: Re: Macros for Spinlocks, Mutexes, Semaphores, etc
- Previous by thread: Re: Macros for Spinlocks, Mutexes, Semaphores, etc
- Next by thread: Re: Macros for Spinlocks, Mutexes, Semaphores, etc
- Index(es):
Relevant Pages
|