From:	SMTP%"frankn@cs.vu.nl"  1-AUG-1996 18:15:38.19
To:	nbt@landacorp.com, cameron@stl.dec.com, glamm@mountains.ee.umn.edu,        smpatel@umiacs.umd.edu, Sven.Neuhaus@germany.eu.net
Subj:	Re: Netrek Metaserver Overhaul

> 		Only the main thread will update the database.  The forked
> 		threads for handling TCP connections will read the database.
> 		Some form of synchronisation must be used to ensure that a
> 		reader does not see a view of the database that is inconsistent
> 		due to concurrent updates.

How about this protocol which removes the need for synchronization
(if I'm correct):

Let the database consist of a list of data packets and several text buffers
containing the contents of the database in various formats. When a users
calls we can simply send him the appropiate text buffer. When a server
packet arrives we first update the list and then generate the different
text buffers in seperate (temporarily) variables. Then we copy the
temp variables into the text buffers that are sent to the users.
Of course this will only work if memcpy is an atomic operation, with
respect to process switching. Is that true?

Cheers, Frank

PS: I agree with Nick's comments on Sven's proposals ;-)

--
-- Frank Niessink  http://www.cs.vu.nl/~frankn 
-- "Quality is in the eyes of the beholder" -- Norman E. Fenton

From: 60600::CAMERON "James Cameron 02-Aug-1996 1621 +1000" 2-AUG-1996 16:32:18.24 To: @MDT Subj: Re: Netrek Metaserver Overhaul > Of course this will only work if memcpy is an atomic operation, with > respect to process switching. Is that true? No. Very interruptible in most operating systems and processors. So you go looking for atomic operations instead. Eventually you would work down to an atomic operation such as the replacement of a pointer with another value. On Alpha that's probably the only atomic operation. ;-) Changing a byte involves multiple instructions, so it could be interrupted. If you have multiple writers then you get all sorts of fun, since the instruction stream is not executed in the order it is written. In this situation we have only one writer. The mainline. The TCP threads view the data, they do not modify it. It would therefore be sufficient to have a pointer to the currently valid prepared output buffer, and copy it once inside the TCP forked thread. Okay? -- James Cameron (cameron@stl.dec.com) Digital Equipment Corporation (Australia) Pty. Ltd. A.C.N. 000 446 800