Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!apple!snorkelwacker.mit.edu!bloom-beacon!dont-send-mail-to-path-lines From: thp@westhawk.UUCP ("Timothy H Panton.") Newsgroups: comp.windows.x Subject: Re: programming strategy for interactive simulator Message-ID: <9103241127.AA03992@westhawk.uucp> Date: 24 Mar 91 11:27:04 GMT Sender: westhawk!thp@relay.eu.net Organization: The Internet Lines: 39 pefv700@perv.pe.utexas.edu wrote: > My question is: should I have 2 processes, one that controls the simulator? > If so, what is the best way to get data from the FORTRAN program? sockets? > Or should I have just one process that just checks for keyboard and button > events periodically? I've been contracting on a chemical plant simulator and we chose the first route with no real regrets. The origional frontend ran on a PC with GEM , so we already had a suitable command-line type interface on the UNIX backend. We added a couple of new "commands" to it to allow it to support our new X frontend and off we went. Up until a month ago I'd have said that there was only one problem - designing the comms protocol. However I recently improved the backend so that it could respond much faster to external events, and found to my horror that the machine (a Sparc) was spending about 25% of the time context switching. I spent last week de-tuning the response of the frontend-backend link so that requests are serviced within 1 sec, rather than within 10 millisec. The 10 millisec stuff was implemented to support some inter-machine I/O and I'd just assumed it would be nice to use it on the intra-machine link. Not so. On the communication front we arrange for both processes to expect to see the other on stdio, and we have a third process that creates the links, dups a bit forks them both and then waits around, this allows easy debugging and we also do a "recover" when the parent process sees that one of its children terminated abnormally and starts a replacement. Hope that helps a bit. Tim. +----------------------------------------------------------------------------+ |Tim Panton, Westhawk Ltd. "Do not meddle in the affairs of Wizards, for | |Phone: +44 928722574 they are subtle and quick to anger." | |Email: thp%westhawk.uucp@ukc.ac.uk The Lord of the Rings. | |Paper: Westhawk Ltd. 26 Rydal Grove, Helsby, Cheshire, WA6 OET. UK. | +----------------------------------------------------------------------------+