| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Multiple threads accessing the same files |
PS> I'm currently developing a BBS system, and of course -
PS> multinode. This means
I'll do that later. ;-)
PS> that there will be multiple threads or processes (depending on how I'll
PS> implement it) be accessing the same files! Let's take the message-files
Recommendation: Use seperate processes.
Cons:
Processes take more resources to keep going
Pros:
One node crashing doesn't take down the ENTIRE BBS.
To access multiple files, use sharing. One option is sopen - not ANSI,
IIRC, but available in many compilers (Watcom included). The other option
is to use DosOpen directly (I would recommend writing some sort of io
library to go with it just in case you want to port to AIX or something -
then you just rewrite the library rather than everything else).
Actually, another option that I would consider is a server/client version
of a BBS - set up a server to communicate with via pipes, and each node
will just ask the server. The server would then co-ordinate everything.
Cons:
Take even MORE resources to keep going - a single server, in
addition to everything else.
Server crashing will take down the entire BBS.
Server is almost useless unless you have multiple processes rather
than multiple threads for each node.
Pros:
You could allow users, say on a WAN, LAN, or even internet, to have
a BBS and let the server do the access restrictions... and never worry
about having somebody do something awful to the system. :-)
It also lends itself to serialization a little better between the nodes.
This can be simplified somewhat... you'd lose the ability to allow users to
have client versions of the BBS (well, without writing an intermediate
"server/client"), but it would be much easier: Use DB2 or some
other multi-threaded multi-system share-aware database that is pre-built.
I may end up just using DB2/2 myself. :-)
Cons:
Cost.
Pros:
Bug-free code.
Sharing, etc., is already done - no coding required.
Expandability (since these will have been built as generic DB's in
the first place).
PS> and file-files for instance. If 4 nodes wishes to read/write to the same
PS> message/file-base (thus, the same file), how do I
PS> coordinate this? Semphores'
PS> not good, considering there could be 100 nodes running (unlikely, but 50
Semaphores would still be good for 100 nodes... I'm sure sharing does the
same thing anyway.
PS> maybe). Of course I could make the program try to open
PS> the file until it is
PS> allowed access, but that doesn't seem very effective.
I believe that if you try to open a file that you're denied, you can ask
DosOpen to wait until it's available...
--- Maximus/2 3.01
* Origin: Tanktalus' Tower BBS (PVT) (1:342/708)SEEN-BY: 50/99 54/99 270/101 620/243 625/160 711/401 413 430 934 712/311 407 SEEN-BY: 712/505 506 517 623 624 704 713/317 800/1 @PATH: 342/5015 61 3615/50 396/1 270/101 712/624 711/934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.