So far in this chapter, the focus has been data-centric—taking input and transforming it by using web workers to divide and conquer. This isn't the only use of worker threads; we can also use them to keep the DOM responsive for our users.
In this section, we'll introduce a concept that's used in Linux kernel development to split events into phases for optimal performance. Then, we'll address the challenge of communicating between the DOM and our workers and vice-versa.
The Linux kernel has the concept of top-halves and bottom-halves. This idea is used by the hardware interrupt request machinery. The problem is that hardware interrupts happen all the time, and it's this kernel's job to make sure they're all captured and processed in a timely-manor. To do this effectively, the kernel splits the task of processing a hardware interrupt into two halves—the top and bottom half.
It's the job of the top-half to respond to external stimuli, such as a mouse click...