IT Community - Software Programming, Web Development and Technical Support

Process & Thread

This is a discussion on Process & Thread within the C# Programming forums, part of the Software Development category; Hey, Can anyone differentiate a computer process and thread? I am confused with this one.Thanks...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Development > C# Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 08-20-2007, 10:13 AM
Sathish Kumar Sathish Kumar is offline
D-Web Analyst
 
Join Date: Feb 2007
Posts: 304
Sathish Kumar is on a distinguished road
Exclamation Process & Thread

Hey,
Can anyone differentiate a computer process and thread? I am confused with this one.Thanks
__________________
Sathish Kumar.R
Knowledge is meant to SHARE
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-20-2007, 10:35 PM
a.deeban a.deeban is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 279
a.deeban is on a distinguished road
Default Re: Process & Thread

Hi,

A process is a running program, along with all the DLLs it uses. In 16-bit Windows, processes were called tasks, but this temporary aberration has gone the way of the difference between you and thou. Every process has a process ID that uniquely identifies it. You can pass a process ID to the OpenProcess API function to get a process handle. Most API functions that provide process information require a handle rather than an ID.


A thread follows a single path of execution through a program and is the fundamental unit scheduled by Windows. Every process has at least one thread, and in some languages you can start additional threads within a process. Visual Basic will start and manage separate threads in some kinds of ActiveX servers, but you as the programmer have little control over it. Put another way, processes don’t really exist. They are just holders for threads, which do the real work.


hope this may help you...

thnx...
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 08-20-2007, 10:41 PM
smani smani is offline
D-Web Programmer
 
Join Date: Aug 2007
Posts: 56
smani is on a distinguished road
Post Re: Process & Thread

PROCESS

A process will execute the threads(set of instructions), which may contain multiple threads sometimes.

THREAD

It contains a group of instructions that a processor has to do. Thread is a light weighted process,collection of threads become process.

Difference:
1. Different processes can't work under same memory location. They have their own individual working memry segment. But the threads can work under the same memory area. Even they can access any memory location.
2. A process is a collection of virtual memory space, code, data, and system resources. A thread is code that is to be serially executed within a process. A processor executes threads, not processes.


Regards
Manivannan.s
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 08-22-2007, 01:10 AM
Sathish Kumar Sathish Kumar is offline
D-Web Analyst
 
Join Date: Feb 2007
Posts: 304
Sathish Kumar is on a distinguished road
Thumbs up Re: Process & Thread

Yes also

1. Different processes can't work under same memory location. They have their own individual working memory segment. But the threads can work under the same memory area. Even they can access any memory location.
2. Processes have the overhead of making all the work within it orderly and also sum up them. But threads are done for a single unit of task only and at completion their work is all over.
3. Multiple processes require the resources explicitly to work with. They are least concerned about the sharing them. i.e. why when a system implements a multi process system it is expensive as compared to multi-threaded system. Because the threads have good strategy to share the things.
4. One process can run on more than one thread.
5. thread is nothing but flow of execution where as process is nothing but a group of instructions which is similar to that of a program except which may be stopped and started by the OS itself
6. In most multithreading operating systems, a process gets its own memory address space; a thread doesn't. Threads typically share the heap belonging to their parent process.
For instance, a JVM runs in a single process in the host O/S. Threads in the JVM share the heap belonging to that process; that's why several threads may access the same object.
Typically, even though they share a common heap, threads have their own stack space. This is how one thread's invocation of a method is kept separate from another's.
__________________
Sathish Kumar.R
Knowledge is meant to SHARE
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 08-22-2007, 04:47 AM
Venkat Venkat is offline
D-Web Master
 
Join Date: Mar 2007
Posts: 350
Venkat is on a distinguished road
Thumbs up Re: Process & Thread

hey sathish,

I hope this will help you,

Any "running application" (which you see in the task manager) is a process. A process has it's own address space whereas threads don't. A thread exists within a process. A process can have just one or many threads. Threads allow parallel execution of many tasks.

Threads & process have few things in common too,..like
both have an id, a set of registers, a state, a priority, and adhere to a scheduling policy.

Communication across process happens through "pipes" whereas threads of the same process can pass data and communicate by reading and writing directly to any data that is accessible to the parent process, since they belong to the same address space.
__________________
Venkat
knowledge is Power
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Describe the difference between a Thread and a Process? vadivelanvaidyanathan ASP and ASP.NET Programming 7 12-25-2008 04:57 AM
How to wait a program control until a thread completes it process? $enthil C# Programming 4 11-16-2007 03:08 AM
How to get a reference to primary thread from process ? theone Mobile Software Development 1 07-30-2007 03:50 AM
Describe the difference between a Thread and a Process? kingmaker C# Programming 1 07-30-2007 12:21 AM
What is daemon thread and How to create the daemon thread Java? bluesky Java Programming 1 07-25-2007 05:55 AM


All times are GMT -7. The time now is 10:55 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0