Grokking Java Interview Questions
Vote

0% completed

​

Executors and Thread Pools

Suppose an online grocery store receives 50 orders per second, and sending the confirmation email for one order takes 200 milliseconds. A program that starts a new thread for each email creates 180,000 threads per hour. On average, only 50 times 0.2, which is 10, of them exist at the same moment, so a small group of threads that are used again and again could send the same emails.

Such a group is called a thread pool. The four questions cover why a pool is better than one thread per task, how it uses its queue, what is wrong with the ready-made pools, and how to size and stop one.

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content