[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4762: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4764: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4765: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4766: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
GameMonkey Script • View topic - thread priorities

GameMonkey Script

GameMonkey Script Forums
It is currently Thu Oct 28, 2021 4:32 am

All times are UTC




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: thread priorities
PostPosted: Mon Feb 19, 2007 6:52 am 
Offline

Joined: Fri Nov 24, 2006 9:50 am
Posts: 165


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Feb 19, 2007 7:54 am 
Offline

Joined: Mon Dec 15, 2003 1:38 pm
Posts: 708


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Feb 19, 2007 8:30 am 
Offline

Joined: Fri Nov 24, 2006 9:50 am
Posts: 165


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Feb 21, 2007 2:23 pm 
Offline

Joined: Fri Nov 24, 2006 9:50 am
Posts: 165


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Feb 22, 2007 8:14 am 
Offline

Joined: Fri Nov 24, 2006 9:50 am
Posts: 165


Attachments:
threadpri.zip [3.58 KiB]
Downloaded 613 times
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Feb 22, 2007 8:35 am 
Offline

Joined: Fri Nov 24, 2006 9:50 am
Posts: 165
I forgot to mention, from gamemonkey a thread's priority is set like this: - setThreadPriority( [thread_id] ), it will return you the old priority and set the priority of the current thread if no args are given. getThreadPriority( [thread_id] ) will also give you the current thread's priority or the priority of the thread specified.

If you change your current thread's priority multiple times in a positive direction you can get your thread to run multiple times in a frame, and if you decrease the priority the thread will run the next frame.

Patching this requires no changes to existing code, and incurs no speed difference. Memory-wise there are 255 more nodes created for the array of DoubleLink lists, but unless you create hundreds of gmMachines (not a good idea anyway) that won't affect you.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Feb 22, 2007 11:13 am 
Offline

Joined: Mon Dec 15, 2003 1:38 pm
Posts: 708
Thanks for sharing that HiVision. I see you have gone with thread grouping and manual execution order. 255 slots seems quite a range to trawl through each frame, though likely insignificant for modern machines. I'd be interested to see alternative scheduling methods that don't require time consuming sort operations, but still throttle execution effectively.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Feb 22, 2007 12:05 pm 
Offline

Joined: Fri Nov 24, 2006 9:50 am
Posts: 165
It's not so much a grouping of threads as a hashing of the priorities, but it can be treated as grouping too (hence the modification to the Execute command).

The no. of slots and default thread priority could be set or overridden in the Config file for smaller less powerful machines. In reality a smaller no. is perfectly alright. Even a no. as small as 10 would be extremely handy.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group