Adding Random Variables 與 Central Limit Theorem|Stanford CS109 第 15 堂
少數分布的 independent sums 有 closed form;一般 IID sums 則由 CLT 在大樣本下近似 Normal,離散 sums 還需 continuity correction。
少數分布的 independent sums 有 closed form;一般 IID sums 則由 CLT 在大樣本下近似 Normal,離散 sums 還需 continuity correction。
Bootstrap 把 sample histogram 當作 population proxy,以 replacement 重抽並重算 statistic,近似 estimator 的 sampling distribution、error bar 與 null p-value。
隨機程式的 expected cost 可依第一個 random choice 分情境;計數問題則拆成 indicators,兩者都靠 linearity,而不必硬求完整 distribution。
Surprise 把低機率事件轉成 bits;entropy 是 expected surprise,information gain 選擇最能降低 uncertainty 的問題,KL 則量化錯用 model distribution 的額外代價。
MLE 固定觀察資料、最佳化參數;log-likelihood 讓乘積變加總,但最大值也可能落在邊界。
Logistic regression 用 sigmoid 把線性分數變成 Bernoulli 機率,而 gradient xⱼ(y-ŷ) 直接來自 log-likelihood 的 chain rule。
比較 classifier 不能只看 accuracy;還要用 held-out data、baseline、calibration、precision/recall 與明確的 fairness criterion。
Neural network 是堆疊的 logistic units;forward pass 算機率,backpropagation 重用 output error 來計算所有 gradients。
第 1 講沿 1940 年代共用 I/O 卡片、batch processing、multiprogramming 與個人電腦的演變,解釋 OS 的功能如何隨硬體成本與使用者需求逐層增加。
第 2 講先定義行程與執行緒的共享/私有狀態,再用 fork、execvp、waitpid 與 thread creation 說明核心如何建立執行單位。
第 3 講沿 running、blocked、ready 狀態轉移,拆解 PCB、context save/restore 與 dispatcher 如何完成一次 CPU 控制權交接。
第 4 講逐步拆解 Too Much Milk 的失敗排程,從具體 interleaving 推導 race condition、atomicity、critical section 與正確同步條件。
第 5 講用容量為 8 的環形 Pipe 證明:mutex 只提供互斥;condition variable 才能在 predicate 不成立時原子地釋放鎖並阻塞;Mesa semantics 下,wait 返回後必須用 while 重查條件。
第 6 講從單核心關中斷一路修到多核心 v5,追蹤 guard、lock 與 wait queue,說明 atomic exchange、spin、block 與 wakeup 如何避免 race 和 lost wakeup。
第 7 講用 request/ownership graph 拆出 deadlock 的四個必要條件,再比較 detection、prevention 與 lock ranking;實務上最常破壞 circular wait,但代價是所有模組必須遵守同一個全域順序。
第 8 講從 FIFO、round robin 與不可實作的 SRPT,推到自適應 priority queues、BSD scheduler,再處理多核心 queue contention、core affinity 與 work-conserving 的衝突。
第 9 講沿著 source→assembly→object→executable→process,拆解 linker 的三次掃描、symbol relocation,以及 dynamic loader 如何用 jump table 把 shared library 位址延後到啟動時解決。
第 10 講從 stack 的可預測 LIFO,推到 heap 的 free lists、first/best fit 與 slabs,再比較 reference counting 和 mark-and-sweep 如何在 dangling pointers、leaks、cycles、fragmentation 間取捨。
第 11 講的官方 PDF 與 Lecture 10 逐位元組相同;本文誠實保留此 artifact 缺口,聚焦後半的 reachability、dangling pointers、leaks、reference-count cycles 與 mark/compact GC。
第 12 講把 trust 定義為自願承受 vulnerability,區分 over-trust 與 untrustworthiness,再用 assumption、inference、substitution 分析 Linux TCB、xz attack 與 AI code policy。