Reputation: 455
I have read in a paper that TCP Control Block List along with Hash table has to be locked to prevent modifications while the current segment is processed.
Why should the entire list be locked for processing current segment. Is it because we don't know to which socket (or TCP connection) current segment belongs to? If so why should we lock at all?
Upvotes: 0
Views: 578
Reputation: 33538
Why is it necessary to lock the entire TCP Control Block List? Is it because we don't know to which socket (or TCP connection) current segment belongs to?
Yes, that's correct. Until the current segment has been processed through the control block list we do not know to which socket it applies.
If so why should we lock at all?
This is to prevent updates happening while the current segment is processed. If another process wrote to the block while our current one reads, the data could be inconsistent. It also avoids out of order segment processing and the complexities of avoiding race conditions.
Upvotes: 1