At 11:29 AM 4/8/2000 -0400, Dave Watts wrote:
>> As I understand it, CFLOCKing reads and writes to the shared
>> variable scopes (session, application, server) prevents
>> possible data corruption caused by simultaneous reads and writes.

This is the entire crux of the matter. Imagine that you have a application
variable that is a 200 MB array. Now imagine a "reader" cfm page comes
along and starts to use portions of that array. Now imagine that then an
updater cfm page comes along and manipulates that array... WHILE the
reader cfm is "Stalled due to CPU allotment of CPU usage for it's Thread
Time".
(this is a generic discussion and applies to all OS's)

Can you see what will happen? The reader CFM is partway thru it's event
and stalls due to (numerous reasons why, but for example) CPU cycle allotment.
While it is stalled, the updater CFM regains CPU cycles and continues to
modify the array. Bingo Bango, bad for the reader.


So you can see, that just locking write access does no good. This is the
reason for readonly and exclusive locking. You want exclusive if you
are going to update the memory structs/vars/arrays etc. This guarantees
only one writer and no one else accessing at a time. You want READONLY
on the other CFM pages so that you can have mulitple readers active
simultaneously.

When I first saw Session Vars I made a bad assumption about the programmers
at Allaire and assumed that they did all of the locking behind the scenes
(which they could have, since CF is a PCode system). But it took quite
a few site crashes to determine what was going on. CFLOCK was the result.

Steve
>>
>> My question is: if the data in the shared scopes is written very
>> infrequently but read often, couldn't I just lock the writes
>> and thereby still avoid the possible corruption?
>>


--
Stephen Garrett
GPS
[EMAIL PROTECTED]           (360) 896-2714
ICQ# 10776767
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to