multithreading - When multi-threading is a bad idea? -
according way understand threads, programming multi-threaded program either can speed program or match execution time of single-threaded version of program.
so, 2 questions are:
1- said true or false ?
2- give example when multi-threading code produce negative results on performance ?
a multi-threaded program can behave worse single-threaded equivalent. due to:
- the cost create additional threads
- the cost of context switches
- the potential false sharing.
creating many threads small amount of work alters adjacent regions of memory exhibit of issues.
multi-threaded programs in general introduce additional complexity , present numerous opportunities bugs. should taken account when deciding whether or not use multiple threads.
Comments
Post a Comment