Faster than Lightning! Racing on Sorting Networks to Instantly Understand Supercomputer Parallel Computing

不插電排序網路教案:在地上畫網路讓孩子賽跑排序,體驗平行運算為什麼快。六人一組、粉筆就能玩,改寫自 CS Unplugged,附規則圖解與延伸挑戰,適合國小團體活動。

我們都知道電腦很快,但你知道電腦變快的秘訣是什麼嗎? 以前的電腦像是一個廚師只有一個爐子,煮完湯才能炒菜(這叫序列處理)。 現在的超級電腦,像是有幾十萬、甚至上百萬個廚師同時在切菜、煮飯(這叫平行處理)。 今天要帶孩子到戶外,用粉筆畫出一個「排序網路 (Sorting Network)」,讓他們化身為數據賽車,體驗不需要指揮官,只要跟著線走,就能自動排好順序的神奇魔法!

Phase 1: One Person's Limit

First, let's experience what it feels like to have "only one brain."

  1. The Mission Setup:
    • Find 6 children (or use dolls/stuffed animals). Give each one a random number card.
    • The Rules: "I am the only Computer CPU. You need to get in line, but you cannot move on your own. You must wait for my command."
  2. Sequential Processing:
    • The Teacher/Parent begins directing: "Number 3, go to the first spot... Number 5, swap places with Number 2..."
    • Observation: While the parent is directing Person A, Persons B, C, and D are just standing there staring into space.
    • Question: "Did you notice that you spent most of your time just 'waiting'? If I had to sort 100 people this way, would the last person fall asleep before I got to them?"

Phase 2: The Magic Circle on the Ground

Now, we will draw a track that allows everyone to "move without thinking and still get it right."

  1. Drawing the Map:
    • Using reference materials (search for "6-wire sorting network"), use chalk or tape to draw the "Sorting Network" on the ground. It looks like a series of crisscrossing tracks connected by circles (nodes).
    • Clearly mark the "Entrance" and the "Exit."
  2. Explaining the Rules:
    • "This is an auto-pilot race track. You are all racecars holding your number cards."
    • The Mantra: 「"Stop at the circle, compare your might, then split to the left or right!"」
    • The Golden Rule: 在圓圈相遇時,以自己前進的方向為準,數字小的走自己的左手邊(圖畫成橫的就是上面那條路),數字大的走右手邊(下面的路)。

Phase 3: Racing Against Time

This is the climax of the activity. Children will witness with their own eyes how "Order" automatically emerges from "Chaos."

  1. On Your Marks:
    • 6 children holding random number cards (e.g., 5, 1, 6, 3, 4, 2) stand in the six starting boxes at the Entrance.
  2. Start the Engine:
    • The Teacher/Parent shouts: "Start!"
    • The children walk along the lines.
    • Step 1: Meet a partner, compare numbers, split paths.
    • Step 2: Meet a new partner, compare again, split again.
    • Observation: 很多比較是同時發生的,等待的時間比一個人指揮時少非常多!
  3. The Finish Line:
    • When everyone reaches the Exit, ask them to hold up their cards.
    • The Surprise Moment: "Oh my goodness! The numbers were messy, but now they are perfectly lined up: 1, 2, 3, 4, 5, 6!"
    • Teacher/Parent : "Did I give you any commands? No! The Map (The Algorithm) sorted you automatically!"

Phase 4: Concept Connection

Why is this Faster?

  • Teacher/Parent: "We were running around just now, and we actually performed about 12 comparisons (checking who is bigger). But it felt like it only took a tiny bit of time. Why?"
  • Child: "Because we all did it at the same time!"
  • Teacher/Parent: "Bingo! That is the secret of Supercomputers. It is called 'Parallel Processing.'"
  • 應用場景: 氣象預報要同時計算全臺灣每個地點的天氣、AI 要同時處理上百萬筆資料——這種「一個人算到天荒地老」的工作,就是靠很多顆 CPU 像很多隻手一樣分工同時完成。
  • 一個人指揮=1 顆 CPU、12 步;一起跑=最多 3 組同時比=3 顆 CPU、只要 5 輪;快了 2.4 倍。「為什麼不是剛好 3 倍?」

Phase 5: Debug & Challenge

What if the Rules Change?

Test the children's understanding of the algorithm's logic by tweaking the rules.

  • Challenge 1: Reverse Thinking
    • Question: "If we flip the rule: 'Big goes Left, Small goes Right,' what do you think will happen to the result?"
    • Experiment: Let the children run the course again.
    • Discovery: The final order becomes largest to smallest (6, 5, 4...)!
  • Challenge 2: Music and Words
    • Question: "Does this magic track only work for numbers?"
    • Experiment: Try using cards with letters (A, B, C, D) or different musical notes (Do, Re, Mi).
    • Conclusion: Anything that can be "compared" (Greater than / Less than) can be sorted by this network!

Teaching Observation Checklist

This chart helps you guide the child to observe the power of "Parallelism" rather than just focusing on winning or losing.

Observation PointLess Effective ResponseMore Effective Scaffolding
When a child goes the wrong way"You went the wrong way. Start over.""Hmm? It looks like there is a 'traffic jam' here. If you are holding 5 and he is holding 3, according to the 'Small Left, Big Right' rule, where should the track take you?" (Attribute the error to execution logic, not the child's ability)
Explaining the complex lines"This is just the formula for the sorting network.""This is like designing a conveyor belt in a factory. As long as the belt (lines) is drawn correctly, no matter what numbers you throw in, a tidy product comes out. That is the power of automation!"
Comparing Sequential vs. Parallel"Parallel processing is faster.""If you were alone (like cooking on one stove), how would you do it? If you had many people (four stoves), how would you do it? Which one saves more time?"

Suggestions for Teachers & Parents

"Chalk and Floor" are the best tools for this lesson. Do not play this on paper; you must let the children move.

When a child stops at a circle to wait for a partner to arrive, that is a perfect demonstration of "Synchronization." In parallel computing, the fast processes often must wait for the slow ones to arrive before the next comparison can happen. This physical act of "waiting" is excellent embodied learning!

順便提一下,雖然這被稱為“網路”,但它只是資訊科學中眾多網路類型中的一種。常見的「網路」是通訊網路,例如行動電話使用的電信網路,當然還有網際網路!此外,還有一些網路用於表示諸如路線圖和航線之類的資訊。需要注意的是,本活動中的排序網路並非上述任何一種網路類型,它被稱為比較器網路,因為在這種網路中,每個節點比較的是兩個值,而不是將不同的裝置(例如手機和計算機)連接在一起。

排序網路演示

網路大小
排序模式
速度
1.0x
移動次數
0
進度
0/6
網路拓撲圖
INPUT
COMPARATOR
OUTPUT

Reference :csunplugged sorting networks

延伸閱讀