title: How does a Stream Thread in Kafka Streams switch between its task?
body: <p>I have been looking at understanding how in Kafka stream, a Stream Thread switch between the execution of the Tasks it is assigned with, but could not find the answer online.</p>
  <p>Thread pool are well understood in Java, we know we should not block in our code, as this can quickly lead to thread starvation. In other words, a task will execute until it finishes, then the thread takes anything else that has been submitted to the thread pool.</p>
  <p>Hence in the same spirit, I am wondering given that task read data that continuously come through their input partitions, which technically never ends, how does a Stream thread, switch between task?</p>
  <p>This information can be helpful in deciding how many task we are prepared to pack per stream thread, depending on what we know about our workload.</p>