Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NX: Lock: Theoretics

 
Javini Javono
Ranch Hand
Posts: 286
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
This posting discusses issues which will have no effect on your
grade (or so I gather from reading previous posts).
Here is a snapshot taken every 10 seconds of my LockManager
class running George's super software exerciser on a database
file containing 31 records.

Every element in the LockManager represents a currently locked
record. Optimally, the size of the LockManager should always
be 31; I say this, because this would suggest that during processing
all records are being updated "simultaneously."
However, you'll note that the LockManager's size is not always
at 31, but instead changes in size, even though there are tons
of threads standing by to write to every record. I suspect that
this is caused by threads being awakened by notifyAll() only to
find out that another thread is using the record they want to
write to.
My initial conclusion, which I have not implemented or tested,
is that Phil's specific notification idea may be ideal (again, I mean
theoretically ideal, since it is commonly believed that these
subtle differences will not effect your grade) for the following
reasons:
1. I suspect that if I used specific notification, then the snapshots
of the LockManager would almost always show its size to be 31
or very near 31.
2. Any one thread would not have to wait a long time to get
access to a record; a phenomena which can occur if the threads
are not more controlled.
Anyone have any ideas on this theory?
Thanks,
Javini Javono
 
George Marinkovich
Ranch Hand
Posts: 619
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Javini,
Originally posted by Javini Javono:

My initial conclusion, which I have not implemented or tested,
is that Phil's specific notification idea may be ideal (again, I mean
theoretically ideal, since it is commonly believed that these
subtle differences will not effect your grade) for the following
reasons:
1. I suspect that if I used specific notification, then the snapshots
of the LockManager would almost always show its size to be 31
or very near 31.
2. Any one thread would not have to wait a long time to get
access to a record; a phenomena which can occur if the threads
are not more controlled.
Anyone have any ideas on this theory?

My guess is that the average size of your LockManager for each 10 second snapshot will be closer to 31 than it currently is (avg 23.17). To see the difference, which can be expected to be quite subtle, you may have to take your snapshots more frequently, say every second.
Don't keep us in suspense. If you change notifyAll to notify, what happens?
[ March 13, 2004: Message edited by: George Marinkovich ]
 
Javini Javono
Ranch Hand
Posts: 286
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi George,
As you know, I can't change notifyAll() to notify(). I only mentioned
notifyAll() to make it clearer what the algorithm was.
Thanks,
Javini Javono
 
Javini Javono
Ranch Hand
Posts: 286
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Here are the snapshots taken every second:

Thanks,
Javini Javono
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic