By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,714 Members | 750 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,714 IT Pros & Developers. It's quick & easy.


P: n/a
Hello list,

I have a dbm "database" which needs to be accessed/writed by multiple
processes. At the moment I do something like :

def _save(self):
f =, 'c')

f[self.sid] =

the with_lock() decorator create a .lock file which is deleted when the
function exit, so every operation did the following:
- acquire .lock file
- open the dbm file
- do the operation (save, load, ...)
- close the dbm file
- delete the .lock file

I made some tests and following my results the open() / close() add some
overhead (about 5 times slower).

I read that the gdbm module should be safe against multiple processes (I
saw the "'u' -- Do not lock database." in the doc, so I presume it's
locked by default ?). Does it mean that two (or more) processes can open
the dbm file and write in the same time without
errors/corruptions/segfaults/... ?

Dec 27 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.