un-threadsafe sqlite
Matthias Andree
matthias.andree at gmx.de
Sun Apr 9 21:12:23 CEST 2006
David Relson <relson at osagesoftware.com> writes:
> If you use the auto-update option, i.e. '-u', then there's a lot of
> writing to the database. If there's to be a cause of trouble, this is
> it.
But not for threading issues but rather contention of page locks to
support transactions.
> My understanding is that sqlite implements ACID compliant transactions
> which are inherently thread-safe due to judicious use of locking.
I don't think this is a valid reason. SQLite does indeed implement ACID
(atomicity, consistency, isolation, durability) guarantees, but that
does not mean it is *inherently* thread-safe. It probably isn't without
special compiler flags because this requires internal mutual-exclusion
(mutex) for some parts of the code which otherwise would trample over
each other -- and these cost a bit performance so they're usually
disabled for single-threaded use.
Note that "thread" here is used in the sense of a POSIX thread, several
"light-weight" processes (as Solaris calls them) that share the same
address space, variables, code, everything, as opposed to POSIX
processes which are isolated from each other.
--
Matthias Andree
More information about the Bogofilter
mailing list