Search
]
Date:
[ Previous
| Next
]
Thread:
[ Previous
| Next
]
Index:
[ Author
| Date
| Thread
]
Re: [MUD-Dev] Two threads forced to one CPU? (was: Collecting ideas for a MUD server...)
[Hans-Henrik Staerfeldt:]
> Yes, or keep assuming the worst possible. Assume that the thread can be
> interrupted, after you have written down 16 of 32 bit of any long word
> in the memory, making the 32-bit value non-valid, which is why you need
> thread-safe system calls :-) I actually had this error, though on older
> hardware.
As far as I know, that shouldn't be a problem on a 32 bit CPU. The
instructions, if done properly aligned, should be single, atomic instructions.
The rule is likely something like: do not assume atomicity of operations
for any operations which operate on values larger than the word-size of
the machine, or on *any* struct/class values. So, on a 16 bit MC68000,
watch out for 32 bit values - they may not be atomic on memory accesses.
On a 32 bit IA32 (e.g. Pentium) machine, watch out for operations on 64
bit values - they may not be atomic with respect to memory. On a 64 bit
machine, e.g. an Alpha, watch out for 128 bit operations, etc.
There are of course exceptions. I believe newer Pentia have some explicit
64 bit special instructions, and since their off-chip bus width is
sometimes > 32 bits, these can work atomically. Unless you know the
specifics, however, and want your software to not be readily portable to
other CPU variants (even other I32's!), don't assume anything.
--
Don't design inefficiency in - it'll happen in the implementation.
Chris Gray cg#ami-cg,GraySage.Edmonton.AB.CA
http://www.GraySage.Edmonton.AB.CA/cg/
_______________________________________________
MUD-Dev maillist - MUD-Dev#kanga,nu
http://www.kanga.nu/lists/listinfo/mud-dev
- Thread context:
- Re: [MUD-Dev] Embedded languages, object persistance... ack., (continued)
- Re: [MUD-Dev] Two threads forced to one CPU? (was: Collecting ideas for a MUD server...),
cg cg@ami-cg.GraySage.Edmonton.AB.CA, Fri 24 Dec 1999, 19:03 GMT
- [MUD-Dev] Re: MUD-Dev digest, Vol 1 #237 - 9 msgs,
Dr. Cat cat@realtime.net, Thu 23 Dec 1999, 17:13 GMT
- [MUD-Dev] Job Openings - Mud Engineering,
Christopher Allen ChristopherA@Skotos.net, Thu 23 Dec 1999, 01:53 GMT
[ Other Periods
| Other mailing lists
| Search
]