- readers & writers

From: Bob Walkden <"Bob>
Date: Sun, 3 Jun 2007 10:04:12 +0100

----boundary-LibPST-iamunique-426916899_-_-
Content-type: text/plain

It seems to me that the current model for files is a reasonable
compromise between simplicity, usefulness and safety. As soon as you
introduce concurrency you are no longer dealing with a 'simple file
application', and you have to respond accordingly.

If you change the model so that other processes can read while one
process can write, then you run the risk of some of the problems which
database transaction management eliminates, such as non-repeatable
reads and dirty reads. To eliminate these you would need a more
finely-grained locking strategy, such as block and record locking.
Even these on their own don't fully eliminate the aforementioned
problems (and others which arise), and you start to need transactions.
This takes you into the realm of DBMSs.

So the answer, in my opinion, is to recognise that you no longer have
a 'simple file application', and use the right tool for the job, in
this case the SQL module with a suitable DBMS which handles
concurrency well enough.

Another possibility might be to look at the design of your
application, and identify those parts which require the files to be
updated. Separate them from the rest of the application and make sure
that they hold their locks for the shortest possible time by opening
the files only when you need to, and closing them as soon as you have
finished writing.

--
Regards,
 Bob 
> -----Original Message-----
> From: blackbox{([at]})nowhere.xy> Behalf Of René Dorta
> Sent: 03 June 2007 05:31
> To: BlackBox Mailing List
> Subject: [BlackBox] - readers & writers
> 
> I have been using for a long time a simple file application. 
> Due to the 
> small size of my data I let alone SQL and use instead modules 
> Files and 
> Stores directly. Every thing worked fine till now, when I 
> need to access 
> my data from different computers in a LAN. How to handle this?: If I
> open my files in "shared" mode ("which is the rule in BlackBox"), I 
> cannot update them; on the other hand, if I use "exclusive" (which
is 
> what I had been doing) I cannot open those files from more 
> than one site.
> 
> What I need is a way to write my files from a master site, but to be
> able to read them from any site in the LAN.
> 
> Thanks folks:
> René Dorta.
> 
> --- BlackBox
> --- send subject HELP or UNSUBSCRIBE to blackbox{([at]})nowhere.xy> 
> 
> 
--- BlackBox
--- send subject HELP or UNSUBSCRIBE to blackbox{([at]})nowhere.xy----boundary-LibPST-iamunique-426916899_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaW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3BlbiBteSBmaWxlcyBp
biAic2hhcmVkIiBtb2RlICgid2hpY2ggaXMgdGhlIHJ1bGUgaW4gQmxhY2tCb3giKSwgSSBccGFy
DQo+IGNhbm5vdCB1cGRhdGUgdGhlbTsgb24gdGhlIG90aGVyIGhhbmQsIGlmIEkgdXNlICJleGNs
dXNpdmUiICh3aGljaFxwYXINCmlzIFxwYXINCj4gd2hhdCBJIGhhZCBiZWVuIGRvaW5nKSBJIGNh
bm5vdCBvcGVuIHRob3NlIGZpbGVzIGZyb20gbW9yZSBccGFyDQo+IHRoYW4gb25lIHNpdGUuXHBh
cg0KPiBccGFyDQo+IFdoYXQgSSBuZWVkIGlzIGEgd2F5IHRvIHdyaXRlIG15IGZpbGVzIGZyb20g
YSBtYXN0ZXIgc2l0ZSwgYnV0IHRvIGJlXHBhcg0KXHBhcg0KPiBhYmxlIHRvIHJlYWQgdGhlbSBm
cm9tIGFueSBzaXRlIGluIHRoZSBMQU4uXHBhcg0KPiBccGFyDQo+IFRoYW5rcyBmb2xrczpccGFy
DQo+IFJlblwnZTkgRG9ydGEuXHBhcg0KPiBccGFyDQo+IC0tLSBCbGFja0JveFxwYXINCj4gLS0t
IHNlbmQgc3ViamVjdCBIRUxQIG9yIFVOU1VCU0NSSUJFIHRvIGJsYWNrYm94QG9iZXJvbi5jaFxw
YXINCj4gXHBhcg0KPiBccGFyDQo+IFxwYXINClxwYXINCi0tLSBCbGFja0JveFxwYXINCi0tLSBz
ZW5kIHN1YmplY3QgSEVMUCBvciBVTlNVQlNDUklCRSB0byBibGFja2JveEBvYn19AGVsGQAgkEJv
Yiwk
----boundary-LibPST-iamunique-426916899_-_---
Received on Sun Jun 03 2007 - 11:04:12 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:31:33 UTC