February 2002
- Article: Moral Outrage - Bizarre as it seems, indignation makes the world go round (from New Scientist) Christopher Allen
- premium servers Matt Mihaly
- premium servers Talies the Wanderer
- premium servers Matt Mihaly
- premium servers Christopher Allen
- premium servers Christopher Allen
- Girl appeal (was: Boys and Girls) Marian Griffith
- Girl appeal (was: Boys and Girls) rayzam
- Girl appeal (was: Boys and Girls) John Buehler
- Girl appeal (was: Boys and Girls) Matt Mihaly
- Girl appeal (was: Boys and Girls) Caliban Tiresias Darklock
- Girl appeal (was: Boys and Girls) Matt Mihaly
- Girl appeal (was: Boys and Girls) Caliban Tiresias Darklock
- Girl appeal (was: Boys and Girls) Matt Mihaly
- Girl appeal (was: Boys and Girls) Marian Griffith
- Girl appeal (was: Boys and Girls) John Buehler
- Girl appeal (was: Boys and Girls) Matt Mihaly
- Girl appeal (was: Boys and Girls) Caliban Tiresias Darklock
- Girl appeal (was: Boys and Girls) Sasha Hart
- Girl appeal (was: Boys and Girls) Caliban Tiresias Darklock
- Girl appeal (was: Boys and Girls) Freeman, Jeff
- Girl appeal (was: Boys and Girls) Caliban Tiresias Darklock
- Girl appeal (was: Boys and Girls) Matt Mihaly
- Girl appeal (was: Boys and Girls) Caliban Tiresias Darklock
- Girl appeal (was: Boys and Girls) Matt Mihaly
- Girl appeal (was: Boys and Girls) Madrona Tree
- Girl appeal (was: Boys and Girls) Talies the Wanderer
- Girl appeal (was: Boys and Girls) Marc Hernandez
- Girl appeal (was: Boys and Girls) Caliban Tiresias Darklock
- Girl appeal (was: Boys and Girls) Sasha Hart
- Girl appeal (was: Boys and Girls) Caliban Tiresias Darklock
- Girl appeal (was: Boys and Girls) Sasha Hart
- Girl appeal (was: Boys and Girls) Caliban Tiresias Darklock
- Girl appeal (was: Boys and Girls) Caliban Tiresias Darklock
- Girl appeal (was: Boys and Girls) Rogue_Buddha
- Girl appeal (was: Boys and Girls) Caliban Tiresias Darklock
- Girl appeal (was: Boys and Girls) Matt Mihaly
- Girl appeal (was: Boys and Girls) Christopher Allen
- Girl appeal (was: Boys and Girls) Sasha Hart
- Girl appeal (was: Boys and Girls) Caliban Tiresias Darklock
- NEWS: Release of v0.21 of Murpg Core Mike Povoski
- story vs. screenplay Nicholas E. Walker
- story vs. screenplay Koster, Raph
- story vs. screenplay Sean K
- story vs. screenplay ghovs
- story vs. screenplay Nicholas E. Walker
- story vs. screenplay ghovs
- story vs. screenplay James Edward Gray II
- story vs. screenplay ghovs
- story vs. screenplay Marian Griffith
- story vs. screenplay Nicholas E. Walker
- story vs. screenplay Marian Griffith
- MUD Protocols? Neil Edwards
- MUD Protocols? Matt Owen
- MUD Protocols? Bruce Mitchener
- MUD Protocols? Andrew Wilson
- MUD Protocols? Phillip Lenhardt
- MUD Protocols? Lars Duening
- MUD Protocols? Caliban Tiresias Darklock
- MUD Protocols? Jon Leonard
- MUD Protocols? Chris Gray
- BlackSnow sues Mythic for online property rights Koster, Raph
- BlackSnow sues Mythic for online property rights Geoffrey MacDougall
- BlackSnow sues Mythic for online property rights Matt Mihaly
- BlackSnow sues Mythic for online property rights Rudy Fink
- BlackSnow sues Mythic for online property rights Dave Shepherd
- BlackSnow sues Mythic for online property rights Steve {Bloo} Daniels
- BlackSnow sues Mythic for online property rights Derek Licciardi
- BlackSnow sues Mythic for online property rights Dave Rickey
- BlackSnow sues Mythic for online property rights Richard A. Bartle
- BlackSnow sues Mythic for online property rights Blane Bramble
- BlackSnow sues Mythic for online property rights Sellers, Mike
- BlackSnow sues Mythic for online property rights kuvasza
- BlackSnow sues Mythic for online property rights Matt Mihaly
- BlackSnow sues Mythic for online property rights Frank Crowell
- BlackSnow sues Mythic for online property rights Freeman, Jeff
- BlackSnow sues Mythic for online property rights Ola Fosheim Grøstad
- BlackSnow sues Mythic for online property rights Frank Crowell
- BlackSnow sues Mythic for online property rights Dave Rickey
- BlackSnow sues Mythic for online property rights Dr. Cat
- BlackSnow sues Mythic for online property rights Caliban Tiresias Darklock
- BlackSnow sues Mythic for online property rights Alex Kay
- BlackSnow sues Mythic for online property rights Jeff Cole
- BlackSnow sues Mythic for online property rights John Buehler
- BlackSnow sues Mythic for online property rights Jeff Cole
- BlackSnow sues Mythic for online property rights John Buehler
- BlackSnow sues Mythic for online property rights Dr. Cat
- BlackSnow sues Mythic for online property rights Matt Mihaly
- BlackSnow sues Mythic for online property rights Hans-Henrik Staerfeldt
- BlackSnow sues Mythic for online property rights Vincent Archer
- BlackSnow sues Mythic for online property rights John Buehler
- BlackSnow sues Mythic for online property rights Steve {Bloo} Daniels
- BlackSnow sues Mythic for online property rights Hans-Henrik Staerfeldt
- BlackSnow sues Mythic for online property rights Marc Bowden
- [BIZ] Players - GMs ratio Mathieu Castelli
- [BIZ] Players - GMs ratio Robert A. Rice Jr.
- [BIZ] Players - GMs ratio Mathieu Castelli
- Ethical behavior ... a hijacking. Jeff Cole
- Ethical behavior ... a hijacking. Matt Mihaly
- Ethical behavior ... a hijacking. Koster, Raph
- Ethical behavior ... a hijacking. Matt Mihaly
- Ethical behavior ... a hijacking. Jeff Cole
- Ethical behavior ... a hijacking. John Buehler
- Ethical behavior ... a hijacking. Marc Bowden
- Ethical behavior ... a hijacking. Travis Casey
- Ethical behavior ... a hijacking. Matt Mihaly
- Ethical behavior ... a hijacking. John Buehler
- Ethical behavior ... a hijacking. Jon Lambert
- "Advanced" use of virtual worlds? (MMORPGs & MUDs) Caliban Tiresias Darklock
- "Advanced" use of virtual worlds? (MMORPGs & MUDs) J C Lawrence
- "Advanced" use of virtual worlds? (MMORPGs & MUDs) Matt Mihaly
- "Advanced" use of virtual worlds? (MMORPGs & MUDs) Travis Casey
- "Advanced" use of virtual worlds? (MMORPGs & MUDs) Michael Tresca
- Merc++ the_sage2000@juno.com
- ADMIN: Bullets. conservation of momentum etc J C Lawrence
- EULA Structure Eli Stevens
- EULA Structure Hans-Henrik Staerfeldt
- EULA Structure Matt Mihaly
- EULA Structure Frank Crowell
- EULA Structure Bruce Mitchener
- EULA Structure Hans-Henrik Staerfeldt
- EULA Structure Steve {Bloo} Daniels
- Thank you from MudWorld ucmm@inetsolve.com
- Thank you from MudWorld Matt Mihaly
- Thank you from MudWorld Matt Owen
- Thank you from MudWorld Chris Lloyd
- Re[4]: "Advanced" use of virtual worlds? (MMORPGs & MUDs) Travis Casey
- What's Important in a Driver? Jonathan Ross
- Everquest player survey with interesting points Olof Ekström
- Myth II Game server has gone open source Frank Crowell
- Question about threads. Anderson, David
- Question about threads. J C Lawrence
On Wed, 13 Feb 2002 13:05:05 -0600
David Anderson <Anderson> wrote:
> I joined the list a day ago or so, and ended up reading the last
> few quarters of e-mails just because they were so interesting.
Welcome.
> I was wondering about what the purpose of using threads would be,
> since currently I'm in a single loop like Rom, where I process
> every user in turn, and cycle through that over and over.
In essence there are three uses for threads:
1) Minimising blocking operations
2) Easier/more deterministic in-game state transitions
3) Scalability
The typical first case for #1 is gethostby{addr|name}() which has a
long timeout associated with it which can't be trivially worked
around. If you don't do (reverse) lookups this is not a problem.
The more simple case for #1 also impacts #2: keeping your internal
game state logically consistent. The base problem is time
management. In a typical text mud setup you have a heartbeat loop
that does a sweep of the active objects on each beat and invokes the
appropriate code for any state changes needed. While horribly
inefficient, this works for small systems and light weight state
changes. The problem enters when either:
a) The number of state changes to perform on a given sweep becomes
large such that the total time required for the sweep grows and
becomes unpleasantly noticeable by the users.
b) One of the component state change functions executed during a
sweep runs excessively long (which leads back into #a).
The typical/first approach to this is to implement internal
application level threads (cf MOO), or which some fields call
"fibers". Simply, this means that on each sweep only some portion
of each state change function is executed before processing moves on
to the next one. Any incompleat state changes functions are picked
up in their incompleat state and executed for another slice on the
next sweep along with any other new state change functions for that
sweep.
This has two obvious problems:
1) It doesn't handle the problem of the list of state change
functions to be called growing, and in fact makes it worse more
rapidly (continued functions are added to the load on the next
pass, making the number of items to be processed in that sweep and
this the time needed even longer).
2) Determining and maintaining logical state guarantees becomes
increasingly complex. Consider:
What if a state change function on one pass starts manipulating
objects Q and R, but that function doesn't finish.
On the same pass another state change function attempts to
manipulate objects T, V and W based on the internal states of Q
and R, and also doesn't finish. Note: that this second function
has few guarantees that the internal state of Q & R are
logically consistent either with each other or with the state of
W.
On the next sweep both incompleat fragments start up again, and
a new state change function is added to the list which also
processes objects Q, T and W before being interrupted. This
function has the same problems as the others: It has few if any
guarantees as to the internal or relative state of the objects
it references.
Its quite a mess. Is the door open or closed? If closing or
opening the door also changes the state of the wind object, when
the process door operation is interrupted and the flutter flag
operation starts, is the wind blowing or not? That's a rather
trite and insignificant example -- I'll leave you to come up with
more critical and player-confusing examples (its not hard).
Note that this sort of logical inconsistency can prevented and
handled thru careful data handling/sequencing, process design, and
hinting of interruption/yield state change functions (eg make the
scheduler cooperative instead of pre-emptive (the arguments for and
against cooperative scheduling are distinct and for another post)).
The main problems on this approach are that:
i) As the number of state changes per sweep increases the whole
game slows (sweeps take longer and longer and the number of
incompleat changes per pass grows).
ii) It requires the developers of state change code to be
intimately familiar with the internal logics and data handling of
the current game, the relative processing time and expense of
their code and the code it calls, and how to correctly handle
access and lock sequencing to shared data. Unfortunately the last
couple are (seemingly) uncommon skills.
A threaded approach can be taken where state change functions are
executed by distinct threads at some level of parallelism. The
fundamental change from the fibre model is that the scheduler is
pre-emptive.
The question of whether scheduling is handled in-application or by
the OS is largely moot as it doesn't change (outside of hinting)
the base problems. The real gain that moving to an external
scheduler gives you (outside of code simplicity) is that you can
now take advantage of multi-processor systems (and possibly
distributed systems as well).
However the big gain from threading is scalability. The single
threaded approach dictates that all the state change functions for a
given sweep be executed sequentially. Outside of hardware
contraints the processing of player commands (for instance) need not
wait on and need not be paced by the processing and execution of
state change functions and the relative processing of state change
functions can be balanced such that some degree of fairness is
achieved between fast and slow state change functions while also
maintaining a good user experience.
Please note that threading is not a magic bullet. Its not. Its a
tool that brings its own problems with it with the primary problem
being data access sequencing and lock management. Both can easily
and rapidly become non-trivial problems (do some searches on ACID
(in the DB context) and deadlock detection and prevention for
details.
Also note that in many cases moving to a multi-processing model
instead of a multi-threaded model can be just as effective and far
simpler. The main reason NOT to move to a multi-processing model
is if state change operations need to share and operate on
considerable shared state as under a multi-processing model that
tends to mean a significant message passing expense.
> I haven't found sockets to ever deadlock me, as long as I set the
> sotimeout (socket timeout) to 200 miliseconds.
While I can't comment on the Java model/limits, in the general case
you do not have control over all sockets used by your application.
Some socket operations are hidden under library APIs (eg
gethostbyname()) and are not trivially changed.
Which is also rather beside the point that socket handling is rather
the tiny part of the problem.
> ...if I should use threads, what would be their purpose? One
> thread per user? One thread for users, one for game updates, one
> for mob updates, etc?
That's a very domain and platform specific set of questions. It
really depends on what you are trying to do and your data sequencing
model.
However as a small note in the general case very large numbers of
thread are a Bad Idea. Most systems handle very large numbers of
threads poorly if at all.
--
J C Lawrence
---------(*) Satan, oscillate my metallic sonatas.
claw@kanga.nu He lived as a devil, eh?
http://www.kanga.nu/~claw/ Evil is a name of a foeman, as I live. - Question about threads. Nathan F. Yospe
- Question about threads. Sean K
- Question about threads. Caliban Tiresias Darklock
- Question about threads. Daniel.Harman@barclayscapital.com
- Question about threads. J C Lawrence
- TECH : MUD game on a multi agent system Cyril MudDev
- TECH : MUD game on a multi agent system Marc Bowden
- TECH : MUD game on a multi agent system John Robert Arras
- TECH : MUD game on a multi agent system Robert Zubek
- Using the survey Info to make real factual argument WAS: Everquest player survey with interesting points Sasha Hart
- [BIZ] Selling Sex, Power, and Prestige Dave Kennerly
- [BIZ] Selling Sex, Power, and Prestige Sasha Hart
- Mob (NPC) behavior William Murdick
- Mob (NPC) behavior Freeman, Jeff
- Mob (NPC) behavior Valerio Santinelli
- Mob (NPC) behavior Sean K
- Mob (NPC) behavior Sasha Hart
- Mob (NPC) behavior J C Lawrence
- Mob (NPC) behavior Kevin Reid
- Mob (NPC) behavior Mike Povoski
- Mob (NPC) behavior Sasha Hart
- [TECH] Event Queue System the_sage2000@juno.com
- [TECH] Event Queue System Lars Duening
- [TECH] Event Queue System J C Lawrence
- [TECH] Event Queue System Phillip Lenhardt
- [TECH] Event Queue System Lars Duening
- [TECH] Event Queue System Blane Bramble
- [TECH] Event Queue System John Robert Arras
- [TECH] Event Queue System Kwon Ekstrom
- [TECH] Event Queue System Jon Leonard
- Immersion lawsuit Frank Crowell
- Spouse play (was Using the survey Info to make real Ola Fosheim Grøstad
- Spouse play (was Using the survey Info to make real Lars Duening
- RP definitions J C Lawrence
- roleplaying Matt Mihaly
- Girl's Perspective (was: Boys and Girls) Katy Morris
- Girl's Perspective (was: Boys and Girls) Paul Schwanz
- Girl's Perspective (was: Boys and Girls) Katy Anderson {Morris}
- Girl's Perspective (was: Boys and Girls) Amanda Walker
- Spouse play Sasha Hart
- Student Interview Steve Wilson
- Statistics (was: Girl appeal (was: Boys and Girls)) Sasha Hart
- "Advanced" use of virtual worlds? (MMORPGs & MUDs) Caliban Tiresias Darklock
- I 0Wn Y0o, d00d (Latest 'Biting The Hand' column at Skotos) Christopher Allen
- Online Worlds Timeline Update Koster, Raph
- Online Worlds Timeline Update Richard A. Bartle
- Online Worlds Timeline Update Christopher Allen
- Online Worlds Timeline Update Travis Casey
- Online Worlds Timeline Update Jeff Freeman
- DCMA -- another weapon in the fight against Emulators Frank Crowell
- DCMA -- another weapon in the fight against Emulators Eric Rhea
- DCMA -- another weapon in the fight against Emulators Frank Crowell
- DCMA -- another weapon in the fight against Emulators Caliban Tiresias Darklock
- DCMA -- another weapon in the fight against Emulators bruce@cubik.org
- DCMA -- another weapon in the fight against Emulators Frank Crowell
- DCMA -- another weapon in the fight against Emulators Frank Crowell
- DCMA -- another weapon in the fight against Emulators Frank Crowell
- DCMA -- another weapon in the fight against Emulators Jon Lambert
- DCMA -- another weapon in the fight against Emulators Travis Nixon
- DCMA -- another weapon in the fight against Emulators Frank Crowell
- [TECH] Peer-to-peer downloads for MMO games Olof Ekstrom
- [TECH] Peer-to-peer downloads for MMO games Daniel.Harman@barclayscapital.com
- [TECH] Peer-to-peer downloads for MMO games Oliver Jowett
- [TECH] Peer-to-peer downloads for MMO games Jon Leonard
- character longevity statistics Val Trullinger
- MajorMUD recollections. Online Worlds Timeline Update Patrick Mahle
- MajorMUD and other BBS MUDs (was: Online Worlds Timeline Update) Scott Jennings
- DaoC postmortem at Gamasutra Azeraab
- DaoC postmortem at Gamasutra Buddy Grizzard
- DaoC postmortem at Gamasutra Dave Rickey
- DaoC postmortem at Gamasutra Marc Bowden
- DaoC postmortem at Gamasutra Scott Jennings
- DaoC postmortem at Gamasutra Vincent Archer
- DaoC postmortem at Gamasutra Steve {Bloo} Daniels
- DaoC postmortem at Gamasutra Buddy Grizzard
- Skotos TT& Christopher Allen