(c) 17 Points] (Not related to the bank account example above) Suppose we have a
ID: 3726874 • Letter: #
Question
(c) 17 Points] (Not related to the bank account example above) Suppose we have a B Tree supporting operations insert and lookup (deletion is NOT a supported operation on this particular B Tree). Consider two options to synchronize threads accessing the tree: (a) one lock for the entire tree that both operations acquire/release (b) one lock per node in the tree. Each operation acquires the locks along the path to the leaf it needs and then at the end releases all these locks once the operation is completed. Explain which approach is preferrable and whyExplanation / Answer
Solution:
The 2nd approach in the b part is more preferrable than 1st approach in the a part.
Approach described in part a):
It will work just fine but here the locking is done on entire B tree for any specific operation which reduces the level of concurrency.for example operations like insert needs only part of whole B tree i.e the node and its leaf.but here locks are being provided for all the nodes in the B-tree which is not required.these unrequired locking of nodes reduces the degree of concurrency in process or transaction.and at the same time if any other operation is required to be performed on tree which require lock to part of B tree which is not affected by ongoing operation on B tree then the required lock should be provided to these transaction or process. but in this approach these types of lock will never be fulfilled thereby increasing transaction or any process waiting time which is highly undesirable in real time applications like transaction where more waiting time leads to time out.
in b part:
ocking is provided to only the part of whole B tree which may be required by operation.due to this type of locking approach more than 1 process or transaction can preform operation at a same time.thereby increasing the level of concurrency.due to these concurrency the average waiting of processes or transaction reduces as compared to prior approach.this approach is way more suited for real time applications like transactions where time out occurs due to extra waiting.here,waiting time is reduced so,chances of time out is reduced as compared to prior approach.
I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.