LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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-06-2006, 11:51 PM   #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, 12:30 AM   #2
raskin
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900

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

1. man setpriority .
 
Old 07-07-2006, 12: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, 12:46 AM   #4
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
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, 01: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, 01:59 AM   #6
raskin
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900

Rep: Reputation: 69
Where are LWP's?? They are not created by clone. Clone-d threads are processes - they have pid's.
 
Old 07-09-2006, 11:35 PM   #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-09-2006, 11:46 PM   #8
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:30 AM.

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
Open Source Consulting | Domain Registration