You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit dbfc716
Browse filesBrowse the repository at this point in the historyBrowse files
feat: teach threading's data race on the canvas (phase 8)
A thread is a call running in its own frame that shares the module heap and
is preempted after every statement (not just at a yield, the way a coroutine
is). join is the scheduler: it round-robins the started threads one statement
at a time, so two threads on one box visibly interleave on the shared memory.
lock.acquire() on a held lock blocks the caller until the holder release()s.
- thread/lock value shapes + guards (target/name/status/pc/locals; held/holder)
- makeThread/makeLock, threadStart/threadJoin, lockAcquire/lockRelease
- stepThread steps exactly one statement; a blocked acquire does NOT advance pc
- canvas thread/lock boxes with lifecycle status chips; RAM rows for both
- predicates isThread/threadStatus/differentThreads/isLock/lockHeld/lockFree/
listValueAt
- 5-ladder series: build a thread -> start+join -> the lost-update race
(box ends 1, not 2) -> the lock fixes it (box ends 2) -> block/wait capstone
- deep lesson ELI5->ELI-PHD + 2 schematics (lost update; lock critical section)
- docs: catalog now 55 levels / 13 series; asyncio exemplar marked shipped;
archetype inventory + roadmap updated
95 tests green (6 new threading engine tests).
| 8 | **asyncio**, threading/multiprocessing | a coroutine; the tick loop; a lock | `coroutine`/`task`/`eventloop` (or `Thread`) | #9, #10, #11 | ★★★ |
512
+
| 8 | **asyncio** ✅ | a coroutine; the tick loop | `coroutine`/`task`/`eventloop` | #9 | ★★★ |
513
+
| 8 | **threading** ✅ | a call in its own frame sharing the heap, preempted per statement; a lock serializes a critical section | `thread`/`lock` | #11, #16 | ★★★ |
514
+
| 8 | multiprocessing | a process is a *separate* heap (no sharing) | `Process` | (fork picture) | ★★ |
477
515
| 9 | matplotlib, plotly | a Figure/Axes **is an object**, not magic | `Figure`/`Axes`, `Figure` | (artist chips) | ★ |
0 commit comments