1838576 Members
4321 Online
110128 Solutions
New Discussion

Threads

 
Stephen Young_1
Occasional Advisor

Threads

Hi,

Can anyone give me a brief explanation of what Threads are and how they work ?

Cheers

Steve
4 REPLIES 4
Steven Gillard_2
Honored Contributor

Re: Threads

I won't try to put it into my own words, I'd probably just confuse you, and myself :)

Instead, take a look at /usr/share/doc/proc_mgt.txt. This is a detailed document but the section titled "What are Kernel Threads" has a good basic definition.

Regards,
Steve
Sridhar Bhaskarla
Honored Contributor

Re: Threads

Hi Stephan,

The main difference between a process and a thread is that thread will have only those properties for it's flow control independent of it's parent. While the process will have all the regular process properties such as pid, gid,uid, common address space etc., This is why threads are often called lightweight processes.

User threads can be programmed to handle multiple flow controls within a program while a kernel thread can be referenced by any other thread in the system.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Santosh Nair_1
Honored Contributor

Re: Threads

You can think of a thread as a child process which shares the environment of the parent process, i.e. doesn't have its own data/stack space, etc. The advantages of threads over child processes are that there is little overhead for spawning a thread and therefore a thread tends to be faster (at least at initialization) than spawning a child process.

Hope this helps a bit (?)

-Santosh
Life is what's happening while you're busy making other plans
Eugen Cocalea
Respected Contributor

Re: Threads

Hi,

http://www.serpentine.com/~bos/threads-faq/#3-What-are-threads-

http://dis.cs.umass.edu/~wagner/threads_html/sect1.html

(I must get rid of the habit of posting here the first two results that Google returns when I search for the subject of a note and instead just write: Use Google. It's surfer-friendly.)

E.
To Live Is To Learn