LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-07-2006, 12:51 AM   #1
scanner
LQ Newbie
 
Registered: Jul 2006
Posts: 28

Rep: Reputation: 15
Thumbs up Problem about process vs. thread in Linux


1> Light-weight processes(created by Linux-specific clone()) share address space with parent process and they and the parent process is in charge of kernel thread. Right? If YES, may user control(set,change and etc.) the priority of each light-process? If YES, how to control the priority of each light-weight process?

2> User process have individual address space and is in charge of kernel thread one-to-one. And user process may create several threads(complying to POSIX) and each such thread is in charge of one kernel thread. So, how to control the priority of each thread?
 
Old 07-07-2006, 01:30 AM   #2
raskin
Senior Member
 
Registered: Sep 2005
Location: Russia
Distribution: NixOS (http://nixos.org)
Posts: 1,899

Rep: Reputation: 68
1. Clone also creates process, although with shared resources, as I know. man clone .

1. man setpriority .
 
Old 07-07-2006, 01:39 AM   #3
scanner
LQ Newbie
 
Registered: Jul 2006
Posts: 28

Original Poster
Rep: Reputation: 15
Question

Quote:
Originally Posted by raskin
1. Clone also creates process, although with shared resources, as I know. man clone .

1. man setpriority .

Light-weight process have same attributes as user process except for sharing address space and resource. Am I correct?
 
Old 07-07-2006, 01:46 AM   #4
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,275

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
There isn't really anything like a LWP in Linux, as I understand it. Everything is a standard process. However, because of the semantics of clone "processes" can share their entire address space and other stuff (signal handlers etc.). This makes "processes" that do this indistinguishable from a multithreaded application (in fact the PID is really just a thread group ID so a multithreaded process is really just a collection of threads that happen to be in the same thread group).

Compare these semantics to an OS like Solaris that has explicit threading support and LWPs built into the kernel.
 
Old 07-07-2006, 02:57 AM   #5
scanner
LQ Newbie
 
Registered: Jul 2006
Posts: 28

Original Poster
Rep: Reputation: 15
Thumbs up

Therefore, LWP and user process have same priority control attribute because kernel tasks serving user process or LWP is unaware which type of process is served. Right?
All LWP and their parent process have same PID(group ID). Thus how to distinct each LWP in controling their priority? Do LWP have thread ID?
 
Old 07-07-2006, 02:59 AM   #6
raskin
Senior Member
 
Registered: Sep 2005
Location: Russia
Distribution: NixOS (http://nixos.org)
Posts: 1,899

Rep: Reputation: 68
Where are LWP's?? They are not created by clone. Clone-d threads are processes - they have pid's.
 
Old 07-10-2006, 12:35 AM   #7
scanner
LQ Newbie
 
Registered: Jul 2006
Posts: 28

Original Poster
Rep: Reputation: 15
Thumbs up

Quote:
Originally Posted by raskin
Where are LWP's?? They are not created by clone. Clone-d threads are processes - they have pid's.
Here we may think of LWP as thread with own PID. What about your opinion?
 
Old 07-10-2006, 12:46 AM   #8
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,275

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
Like I said, in Linux there's no such thing as a LWP (Lightweight Process). Everything is a thread. Some threads may share a PID, memory space, etc., but that's it. Threads are scheduled equally. You might find this page helpful in understanding some of the differences.
 
  


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
display thread number in process tim24 Linux - General 4 07-07-2006 01:50 AM
what happens if i create a thread and then fork the process? Thinking Programming 7 10-31-2005 03:22 PM
what advantage do kernel thread has over process? keiwu Linux - Newbie 3 03-04-2005 05:04 PM
Process and thread PIDs msriram_linux Programming 4 11-27-2004 12:43 PM
Multithreaded System On 4 Cpu Linux Machine, process stuck on certain thread eyalzm Programming 1 05-10-2004 12:46 PM


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

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration