Threads in distributed applications have the same benefits as in any other application: they allow you to perform multiple operations at the same time.
Specifically for distributed applications, the server will most definitely be multi-threaded so that it can communicate with all of the clients. The clients will also most likely have at least two threads: one for communication with the server and one for doing actual data processing.
You cannot have a process without creating at least one thread of execution, thus there is no advantage of one over the other. A process is simply a collection of one or more threads where all threads share the same memory address space but where each thread has its own local stack.
The advantage of using multiple threads over a single thread is that multiple threads can take advantage of multiple CPU cores and thus execute two or more threads concurrently.
To use a simple example, suppose you wish to search an unsorted container. Being unsorted, a linear search is the optimum algorithm to use, but this has a worst case execution time of O(n) for n elements. However, if you have 2 CPU cores available, each core can search half the container concurrently, reducing the worst-case search time by up to a half: O(n/2). With 4 cores, the worst-case search time reduces by up to half again: O(n/4).
The memory space, where a given application is executed is called - process. A Process is the memory set aside for an application to be executed in. Within this process the thing, which is really executed is the thread. The key difference is that processes are fully isolated from each other; threads share (heap) memory with other threads running in the same application. Threads share the address space of the process that created it; processes have their own address. Threads have direct access to the data segment of its process; processes have their own copy of the data segment of the parent process. Threads can directly communicate with other threads of its process; processes must use inter-process communication to communicate with sibling processes. Threads have almost no overhead; processes have considerable overhead. New threads are easily created; new processes require duplication of the parent process. Threads can exercise considerable control over threads of the same process; processes can only exercise control over child processes. A great answer to the question can also be found here: (link moved to link section)
different paths of control in a program that a computer might run at the same time if it has parallel processing support for multithread execution. threads and processes are two ways of supporting multitasking on a uniprocessor or multiprocessing on a multiprocessor. threads are lighter weight: take less OS resources to implement but only support limited protection and security. processes take more OS resources but can support full protection and security. Many operating systems support both processes and threads, allowing each process to have many threads.
Processes do not execute, it is the threads within a process that actually execute. All processes have at least one thread of execution, the main thread. If the main thread falls from scope, the process ends, taking all threads with it. This can lead to undefined behaviour if the threads are not terminated gracefully from within the main thread before it falls from scope.
Single-threaded processes only have one thread of execution -- therefore it would not be possible to have two processes waiting for input at the same time.
Plumbing pipe threads are squared and conduit pipe threads are tapered.
The memory space, where a given application is executed is called - process. A Process is the memory set aside for an application to be executed in. Within this process the thing, which is really executed is the thread. The key difference is that processes are fully isolated from each other; threads share (heap) memory with other threads running in the same application. Threads share the address space of the process that created it; processes have their own address. Threads have direct access to the data segment of its process; processes have their own copy of the data segment of the parent process. Threads can directly communicate with other threads of its process; processes must use inter-process communication to communicate with sibling processes. Threads have almost no overhead; processes have considerable overhead. New threads are easily created; new processes require duplication of the parent process. Threads can exercise considerable control over threads of the same process; processes can only exercise control over child processes. A great answer to the question can also be found here: (link moved to link section)
different paths of control in a program that a computer might run at the same time if it has parallel processing support for multithread execution. threads and processes are two ways of supporting multitasking on a uniprocessor or multiprocessing on a multiprocessor. threads are lighter weight: take less OS resources to implement but only support limited protection and security. processes take more OS resources but can support full protection and security. Many operating systems support both processes and threads, allowing each process to have many threads.
A thread is like any other class, except that there is the capacity to run multiple threads - multiple processes - simultaneously.
Some advantages steam-powered machinery had over water-powered machinery was quicker production processes, enhanced distribution, and allowed factories to be located away from water sources.
Process --1------------m-- Threads 1 process to many threads Bring up your Task Manager (if you are using a windows), Performance tap, you can see the number of process and the number of threads, usually the number of threads is a lot higher than the number of processes.
Processes do not execute, it is the threads within a process that actually execute. All processes have at least one thread of execution, the main thread. If the main thread falls from scope, the process ends, taking all threads with it. This can lead to undefined behaviour if the threads are not terminated gracefully from within the main thread before it falls from scope.
Just knowing what a thread does should already make it quite clear what its advantages are. In programming, multithreading means the capability of running multiple threads, or instruction sequences, at the same time. A thread is simply a sequence of instructions, but the language is designed in such as way that other threads can work at the same time.
Very handy in the control processes.
- USER LEVEL THREADS Aadvantages: · User-level threads can be implemented on operating system that does not support threads. · Implementing user-level threads does not require modification of operating system where everything is managed by the thread library · Simple representation which the thread is represented by a the thread ID, program counter, register, stack , all stored in user process address space · Simple management where creating new threads, switching threads and synchronization between threads can be done without intervention of the kernel · Fast and efficient where switching thread is much more inexpensive compared to a system call - Disadvantages: · There is a lack of coordination between threads and operating system kernel. A process gets one time slice no matter it has 1 thread or 10000 threads within it. It is up to the thread itself to give up the control to other threads · If one thread made a blocking system call, the entire process can be blocked in the kernel, even if other threads in the same process are in the ready state KERNEL LEVEL THREAD: - Advantages: · Because kernel has the full knowledge of all the threads, scheduler may decide to allocate more time to a process having large number of threads than process having small number of thread, where the kernel threads come useful for intense application - Disadvantages: · Kernel level threads are slow and inefficient, since kernel must manage and schedule all the threads as well as the processes. It requires a full TCB for each thread to maintain information about threads, which results in increasing of overheads and kernel complexity
When weaving cloth (fabric) on a loom, the weft threads are the ones that are passed back and forth horizontally over and under the vertical warp threads.
Threads are implemented by a library that utilizes underlying kernel-supported threads of control, called light-weight processes (LWPs). http://java.icmc.usp.br/books/os/html/threads_lightweight_process.html
Control and speed of executions.