answersLogoWhite

0


Best Answer

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.

User Avatar

Wiki User

15y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

6y ago

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).

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What are the advantages of threads over processes?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is the difference between processes and threads?

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)


What is processes threads?

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.


If process stop its execution will thread also stop or it will continue to run?

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.


Two threads are waiting for keyboard input one in each process Does this problem ever occur in single threaded processes?

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.


Whats the difference between plumbing pipe threads and conduit pipe threads?

Plumbing pipe threads are squared and conduit pipe threads are tapered.

Related questions

What is the difference between processes and threads?

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)


What is processes threads?

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.


Compare and contrast between threads and classes in java language?

A thread is like any other class, except that there is the capacity to run multiple threads - multiple processes - simultaneously.


What advantages did steam powered machinery have over water powered machinery?

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.


What is relationship between process and thread?

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.


What are the advantages of threads?

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.


If process stop its execution will thread also stop or it will continue to run?

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.


What are the advantages of electrical thermometers?

Very handy in the control processes.


What are the advantages and disadvantages of user level threads and kernel level threads?

- 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


What are weft threads?

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.


Why thread is called light weight process?

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


Briefly summarise the reasons for the decisions made by software developers regarding the use of processes versus threads?

Control and speed of executions.