[thelist] cflock reads?

rudy r937 at interlog.com
Mon Jan 21 21:49:48 CST 2002


> I think you are missing a couple of aspects of the way CF handles locks:

more than likely, since i know so blessed little (in fact, nada before
today)

>1) Because shared variables are stored in memory, simultaneous reads
> and writes will cause memory errors that crash the server.

okay, i can accept that, so the thing to do is prevent simultaneous reads
and writes, right?

what about only simultaneous reads??  suppose the session variable is never
written??  is there still danger of memory being corrupted by multiple
reads?

if so, maybe i should think again about using cf....

>2) A READ lock only prevents an exclusive lock from taking place.
Exclusive
>locks prevent READ and EXCLUSIVE locks.  So you can have a bunch of
>simultaneous reads going on, but if you want to update that variables, you
>have to wait until all READ locks are complete, then your EXCLUSIVE lock
>kicks in, preventing anybody else form reading or writing until the update
>is complete.

okay, that makes sense, and is more or less in line with what i figured
locks were for

now please explain why, in the remote chance that the same user issues both
a read and a write to a session variable at the same time (which i still
don't see how it can happen), the exclusive lock on the write wouldn't wait
until the read was finished?

so, in other words, if the writes are exclusively locked, why do you have
to lock the reads too?  this is something nobody has explained yet!

i must be friggin stupid


rudy






More information about the thelist mailing list