Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read SiteMap

Tags: , , ,

Sponsored Links



Thread vs Process

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 23-02-2010
Member
 
Join Date: Nov 2009
Posts: 107
Thread vs Process

Hello, I am student of the BSC.I.T. and I want to know the difference between the Thread and Process. I have try to check the details about it, but I am not able to get the details of it. So, if anyone from you knows what is the difference between them then please help me to get that.
Reply With Quote
  #2  
Old 23-02-2010
MindSpace's Avatar
Member
 
Join Date: Feb 2008
Posts: 1,832
Re: Thread vs Process

Hello, if you are talking about the process then it is a collection of the virtual memory space, your code, all of your data and all of the resources which you use. And a thread is a code that is gets executed in serial manner within that process. So, if you consider the thread then it is executed by the processor. So, each and every application contains one process minimum. But, your single process can have multiple threads.
Reply With Quote
  #3  
Old 23-02-2010
opaper's Avatar
Member
 
Join Date: May 2008
Posts: 2,362
Re: Thread vs Process

If you are using java programming language then your thread implementation can be performed as below:
First you will define a class which contains that thread as below:
Code:
class Testing extends Thread
  • When the parent thread creates object and it gets executed by the use of the function as name of the start().
  • It will simply create a child thread and then it will call the run() function.
  • And the termination of the thread will be done when you will make use of the stop() function.
Reply With Quote
  #4  
Old 23-02-2010
Modifier's Avatar
Member
 
Join Date: Jan 2008
Posts: 1,502
Re: Thread vs Process

Hey, you need to consider the points given below for getting the difference between the Thread and Process:
Threads :.
● If you are using Thread then it will directly share your memory.
● It will also share you file descriptors.
● It have the capability to share your filesystem context.
● You are able to share signal handling.

Processes:
● It won't share your memory by default.
● In case of the processes it is not possible to share file descriptors.
● You are not able to share the filesystem context.
● Don't share signal handling.
Reply With Quote
  #5  
Old 23-02-2010
Member
 
Join Date: May 2008
Posts: 1,990
Re: Thread vs Process

Hello, for creating a thread or process you need to make use of the following syntax:
Creating a thread:
Code:
clone(c_stack=1x230cc540, flags=CLONE_TA|CLONE_FT|
CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|
CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID,
parent_tidptr=1x230cc3e4, tls=1x230cc562, child_tidptr=1x230cc3e4)
Creating a process:
Code:
clone(c_stack=0, flags=CLONE_CHILD_CLEARTID|
CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f4936ecc770)
Reply With Quote
  #6  
Old 23-02-2010
Praetor's Avatar
Member
 
Join Date: Apr 2008
Posts: 1,937
Re: Thread vs Process

Hey, if you are making use of the thread in your process then it will simply share a single address space and also able to access one another variable. But, your processes can be executed on different addresses and it is necessary to inter process the communication for exchanging the information. In other term you can simply call that the process which is Heavyweight is called as a Process and the process which is a Lightweight is called as a Thread. If you make use of the thread than process then it will provide you faster response. And that is why it will be used for the switching between the threads.
Reply With Quote
Reply

  TechArena Community > Software > Software Development


Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Thread vs Process"
Thread Thread Starter Forum Replies Last Post
Synchronize a producer thread and a consumer thread in C# Ayuka Software Development 6 10-11-2010 04:04 AM
Differentiation between Process and thread opaper Software Development 5 29-01-2010 08:51 AM
How to terminate Process and Delete the Source Program with Ultimate Process Killer jackalz Tips & Tweaks 1 26-03-2009 07:31 PM
STOP:C000021a Process System Process Terminated Unexpectedly Robert J. Rando Windows XP Support 5 26-12-2005 06:26 AM


All times are GMT +5.5. The time now is 03:47 AM.