forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

sceKernelCreateThread: optimal priority values

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
jockyw2001



Joined: 29 Sep 2005
Posts: 339

PostPosted: Tue Jun 13, 2006 1:11 am    Post subject: sceKernelCreateThread: optimal priority values Reply with quote

How can I determine the optimal priority value for a thread created with sceKernelCreateThread? For example in my app I have a network thread with priority 0x18, a decode thread with 0x16 and a video thread with 0x16. I noticed that the performance of my app can change rather dramatically if I tweak the priority values. So far it has been trial and error, I'm looking for a systematic approach.
Back to top
View user's profile Send private message
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Tue Jun 13, 2006 4:20 am    Post subject: Reply with quote

Alas I do not think there is really much of a systematic approach you can take to thread priorities, it really depends on the types of work each thread is performing and how resistent they would be to interruptions. It also will depend how they interact with each other.

Based on your example I would probably say that the decode thread is probably doing the most work therefore it probably should have a lower thread priority (i.e. a higher number) than the other two as they are likely to be relatively short lived and reactive. In general I would say anything which tends to go into a wait state often (e.g. IO bound stuff such as a network thread or something limited by the blank interval such as a video thread) would need to be higher priority to ensure that they can react as quickly as possible to the event to prevent stalling the decode too much and go back as quickly as possible to the wait state.

Of course I dont know the exact work your code is doing, so it is hard to say for certain, it probably really is a case of suck it and see. I'll try to remember to add a function to tweak the thread priority from the psplink shell so you can test what works best at runtime :)
Back to top
View user's profile Send private message
jockyw2001



Joined: 29 Sep 2005
Posts: 339

PostPosted: Tue Jun 13, 2006 4:33 am    Post subject: Reply with quote

TyRaNiD wrote:
I'll try to remember to add a function to tweak the thread priority from the psplink shell so you can test what works best at runtime :)

That would be wonderful. Psplink is already a HUGE timesaver and it's getting better all the time. Thank you very much.
Back to top
View user's profile Send private message
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Tue Jun 13, 2006 5:41 am    Post subject: Reply with quote

Committed fyi.
Back to top
View user's profile Send private message
dot_blank



Joined: 28 Sep 2005
Posts: 498
Location: Brasil

PostPosted: Tue Jun 13, 2006 10:43 am    Post subject: Reply with quote

o0oo very delicious commit :)
also note i find that you should never
go below 0x11 for priority as your update
thread should be at that level so no 0x01-0x11
should be touched
_________________
10011011 00101010 11010111 10001001 10111010
Back to top
View user's profile Send private message
jonny



Joined: 22 Sep 2005
Posts: 351

PostPosted: Tue Jun 13, 2006 6:06 pm    Post subject: Reply with quote

@dot_blank:

really interesting infos! (i guess there are some system threads that need to have more priority)
in pmpmod actually i have 3 threads with pri < 0x11 (4 if i count the implicit async-reading thread)
this can explain some rare problems i have while testing (i'm going to check)
Back to top
View user's profile Send private message Visit poster's website
KickinAezz



Joined: 03 Jun 2007
Posts: 328

PostPosted: Fri Dec 28, 2007 1:13 am    Post subject: Reply with quote

[QUOTE=Tyranid] I'll try to remember to add a function to tweak the thread priority from the psplink shell so you can test what works best at runtime :) [/QUOTE]

Which function is it?
_________________
Intrigued by PSP system Since December 2006.
Use it more for Development than for Gaming.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group