LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 03-16-2009, 12:58 PM   #1
aixilin
LQ Newbie
 
Registered: Aug 2008
Posts: 28

Rep: Reputation: 15
What's the priority of process that contain multi-thread?


Hi,

If one process has many threads which have different priority, so what's the priority of this process?

GL
 
Old 03-16-2009, 01:03 PM   #2
paulsm4
Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
It's the same as the priority of one hand clapping ;-)
 
Old 03-16-2009, 01:06 PM   #3
aixilin
LQ Newbie
 
Registered: Aug 2008
Posts: 28

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by paulsm4 View Post
It's the same as the priority of one hand clapping ;-)
Sorry, I don't know what you mean.
Should the process have the same priority with the highest thread?
 
Old 03-16-2009, 03:00 PM   #4
paulsm4
Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
No -

I meant that you're confusing "thread priority" with "process priority". In general, they're completely independent of each other. Changing thread priority will *not* affect process priority.

This link might help:
http://www.net.t-labs.tu-berlin.de/~...cheduling.html

PS:
This is true of Linux and Pthreads (and, for that matter, equally true of Windows and Win32 or .Net threads). Your mileage on other OS's (particularly real-time and embedded OS's) will vary.

PPS:
Here's an example of an OS with decidedly "non-standard" behavior:
http://dobbscodetalk.com/index.php?o...html&Itemid=29

The key thing is:
1. Understand the basic concept of "threads" vs "processes" (in general)
2. Understand the difference between kernel-level and user-level
3. Apply that understanding to your particular combination of OS platform and threading library

Last edited by paulsm4; 03-16-2009 at 03:08 PM.
 
1 members found this post helpful.
Old 03-17-2009, 06:00 AM   #5
aixilin
LQ Newbie
 
Registered: Aug 2008
Posts: 28

Original Poster
Rep: Reputation: 15
Thanks for your reply..Now I get it..
I am still learning real time and multi-threads programming. As I thought threads come from same process is equal to this process born these threads, so the process's priority will be changed by the children threads. That's the mistake idea.
You are right, they are independent of each other..


Quote:
Originally Posted by paulsm4 View Post
No -

I meant that you're confusing "thread priority" with "process priority". In general, they're completely independent of each other. Changing thread priority will *not* affect process priority.

This link might help:
http://www.net.t-labs.tu-berlin.de/~...cheduling.html

PS:
This is true of Linux and Pthreads (and, for that matter, equally true of Windows and Win32 or .Net threads). Your mileage on other OS's (particularly real-time and embedded OS's) will vary.

PPS:
Here's an example of an OS with decidedly "non-standard" behavior:
http://dobbscodetalk.com/index.php?o...html&Itemid=29

The key thing is:
1. Understand the basic concept of "threads" vs "processes" (in general)
2. Understand the difference between kernel-level and user-level
3. Apply that understanding to your particular combination of OS platform and threading library
 
Old 10-04-2012, 03:27 PM   #6
srini RM
LQ Newbie
 
Registered: Oct 2012
Posts: 1

Rep: Reputation: Disabled
Smile

very nice info... it is very useful for me....
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
process priority,nice -- small question regarding high/low priority values beeblequix Linux - Newbie 1 10-11-2006 11:22 AM
Priority of Linux process/thread scanner Linux - Newbie 1 07-07-2006 01:49 AM
thread priority tornatom Programming 0 08-22-2005 02:00 PM
Multi-Thread/Process Pipes JanusPaul Programming 2 02-27-2005 03:52 PM
multi-thread VS multi-process ltcstyle Programming 3 12-04-2004 07:53 PM


All times are GMT -5. The time now is 05:12 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration