A further note on this matter:
It is often useful, in understanding such matters, to know the reason why certain thing can only be done in a specific way.
In this scenario it is:
- 'there can only be one' (to misquote the Highlander)
-- writing to a file at the same time
This is, to my knowledge, a common feature on all operating systems.
It is true, that there are ways to 'simulate' that this is not so
- but in the end, it always come down to the basic reality
- 'there can only be one'
-- writing to a file at the same time
----
In multi-user Database systems
- each Database-connection being one user
such as mysql, postgres, mssql, oracal, IMS (a MVS-mainframe database system),
you will have a program (server) 'lurking' in the background
- listening for 'requests' (mostly on a specific 'port')
This program receives a request and depending on what type of request it is (reading/writing being two)
- deal with it in some form
In the case of 'writing' it is often:
- depending on how the Database is structured internally
1) mysql and postgres (and possibly mssql, oracal) use a DATABASE concept
- each DATABASE is a directory
- each TABLE is a file (possibly spitted into more that one, depending on a size limit)
2) IMS also uses a DATABASE logic
- but there are no TABLES as such
- each DATABASE being one file (at least)
- MVS (when I worked with it) had no concept of directories
So when a 'writing' request has been received
- this request is 'QUEUED'
-- 'line up in the queue number X and wait your turn'
--- often a separate 'QUEUE' for each file (TABLE/DATABASE depending on the system)
Since 'there can only be one', the request will wait until the other requests have been completed
- when your request can write away, possible overwriting any changes the previous requests have just completed
-- and of course the next request, may overwrite your changes
(this assume that there is no LOCKING being done. i.e. prevent changes of others until your changes have been completed)
When completed, the server-program will inform the client, who sent the request, the result.
This may also be a 'TIMEOUT' result
- the requests before you taking so long, that the defined 'TIMEOUT' setting for a result has been exceeded
-- like in a grocery store, where surprised is shown, when the next in line learn that they must pay something and the digging in the great unknown starts
This may also be a 'TOO MANY CONNECTIONS' result
- the server will only handle a defined amount of request at one time
So even if it looks like everything is being serviced simultaneously, the reality is that it is
- sequential / parallel
---
In single-user Database systems
- each Database-connection (again) being one user
such as sqlite, sqlite3, dbase, access
In this scenario, there is nobody 'listening' to requests
- basically a library is being called to service this connection
-- not knowing (and often not caring) what other connections are active
The DATASET are one file, the TABLES being inside this file
- where the 'there can only be one' restriction will ALWAYS apply
In the above sample, Sandro has shown (very nicely)
- what efforts the the sqlite3 developers have made to avoid this problem, where practicable
-- but it only a simulation
---
For a Database designer, this is one (of many) crucial aspects that must understood correctly
- a central TABLE where every 'Tom, Dick and Harry' (adding a 'Mary' may make this statement politically correct) must write to
-- is a major cause for bottlenecks in a designed system/application
The Database system being used may be well designed
- but the use of it, may not be
-- this is an aspect often not taken into consideration
---
In the end, independent of single/mult-user modus, one must expect to receive the result:
- 'there can only be one' and it is not you
Hope this helps
Mark
bye Sandro