Month: October 2016

  • Mutex, Semaphore, the difference, and Linux kernel

    Mutex, Semaphore, the difference, and Linux kernel

    名詞定義 Mutex: Linux kenrel 中的 mutex lock, <include/mutex.h> Semaphore: Linux kernel 中的 semaphore, <include/semaphore.h> mutual exclusion: 中翻互斥鎖,一個概念,為了防止 concurrency 狀況下出現 race condition.   Mutex 與 Semaphore 最大的差異是: 理論上,你應該要先跟面試官或是問你這個問題的人互動,詢問一下其所謂的差異是指哪個部份 (實作、用途、還是結構?),以及詢問這個問題時,想要將兩者應用在那邊,對於後續的回答會有所幫助。 30秒:最大的差異在於 Mutex 只能由上鎖的 thread 解鎖,而 Semaphore 沒有這個限制,可以由原本的 thread 或是另外一個 thread 解開。另外,Mutex 只能讓一個 thread 進入 critical section,Semaphore 的話則可以設定要讓幾個 thread 進入。這讓實際上使用 Mutex 跟 Semaphore 場景有很大的差別。 _ 60秒 (cont.):舉例而言,Mutex 的兩個特性:一個是只能有持鎖人解鎖、一個是在釋放鎖之前不能退出的特性,讓…

  • 大學分組專題概況

    orginal post: https://www.facebook.com/itsfoss/posts/776176455856457:0

  • LaTex Big O notation 速記

    這邊整理一下在 LaTex 裏面如果要使用到 Big-O notation 的話要怎麼使用。 $\mathcal{O}(1)$ [latex]$\mathcal{O}(1)$[/latex] $\mathcal{O}(\log{} n)$ [latex]$\mathcal{O}(\log{} n)$[/latex] $\mathcal{O}(n)$ [latex]$\mathcal{O}(n)$[/latex] $\mathcal{O}(n \log{} n)$ [latex]$\mathcal{O}(n\log{}n)$[/latex] $\mathcal{O}(n ^ 2)$ [latex]$\mathcal{O}(n^2)$[/latex] $\mathcal{O}(2 ^ n)$ [latex]$\mathcal{O}(2^n)$[/latex] $\mathcal{O}(n!)$ [latex]$\mathcal{O}(n!)$[/latex]

  • Improving IPC by Kernel Design 閱讀摘要

    Improving IPC by Kernel Design 閱讀摘要

    Improving IPC by Kernel Design HackMD: https://hackmd.io/s/SklN6PRC Thesis Information Links: http://sci-hub.cc/10.1145/173668.168633 Author: Jochen Liedtke German National Research Center for Computer Science (GMD) citation: Jochen Liedtke. 1993. Improving IPC by kernel design. ACM SIGOPS Operating Systems Review SIGOPS Oper. Syst. Rev. 27, 5 (January 1993), 175–188. DOI:http://dx.doi.org/10.1145/173668.168633 Outline Abstract The IPC Dilemma Related Work L3 – The…

  • Debug f9-kernel make config 的 ncurses 按鈕顏色問題
    黑白人生

    Debug f9-kernel make config 的 ncurses 按鈕顏色問題

    今天要講的是修改 f9-kernel menu config 下排按鈕顏色跑掉的問題。 會發現這個問題是因為把 f9-kernel clone 下來想要編譯,在要做 config 的時候發現這個問題。可以從上圖左邊看到 Linux kernel 的 make menuconfig 下排的 button 是有對比顏色的 (<Select> tag active 是黃色的、<Exit> tag 是紅色的),上圖右邊 f9-kernel make config 的部份則是灰色的而已。 這個 bug 花了 3 小時解完,實在是因為我是新手才會遇到這樣的問題。下面會紀錄我這次的 debug 步驟,以及遇到這種情況可以怎麼解的步驟,寄望後人不要為了這種鳥問題而被困住 3 小時。   0. Linux kernel 好像也有這個東西… Linux kernel 也有相對應於 f9-kernel make config 的 make menuconfig,了解這件事情之後,我先strace make menuconfig看發生什麼事情,之後轉用ltrace make menuconfig觀察。不過沒有觀察到什麼有用的東西。 1. 找尋 make config實際發生的事情…