Re: Question about vZOOM reference handling
- From: Joe Seigh <jseigh_01@xxxxxxxxxx>
- Date: Tue, 05 Jun 2007 21:51:37 -0400
Dmitriy Vyukov wrote:
On Jun 5, 2:17 pm, Dmitriy Vyukov <dvyu...@xxxxxxxxx> wrote:
One more question.
Consider next situation. Message-passing system. Producer creates
message. Then producer put this message to two different producer-
consumer message queues which go to two different consumer threads.
When message will be consumed by both threads, it must be deleted.
Can vZOOM handle lifetime management of the message?
It seems for me that the answer will be NO.
If you can use a multi-tailed fifo queue instead of 2 different
queues. Make the queue backward linked and use PDR to keep
track of when to free the nodes. The readers will be lock-free.
As far as I see vZOOM can handle only "weak" references, and for
"strong" references one must use reference-counting anyway.
Another situation.
Graph structure where to node can point several other nodes. And this
links are removed not all at once by one thread, but one by one by
different threads.
Can vZOOM handle lifetime management of the node in graph?
It seems that threads that remove links to node must use reference-
counting. But vZOOM still can be used here for readers.
Am I right?
vZOOM and other forms of PDR are mainly useful in read lock-free
reader/writer solutions. Writers can be lock-free as long as you
have some form of multi-word compare and swap. Usually it's easier
to just use a lock on the writer side. And since the readers don't
need to perform any locking, the lock contention is likely to be
low enough to keep the lock uncontended most of the time and
uncontended locks are pretty efficient. The trick is keeping
contention low.
--
Joe Seigh
When you get lemons, you make lemonade.
When you get hardware, you make software. .
- Follow-Ups:
- Re: Question about vZOOM reference handling
- From: Chris Thomasson
- Re: Question about vZOOM reference handling
- From: Dmitriy Vyukov
- Re: Question about vZOOM reference handling
- References:
- Question about vZOOM reference handling
- From: Dmitriy Vyukov
- Re: Question about vZOOM reference handling
- From: Dmitriy Vyukov
- Question about vZOOM reference handling
- Prev by Date: Re: good debugger,development environment
- Next by Date: Re: good debugger,development environment
- Previous by thread: Re: Question about vZOOM reference handling
- Next by thread: Re: Question about vZOOM reference handling
- Index(es):
Relevant Pages
|