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...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| 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... |
| |||
| 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 |
| |||
| 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 |
| |||
| 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 |
![]() |
| Thread Tools | |
| Display Modes | |
| |
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 |