LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   pthread scheduling (https://www.linuxquestions.org/questions/linux-software-2/pthread-scheduling-806815/)

thespartan 05-09-2010 01:19 PM

pthread scheduling
 
Hi all,

I am writing a server program. During the initialization stage, it spawns 100 pthreads to handle clients (I am doing this because, I thought pthread_create is a costly fn and increases my response time if I create them dynamically when request come in.) Then as the requests start coming in, I assign a thread to handle each connection. The problem with this apprach is the server is not fast enough, and sometimes the client requests time out.. I read that this may be improved by setting higher priority to your process.
so , my question is, how to make my process high priority so that cpu allocates longer time for all the threads in my process.

Is it reasonable to expect that all the threads in my process will get high priority if I make my process high priority. Are threads of a process scheduled within the time allocated for a process or are they considered part of a global pool of lwp and independently scheduled?

can anyone give me some pointers or tutorial sites that explain these topics.

fpmurphy 05-10-2010 07:55 AM

Quote:

Is it reasonable to expect that all the threads in my process will get high priority if I make my process high priority.
In general, no.

Quote:

Are threads of a process scheduled within the time allocated for a process or are they considered part of a global pool of lwp and independently scheduled?
It depends on the implementation of the Pthread library you are using. It may be implemented as green threads, 1:1 theads or M:N threads. You simply have not provide enough information for anybody to give you a definitive answer.


All times are GMT -5. The time now is 10:46 PM.