Monday, June 22, 2020

What do you mean by threads explain importance of multithreading?

Thread is lightweight sub-process the smallest unit of processing it is separated part of execution. 

threads are independent if there occurs exceptions in one thread it doesn't affect other threads it uses shared memory.

Java provides thread class to achieve thread programming thread class provide the constructions and methods to create and perform operations on a thread. thread class extends object class and implements run-able interfaces.

Some importance of multithreading.

1. Resource sharing-a single application may have different threads which share memory data files etc within the same address space this is called resource sharing between threads.

2. Responsiveness- if thread is blocked due to some exceptions then the remaining threads are unaffected as each thread is independent where other threads results in proper working.

3. Utilisation of processor- each thread can in parallel on multiprocessor system this increase the concurrency of system and resulting in faster execution of program.

4. Economy- as share resources it is more economical in nature then process each process require more memory and resources hence overhead of process creation and management is much higher than thread creation and management is needed.

0 comments:

Post a Comment