What is the disadvantage of threads?

Disadvantages of threads :
1. Multiple threads can interfere with each other when sharing hardware resources such as caches.
2. Hardware support for multithreading is more visible to software, thus requiring more changes to both application programs and operating systems than multiprocessing.
 
Threads also have some disadvantages: Threads are not reusable as they are dependent on a process and cannot be separated from the process.
 
Disadvantages of threads include:


1)Global variables are shared between threads.Inadvertent modification of shared variables can be disastrous.

2)Many library functions are not thread safe.

3)If one thread crashes the whole application crashes.

4)Memory crash in one thread kills other threads sharing the same memory, unlike processes.

5)There is a lack of coordination between threads and operating system kernel. Therefore, process as whole gets one time slice irrespective of whether process has one thread or 1000 threads within. It is up to each thread to relinquish control to other threads.

6)User-level threads requires non-blocking systems call i.e., a multi threaded kernel. Otherwise, entire process will blocked in the kernel, even if there are runnable threads left in the processes. For example, if one thread causes a page fault, the process blocks.

7)Threads are totally dependent on Operating Systems.

8)Threads if executed serially may increase the time complexity.
 
Back
Top