One solution to this could be lease the lock instead of giving the lock to a thread. If the thread dies holding the lock, it will expire in time and then it can be used by other threads. This is often used in distributed settings with a master node that grants leases to locks. If a thread wants to use a lock after its expired, it simply try to lease that lock again.
This comment was marked helpful 0 times.
nrchu
The issue with leasing is that you need a centralized master in charge of handling leases and determining when they end, or otherwise have each system independently keep track of time (and then you run into issues like clock drift).
This comment was marked helpful 0 times.
woojoonk
Another possibility to resolve could be simply sending the failure message and make other thread work on the same job, though this would increase the throughput significantly. Renting lock does seem more efficient, but if it was the case where threads don't usually die, just a simple solution might work as well.
This comment was marked helpful 0 times.
pinkertonpg
@woojoonk I think you mean decrease the throughput.
One solution to this could be lease the lock instead of giving the lock to a thread. If the thread dies holding the lock, it will expire in time and then it can be used by other threads. This is often used in distributed settings with a master node that grants leases to locks. If a thread wants to use a lock after its expired, it simply try to lease that lock again.
This comment was marked helpful 0 times.
The issue with leasing is that you need a centralized master in charge of handling leases and determining when they end, or otherwise have each system independently keep track of time (and then you run into issues like clock drift).
This comment was marked helpful 0 times.
Another possibility to resolve could be simply sending the failure message and make other thread work on the same job, though this would increase the throughput significantly. Renting lock does seem more efficient, but if it was the case where threads don't usually die, just a simple solution might work as well.
This comment was marked helpful 0 times.
@woojoonk I think you mean decrease the throughput.
This comment was marked helpful 0 times.