Senin, 23 November 2020

Difference between a Thread and an Executor in Java

Even though both Thread and Executor, both are used to execute some code in parallel, there are some key differences between them. The main difference between a Thread and an Executor in Java is that it later provides a thread pool in Java. Along with several concurrency utilities like CountDownLatch, CyclicBarrier, Semaphore, FutureTask, Callable interface, and Conditions, JDK 5 also introduced a built-in thread pool, which provides a set of working threads to run your code in parallel. Since creating, starting, and running a thread is a time-consuming and expensive operation, many Java applications create a spool of thread at start-up and leverage that for executing the task in parallel until Java introduced the built-in thread pool.

Lorem ipsum is simply dummy text of the printing and typesetting industry.

Comments


EmoticonEmoticon