[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Context switching woes



I don't want to change the priority, as that wouldn't solve my original
problem. Here's what I', planning on doing.

I might have 3 threads, one for logic, one for rendering and one for
networking. (I may merge the logic and rendering threads if there is no easy
solution to this problem).

When the renering thread is actually doing something, I don't want the logic
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.

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 drawbacks
(it freezes all the other threads), it does make coding thread-safe
functions a lot easier.

Changing the priority of the threads will still allow the scheduler to
change the context (i think).

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: me@thisisnurgle.org.uk  Spam: spam@thisisnurgle.org.uk


----- Original Message -----
From: Christian Reiniger <creinig@mayn.de>
To: <linuxgames@sunsite.dk>
Sent: Sunday, February 18, 2001 4:29 PM
Subject: Re: Context switching woes


On Sunday 18 February 2001 16:28, Mark Collins wrote:
> instructions (I've even got permission from MS to disassemble their
> routines and do a port to Linux, how funky is that?)

Ack! *wildlook*
It's raining cows! look!

zbzf fzzfmghlm lmmll

> Before I do this, however, I was wondering what the critical sections
> functions in pthreads are like? (MS also tells me that Win32 has true

Hmm, "programming with posix threads" says:
look at

sched_get_priority_max()
sched_get_priority_min()
pthread_attr_getinheritsched()
pthread_attr_setschedparam()
pthread_attr_setschedpolicy()

and the related functions. That's in chapter 5.5 "Realtime scheduling".
Hope that helps.

--
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

AAAAA - American Association Against Acronym Abuse

---------------------------------------------------------------------
To unsubscribe, e-mail: linuxgames-unsubscribe@sunsite.dk
For additional commands, e-mail: linuxgames-help@sunsite.dk




---------------------------------------------------------------------
To unsubscribe, e-mail: linuxgames-unsubscribe@sunsite.dk
For additional commands, e-mail: linuxgames-help@sunsite.dk