• Post Reply Bookmark Topic Watch Topic
  • New Topic

threads  RSS feed

Keith Jones
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wonder if someone could answer some of these questions:

1. Does the lock method in the Data class need to synchronise access to the datastructure we have maintains the list of locks. I say this because if it isn't then won't it be possible that half way through the execution of the method another thread may try and lock another (or the same) record?
2. When the specification of the lock method says:

"If the specified record is already locked, the current thread gives up the CPU and consumes no CPU cycles until the record is unlocked."

What does this mean?
a) Would I be right in saying that in the whole system we only want one instance of the Data class because if we have more than one instance of it then each instance of the class will do it's own synchronisation ignoring other instances.
b) And therefore the instance should be contained in the server as there is only 1 server.
c) Is it right also to say that therefore we should only have one instance of the datastructure that maintains the list of locked records because if we have more thsn one instance then each will have it's own list of record numbers?

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!