| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
Hhmmm. Interesting. I wonder just what's to review? I would prefer to use Posix semaphores for reasons of code portability, and stay away from dependencies on mach. Named Posix semaphores will get the job done -- it's just that you have to avoid name collisions with multiple processes etc etc.
I'm not complaining about named ones -- if you were only doing one or other this would certainly be the better choice. I'm just puzzled that, having done the harder one (named), the easier one (memory) isn't there.
If you ignore the fact that they can be (and often are) shared between processes, the memory-based POSIX semaphores are (somewhat) easier. But if you need to support both shared and non-shared ones, and want a consistent implementation, they are much trickier.
Why? Because the memory ones don't have a nice handle, like the named ones do, to hold references to the underlying synchronizer. You have to tie the reference to the memory itself, somehow. This is something that, given the split between BSD and Mach virtual memory within the kernel, we didn't have support for. It effects lots of little things: like the way copy-on-write must behave for the memory once you initialize a semaphore in it, using (64-bit) offsets instead of addresses in the synchronization logic (because each process can share it at different addresses, or even one process may have it mapped in multiple places, so you have to use file/memory object offsets instead of addresses), etc...
We have the underlying support now (much - but not all - went into Panther/Darwin 7) and we know this is a glaring omission. Does anything else need to be said? ;-)
--Jim_______________________________________________
| References: | |
| >stabs common symbols relocation (From: Jonas Maebe <email@hidden>) | |
| >semaphores in Darwin (From: Peter Lovell <email@hidden>) | |
| >Re: semaphores in Darwin (From: David Leimbach <email@hidden>) | |
| >Re(4): semaphores in Darwin (From: Peter Lovell <email@hidden>) | |
| >Re: Re(4): semaphores in Darwin (From: Jim Magee <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.