wrote:
> On Apr 6, 11:44 am, Joe Seigh <jseigh...@xemaps.com> wrote:
>
>>Here's a port of a fast pathed semaphore I did elsewhere. It
>>only does single permit acquire and release.
>
>
[...]
> So my question is simple: what do semaphores (and fast
> semaphores) bring to Java that wasn't available before?
Semaphores are just another synchronization primative. They're
not as widely applicable as locks and condition variables but
when you do run into a situation where they're useful, they're
nice to have. Semaphores are useful for limiting the number of
threads accessing a resource. They work well for producer/consumer
sometimes although they don't address thread safety of the queue
itself. Other synchronization primatives are barriers (already in
1.5) and eventcounts which aren't in Java.
>
> IOW, what can Java we do now in Java 1.5 that we couldn't
> do in Java 1.4?
Nothing, but it's more of a question of efficiency and being
able to use more "natural" design patterns associated with the
synchronization primative in question.
>
> Is it "simply" efficiency (which of course is very important),
> or are there other benefits that are also very important?
>
> Is it possible to write correct multi-threaded Java programs
> without using semaphores?
It better be.

>
> Thanks in advance for any infos,
--
Joe Seigh
When you get lemons, you make lemonade.
When you get hardware, you make software.