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: (HTL) multi-threading file access

 
james render
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Requirements state,
'You may assume that at any moment, at most one program is accessing the database file; therefore your locking system only needs to be concerned with multiple concurrent clients of your server'
Okay I take it this means that we don't have to allow for another application changing the file whilst we are using it. BUT does it also mean that we have to allow for multiple threads acting on the file at once.
thanks guys!
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12007
215
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi James,
does it also mean that we have to allow for multiple threads acting on the file at once
Yep.
You should be able to run two (or more) copies of your networked client simultaneously, both connecting to your server simultaneously, both attempting to book the same room simultaneously.
Unless you are putting two strangers into one bed you probably only want one of these bookings to succeed.
So your server has to allow for multiple threads - one for each connected client. If you are using RMI, then creating these threads is handled for you. If you are using sockets, you have to do some work yourself.
Either way you have to make sure your locking code handles the multiple threads.
Regards, Andrew
[ May 23, 2003: Message edited by: Andrew Monkhouse ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic