--- title: nickchenchj (陳浩容) categories: User ... 個人簡介 Personal profile ======================== - 姓名: 陳浩容 (Nick Chen) - 學號: E14056083 - Email: nickchenchj@gmail.com - GitHub: [https://github.com/nickchenchj](https://github.com/nickchenchj) 學歷 - 國立成功大學 機械工程學系 (2016-) - 國立成功大學 資訊工程學系 (2016-) 2021 Linux Internals 個人評量 ============================ 作業及筆記 --------- - Homework1: * [開發紀錄 (lab0)](https://hackmd.io/@nickchenchj/2021q1-homework1-lab0) / [GitHub](https://github.com/nickchenchj/lab0-c) * [開發紀錄 (quiz1)](https://hackmd.io/@nickchenchj/2021q1_quiz1) - Final Project: * [開發紀錄 (fiber)](https://hackmd.io/@nickchenchj/linux2021-quiz6c) / [GitHub](https://github.com/nickchenchj/ncku-linux-kernal-internals/tree/main/quiz6c) 題目 ---- 1) 知道如何寫出時間複雜度和空間複雜度皆為 O(1) 的 abs64 嗎?(沒有分支) 這樣的 abs64 又可用於真實世界哪邊? * ```cpp= #include int64_t abs64(int64_t x) { /* The following code works for both arithmetic shift and logical shift. * y is -1 (all ones) if x is negative, and y is 0 if x is non-negative. */ int64_t y = ~(((x >> 63) & 1) - 1); /* XORing with all ones (-1) inverts all the bits of (x + y), * while XORing with all zeros (0) keeps the original value */ return (x + y) ^ y; } ``` 2. 知道 page fault 嗎?Segmentation fault 的訊息是如何顯示出來,請以 GNU/Linux 為例解說 * page fault 可細分為 3 種,分別為 minor, major, 和 invalid。 * minor: 當 process 嘗試存取資料,發現資料已在記憶體裡,但尚未分配給自己。 * major: 當 process 嘗試存取資料,但資料不在記憶體裡。 * invalid: 當 process 嘗試存取不在 virtual memory space 裡的資料時會觸發 invalid page fault (segmentation fault)。 * 當 process 遇到 segmentation fault 時,GNU/Linux 會傳遞 SIGSEGV 的 signal 到該 process,這個 signal 會讓 process 顯示 "segmentation fault" 並且結束執行。 學會的工具 ------------ Vim, find, grep, sed, awk, wc, du... 心得 ------------ 本課程讓我印象最深刻的是 concurrency 和 parallelism 的重要性。這學期我參加了一項機器學習的競賽,我在處理 data augmentation 時都是使用單一執行緒,導致產生資料集的效率低落,但聽過幾堂老師的課之後,我才了解到原來透過並行或平行處理的方式可以有效提升程式的效率,但需要妥善分配任務並且要考量到許多單執行緒不會出現的問題。而我也了解到目前我欠缺的是切分任務和有效切換執行緒的實作經驗,儘管現階段無法獨立撰寫出 SPSC, MPSC, SPMC, MPMC 的程式,但我會將未來的學習重點放在這個部份。 自我評量分數 (1 到 10 級分) ------------------------ 7 級分,我認為我沒有在這堂課投入足夠多的時間,因此實作成果有限,但我仍在本學期看了許多實作手法和技術文件,包括 user-level thread 的實作,read/write 運作原理等等。此外,我覺得最實用的進步就是可以透過 terminal 來進行資料處理以及程式開發。我學會如何用 Vim 來撰寫程式,學會看 man page,也學會使用部份的 Git 功能。同時我也學會透過 grep, find 和 sed 等指令來尋找和處理資料。 2020 秋季班 個人評量 ================== 作業及筆記 --------- - Homework1: * [開發紀錄 (lab0)](https://hackmd.io/@nickchenchj/sysprog2020_lab0) / [GitHub](https://github.com/nickchenchj/lab0-c) * [開發紀錄 (quiz1)](https://hackmd.io/@nickchenchj/sysprog2020_quiz1) / [GitHub](https://github.com/nickchenchj/System-Programming) - Homework2: * [開發紀錄 (quiz2)](https://hackmd.io/@nickchenchj/sysprog2020_quiz2) - Homework3: * [開發紀錄 (quiz3)](https://hackmd.io/@nickchenchj/sysprog2020_quiz3) * [開發紀錄 (dict)](https://hackmd.io/@nickchenchj/dict) / [GitHub](https://github.com/nickchenchj/dict) - Homework4: * [開發紀錄 (quiz4)](https://hackmd.io/@nickchenchj/sysprog2020_quiz4) Side projects ------------- - External sorting: [documentation](https://hackmd.io/@nickchenchj/external_sorting) / [GitHub](https://github.com/nickchenchj/external-sorting) - ETL process: [documentation](https://hackmd.io/@nickchenchj/ETL_Process) / [GitHub](https://github.com/nickchenchj/ETL-process) - Key-value database: [documentation](https://hackmd.io/@nickchenchj/key-value-storage) / [GitHub](https://github.com/nickchenchj/key-value-database) 題目 ------------ 1. 知道 x - y < 0 敘述為何不能寫為 x < y 嗎? (CS:APP 第 2 章) * 如果 x = 1U, y = 2U,則 (x - y < 0) 永遠為 false (overflow),但 (x < y) 將會是 true。 2. 知道 void (*signal(int sig, void (*handler)(int))) (int); 這樣的宣告該如何解讀嗎? * signal 是一個回傳 pointer to function 的 function,signal 的參數是一個 int 和一個叫做 handler、參數為 int、且回傳型態為 void 的 function。signal 所回傳的 pointer to function 指向參數為 int、回傳型態為 void 的 function。參考: [Understanding typedefs for function pointers in C](https://stackoverflow.com/a/1591492), [cdecl: C gibberish ↔ English](https://cdecl.org/) 3. 知道傅立葉分析在通訊領域的應用嗎?舉例說明 * 可以應用於抗噪耳機,或是去除通話中的噪音。 4. 知道 Bloom filter 嗎?以你寫過或用過的程式,舉例說明這機制帶來的好處 * 知道,這學期有實做 key-value database,當中有運用到 Bloom filter。由於資料庫相當龐大,而且取得資料可能需要進行檔案存取,因此引進 Bloom filter 將能大幅降低在資料庫搜尋的時間。 學會的工具 ------------ Git, Perf, Valgrind, Markdown, Makefile, Bash script, gnuplot, etc.