PreviousNext

Advantages of Using Threads

With a threads package, a programmer can create multiple threads within a process. Threads execute concurrently and, within a multithreaded process, there are at any time multiple points of execution. Threads execute within a single address space. Multithreaded programming offers the following advantages:

· Performance

Threads improve the performance (throughput, computational speed, responsiveness, or some combination of these) of a program. Multiple threads are useful in a multiprocessor system where threads run concurrently on separate processors. In addition, multiple threads also improve program performance on single processor systems by permitting the overlap of input and output or other slow operations with computational operations.

You can think of threads as executing simultaneously, regardless of the number of processors present. You cannot make any assumptions about the start or finish times of threads or the sequence in which they execute, unless explicitly synchronized.

· Shared Resources

An advantage of using multiple threads over using separate processes is that the former share a single address space, all open files, and other resources.

· Potential Simplicity

Multiple threads can reduce the complexity of some applications that are inherently suited for threads.