MOO-cows Mailing List Archive


RE: Win32 MOO?

Message-ID: red-33-msg951227220415MTP[01.51.00]000000fa-29974

-> or NT.  Seems like the win32 port of MOO is long overdue.  What gives?
-> I talked to Pavel about this a while ago.  It looked to me like the fork
-> in the checkpoint routine was the problem.  Threads and processes work in a
-> different way than UNIX processes.
there are two major classes of problems and two minor ones.

the first major one is the use of fork() for checkpointing.  under 
unix, a fork()ed process inherits the memory image of the parent 
process, so if you fork() a new process you get a nice coherent 
in-memory database.  this is not true under win32, where creating a new 
thread (the closest equivalent) shares the same memory image as the 
parent process.  to fix this, you basically have to use synchronous 
(non-forked) checkpointing--doing a threaded checkpoint while your 
database is being modified is wicked hard.  this also affects 
name-lookup, which is done with a secondary process in moo, but that's 
more easily fixed.

the second problem is the use of timers for seconds-out errors on 
tasks.  this could be fixed reasonably easily by using some win32 timer 
mechanism, either a separate timer thread or an actual win32 timer object.

one minor problem is that the win32 sockets interface looks just 
different enough from the unix sockets interface that a fair amount of 
code would have to be just slightly touched.  not a big deal, but it 
uglifies the code significantly to insert a forest of #ifdef WIN32.

the other minor problem is the lack of crypt() in win32.

the rest of the issue is standard porting difficulties, like getting 
all the include file nonsense sorted out, and not having a full range 
of SIGFOO signals defined, and a few other little annoyances.

bottom line: it could be done correctly in about a week of work; i have 
a hacked port that does everything except name-lookup and seconds-out 
errors, and that took me about a day.  and no, i'm not going to release 
it in its current state, but i will give indications for those 
interested as to what changes i made, and i could probably even cobble 
together a diff if people promise not to laugh at my porting hacks.


Home | Subject Index | Thread Index