# 2024q1 Homework5 (assessment) contributed by < `cheezad` > ## 測驗題改進 ## 〈因為自動飲料機而延畢的那一年〉 [第八篇](https://blog.opasschang.com/the-story-of-auto-beverage-machine-8/),作者提到: > 一項產業進步的速度,很大程度取決於做實驗修正問題的速度 這幾個禮拜在做作業時,發現自己有很大的時間在想要怎麼證明我這麼做確實有改進到程式。[作業二](https://hackmd.io/@cheezad/linux2024-homework2)中原本預期用 random pivot 會比 median of three 好,但是自己實驗只有測試一組數據,因此要再找時間重新設計一個多次比較的腳本並用 gnuplot 把數據視覺化出來。 [第十二篇](https://blog.opasschang.com/the-story-of-auto-beverage-machine-12/),作者轉述老師的話: > 「你最大的問題在太害怕失敗了,既然都已經決定要延畢做飲料機了,那就要好好做,才不會辜負當初自己的期望。你可以計算要花多少錢,然後評估自己可以接受多少損失,畢業後慢慢還都好,要錢我也可以借你。但青春很貴,你也知道實習會發生什麼事,公司不會指派重要的工作給你,他們只會指派低風險的工作,你學習到的東西並不會比你現在多。你該學習的不是看到事情要完蛋了就去避免失敗,而是應該學習如何處理與承受失敗,你才能變得比以前更強大。」 我在第一次作業出來之後,就開始努力讓 lab0 的 GitHub action 上出現卡比。好不容易東拼西湊出卡比之後,剩下的其他項目都是沒有分數可以量化的,我就開始逃避。我覺得自己應該做不出來或是做的一定比別人差,再加上那時候感冒,變用這個藉口來逃避剩下的作業。每次老師上課都會用各種方法刺激我們進步,前幾個禮拜終於不再逃避,重新開始做作業。現在我知道前幾個禮拜的逃避讓我進度上落後很多,但這次我選擇按照自己的節奏慢慢的把進度追回來(雖然不認為在學期末可以追上,但至少過程中會學到很多)。目前作業和教材的閱讀參差著處理。 [第二十三篇](https://blog.opasschang.com/the-story-of-auto-beverage-machine-23/) > 這個世界比任何人都殘酷,也比任何人都公平,犧牲了多少就會得到多少。飲料機現在能做到的事,就只是付出犧牲的結果罷了。 現在看到很多同學進度在我前面很多,除了因為他們基礎比我扎實以外,還有他們前幾個禮拜的努力。現在我需要再努力一點才能稍微趕上他們。 > 對你而言真正重要的事物,會比你想得到的事物更早出現在路邊。 這句我目前還無法理解,但我相信未來會了解他的含義的。 ## 研讀教材 Demystifying The Linux CPU Scheduler - 1.2.4 User and kernel stacks >The order of the page size varies based on the different order of the page size. The order of the page size of 32-bit system is 1, resulting in a stack size of 8KiB (4KiB << 1 = KiB). For 64-bit systems the kernel stack size is 16 KiB because the order of the page size equals 2. I could not understand what "the order of the page size" mean. Solved: The meaning of the phrase ["The order of".](https://www.collinsdictionary.com/dictionary/english/of-the-order-of) - 2.3 Completely Fair Scheduler (CFS) > CFS solves this problem by assigning to each process a timeslice and, when it expires, schedules the task with the smallest virtual runtime. At each scheduling point where the process runs for time t. Then, it increases the virtual runtime by t × weight (based on priority), as shown in Figure 2.13. ![Screenshot 2024-04-23 at 2.32.12 PM](https://hackmd.io/_uploads/Hk6lICVbA.png) > 2.3.1 > Now consider a case where two tasks share the CPU, one with nice=0 and the other with nice=5. CFS assigns these nice levels the weights of 1024 and 335, respectively. I don't understand how vrun increases by `t * weight`, and smaller nice value(higher priority) have bigger weight but vrun is smaller. Solved: The formula of virtual runtime is defined as $$ vruntime = delta\_exec * {weight\_of\_nice\_0\over task\_weight} $$ The `weight_of_nice_0` and `task_weight` according to the formula provided in 2.3.2 would be 1024 and 1024/(1.25)^n^ respectively. Formula weight is: $$ w(n) = {2^{10} \over ({5 \over 4})^n} $$ ## 想投入的專案 目前因為進度落後很多以及基礎不夠扎實,因此專案希望就是把前幾週的作業全部 <s>補齊</s>,並繼續研讀教材。 MCTS 的原理? search tree PRNG 品質 fixed point arithmetic perf, valgrind Homework3 在經過和老師一對一的討論之後,自己需要改進的地方: 1. 自己平常讀書應付考試的方法不是真正學習該有的態度。不應該速讀過教材,如果只是速讀,AI在這點做的比人類還快而且更好。 2. 詳細記錄自己不會的地方。遇到不會的東西記錄下來並找到答案,因為他可能是整篇最關鍵的點。 3. 改善口語表達以及學會抓重點。明確地講出一個演算法的重點,尤其是他和其他演算法不一樣的地方。