| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Multiple threads accessing the same files |
Peter Schuller wrote in a message to All:
PS> I'm currently developing a BBS system, and of course -
PS> multinode. This means that there will be multiple threads
PS> or processes (depending on how I'll implement it) be
PS> accessing the same files! Let's take the message-files and
PS> file-files for instance. If 4 nodes wishes to read/write to
PS> the same message/file-base (thus, the same file), how do I
PS> coordinate this? Semphores' not good, considering there
PS> could be 100 nodes running (unlikely, but 50 maybe).
Use DosSetFileLocks(). If you are working in C++, you can wrap file
locking in an object oriented wrapped.
PS> Best way I can figure out:
PS> I create a 'access-handleing-thread', that as above receives
PS> messages via queues or pipes (probably queues, since pipes'
PS> point-to-point), and then send messages to other threads
PS> that requested the access. This thread will then have the
PS> access until it sends
PS> "i'm-finished-let-the-next-thread-get-the- access" to the
PS> access-handleing-thread, that then if there is one, passes
PS> the access on. But this too can get complicated.
I'm sure Peter will have something to say on this, since he is responsible
for the MCP/MCP32 components of Maximus. MCP32 is a DLL which exports a
bunch of services, allowing different instances of Maximus to communicate:
Entry Index Name
1 McpOpenPipe
2 McpClosePipe
3 McpSendMsg
4 McpGetMsg
5 McpDispatchMsg
6 McpPeekMsg
Having a master database server daemon might be a reasonable approach if
you are really expecting to support 50 or 100 nodes. Pipes would be more
appropriate for what you want to do, and they can be networked at some
point in the future if you need that.
-- Mike
---
* Origin: N1BEE BBS +1 401 944 8498 V.34/V.FC/V.32bis/HST16.8 (1:323/107)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: 323/107 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™.