[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Context switching woes
----- Original Message -----
From: Pierre Phaneuf <firstname.lastname@example.org>
Sent: Monday, February 19, 2001 3:11 PM
Subject: Re: Context switching woes
> I'd say you should also merge the networking thread, but that's just me.
> See my signature and this:
> > When the renering thread is actually doing something, I don't want the
> > thread to feed data to the scenegraph API, to prevent items moving
> > mid-render, and screwing everything up. Writing a simple lock mechanism
> > would work fine on a single processor, but if the game is run on a
> > multi-processor system, who knows what the scheduler is doing.
> Seems like the scenegraph needs to be protected by a lock. Simple, no?
> Well, as simple as it gets when you're involving threads...
It depends. The is a small chance (say, 1 in a billion) that there could be
a context swicth when the lock check is being done, and 2 subsystems getting
a lock at the same time.
> What do you mean about that lock working on a single processor, but not
> on a multi-processor system?
If 2 different threads are running on two different processors, the chance
of a context switch at the worst possible moment in time increases.
> > Under Windoze, you can tell the scheduler to give the current thread all
> > access (i.e. don't change the context at all). While this has some
> > (it freezes all the other threads), it does make coding thread-safe
> > functions a lot easier.
> Yeah, right, welcome to DeadLockFest 2001! ;-)
> "A computer is a state machine. Threads are for people who can't
> program state machines." -- Alan Cox
Hmm, I wonder is AC is releated to Tony Cox (head of DirectX development,
who I'm exchanging a lot of emails with atm)
The Infamous Mark 'Nurgle' Collins
Lead Author - 'Linux Game Programming' (ISBN: 0-7615-3255-2)
WWW: http://www.thisisnurgle.org.uk Mobile: +44 7761 774 152
Email: email@example.com Spam: firstname.lastname@example.org
To unsubscribe, e-mail: email@example.com
For additional commands, e-mail: firstname.lastname@example.org