IT Community - Software Programming, Web Development and Technical Support

Describe the difference between a Thread and a Process?

This is a discussion on Describe the difference between a Thread and a Process? within the ASP and ASP.NET Programming forums, part of the Web Development category; Describe the difference between a Thread and a Process?...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > ASP and ASP.NET Programming

Register FAQ Members List Calendar Mark Forums Read
  #1  
Old 07-15-2007, 07:27 PM
vadivelanvaidyanathan vadivelanvaidyanathan is offline
D-Web Genius
 
Join Date: Feb 2007
Posts: 801
vadivelanvaidyanathan is on a distinguished road
Question Describe the difference between a Thread and a Process?

Describe the difference between a Thread and a Process?
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 07-16-2007, 12:11 AM
lavanya lavanya is offline
D-Web Trainee
 
Join Date: Jul 2007
Posts: 24
lavanya is on a distinguished road
Thumbs up Re: Describe the difference between a Thread and a Process?

THREAD:
Thread is used to execute more than one program at a time.

Difference:
  • Each threads belongs to one process
  • Thread shrares the address space of the process that created it.
  • Threads have direct access to the data segment of its process
  • Threads can directly communicate with other threads of its process
  • New threads are easily created
PROCESS:
Process executes the single program

Difference:
  • Each process has one or more threads.
  • Process have their own address
  • Processes have their own copy of the data segment of the parent process.
  • Processes must use interprocess communication to communicate with sibling processes.
  • New processes require duplication of the parent process.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 08-08-2007, 05:41 AM
krishnakumar krishnakumar is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 200
krishnakumar is on a distinguished road
Wink Re: Describe the difference between a Thread and a Process?

Hi,
I came to know about multithread concept in java and has two types to create it.. Can u give idea about multithread...


Thanks in Advance
__________________
Krishnakumar.S
Beware of Everything -that is un true; stick to the Truth shall succeed slowly but steadily
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4  
Old 08-09-2007, 08:09 AM
Venkat Venkat is offline
D-Web Master
 
Join Date: Mar 2007
Posts: 347
Venkat is on a distinguished road
Thumbs up Re: Describe the difference between a Thread and a Process?

hey,

Multithreaded applications provide the illusion that numerous activities are happening at more or less the same time. In C# the System. Threading namespace provides a number of types that enable multithreaded programming.

Whenever an application runs, it runs under a main thread. However, running a single thread can sometimes lead to unnecessary performance and locking issues. So if the application can be broken into multiple threads without hampering the flow of the main thread, then using it is always better.

n .NET, the threading is handled through the System.Threading namespace.

Creating a variable of the System.Threading.Thread type allows you to create a new thread to start working with.

It is clear to everybody that the concept of threading is to go off and do another task. The Thread constructor requires the address of the procedure that will do the work for the thread.

The AddressOf is the parameter that the constructor needs to begin using the thread.

Below is an example of a simple threading application.

Listing 1

Imports System.Threading
Public Class Form1
Inherits System.Windows.Forms.Form

Dim th1 As Thread
Dim th2 As Thread

Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
th1 = New Thread(AddressOf proc1)
th2 = New Thread(AddressOf proc2)

th1.Start()
th2.Start()
End Sub

Sub proc1()
Dim iCount As Integer
For iCount = 1 To 10
cmb1.Items.Add(iCount)
Next
End Sub
Sub proc2()
Dim iCount As Integer
For iCount = 11 To 20
cmb2.Items.Add(iCount)
Next
End Sub
End Class
__________________
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 Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to wait a program control until a thread completes it process? $enthil C# Programming 4 11-16-2007 03:08 AM
Process & Thread Sathish Kumar C# Programming 4 08-22-2007 04:47 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 09:29 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.
Our Partners
One Way Moving Companies | Stamford Dentist | Euro Millions Lottery | Home Loans| Furniture

SEO by vBSEO 3.0.0