I am going to drive this metaphor into the ground. It is not a perfect metaphor. It is a very leaky abstraction.
Many balls on the table
A good way to think of a system is to imagine a pool table. Imagine pool balls scattered randomly around the table. Now, a pool shark walks up and hits the cue ball. The cue ball hits some other balls, one goes into a pocket, and the other balls roll to a stop.
The position of each ball represents the state of the system. The pool shark causes an external event that changes the state of the system. The player uses the stick to interrupt the system, and changes the state of the table. It is useful to think of the cue ball as an interrupt handler, and the colored balls as tasks. Every time one ball hits another, a message is passed to that “task”. The message to a pool ball from another pool ball that hits it is force and direction.
The pool table is a massively parallel machine. Each ball acts on a message immediately. In a single processor system this could not happen. Think about a pool table where only one ball could be moving at once. That models a one processor system.
The way to make one processor look like many is to time slice each process. The pool table also models a time slice operating system making it appear as if more than one ball is moving at a time. Imagine each ball moving a little bit at a time. Still only one moves at any given time, but it looks like they all make progress. If the switching is fast enough, to us slow-moving humans, we can not tell the difference from the real world massively parallel system.
Multicore has more balls
Adding more processors lets more than one ball, or task, be moving at a time.
OK, this is nice, but systems rarely have an event then everything settles to a complete stop before the next event happens.
Now, imagine 3 ten year old boys playing speed pool on the table in the basement. In speed pool, everyone has a cue ball. The only rule is that a player’s cue ball must come to a complete stop before a player hits it again. The other balls need not stop before any give player shoots. Now this is like a real system. One player can hit a ball into other balls already in motion. Chaos and interrupts are happening constantly, one interrupt can cause a chain reaction that affects other tasks that are executing.
As the designer of this system your job is easy. Just make sure nothing goes wrong and all the balls hit each other in the right order.
It is a useful mental model to help you visualize a system. That is a good thing.
Full details next post.