Click to See Complete Forum and Search --> : Simple Analogy to Explain Threads


Lee Cheon-Sin
May 15th, 2006, 07:09 PM
1. You have a program. That is your city.
2. Your program is single-threaded. You have one road for the city-dwellers to use. All the cars are getting to their destinations—but there is much traffic congestion, because the cars in front have to move before the cars behind can move.
3. Your program is multi-threaded. You have many roads and intersections. Cars are crashing into each other because the of the absense of traffic signals.
4. Your program uses Mutexes and Semaphores. You have traffic lights to control the traffic. All the cars run smoothly, and get to their destinations in a timely manner.

wildfrog
May 15th, 2006, 09:10 PM
5. You're sitting at the kitchen table, about to eat your breakfast.
6. You: Mom, can you plaase pass the bread!?
7. While wainting for your mother to pass you the bread you pour cofffee (or thea or whatever) into your cup.

That is multithreading. ;)

- petter

Kheun
May 15th, 2006, 10:31 PM
5. You're sitting at the kitchen table, about to eat your breakfast.
6. You: Mom, can you plaase pass the bread!?
7. While wainting for your mother to pass you the bread you pour cofffee (or thea or whatever) into your cup.

That is multithreading. ;)

- petter
Wow! You guys sure are applying multithreading in everyday life. :D