Threads and Processes
I just started learning about multiple threads and multiple processes. I have the basics down, but I haven't been able to find anything that explains the details yet. I'm wondering what some of the more specific differences between the two, and the reasons/situations that would make you choose to use a new process instead of just a new thread.
although my knowledge in this area is limited i do know some stuff.
A process is a program running. But a thread is a part of a programm running.
A thread is like a cut down version of a process.
Because a process is an entire program running.
But a thread is only a part of a program running.
i hope im making sense here.
When u create a new process you are running another program.
But if u run 2 threads, they may come from the same program. Thats y u hear of some programs are able to run multiple threads. u are able to run a single process on 2 cpu's simultaneously through running a thread on each cpu from that process.
A Process is a program in execution.
If a process has a single thread, it is only able to preform one task at a time. If the process has multiple threads, it would be able to preform more then one task at a time.
An example of a process would be, a word processor. An example of a thread within the word processor might be a spell checker. If the process was single threaded, you would not be able to run the spell checker and type words into the document at the same time. But if the process was multi-threaded you would be able to.
Studying this in Computer Operating Systems right now ^^;
(Reference: Operating System Concepts, by Silberschatz, Galvin and Gagne)
A process has an address space. Multiple processes, multiple address spaces. A global variable in one process is not accessible from the other processes.
Multiple threads run within a process and share the same address space. A global variable in a multithreaded process is available to all threads running within the process.
For example... there are many differences.