[Process and Synchronization: 10%] (1) What is the priority inversion problem? How can we solve this problem? (4%) (2) Please explain how a deadlock avoidance scheme works? (3%) (3) Please give three necessary conditions for any solution to the critical-section problem. (3%)
(1) priority inversion:高優先權的 H 要用的資源(lock)被低優先權的 L 持有,H 只能等;此時若中優先權的 M 可執行,會搶走 L 的 CPU,結果 M 比 H 先跑,優先權被反轉,H 的等待沒有上界
解法:priority-inheritance protocol——持有資源的 process 暫時繼承所有等它的 process 中最高的優先權,M 就搶不走;放掉資源後還原
(3) mutual exclusion:同時最多一個 process 在 critical section
progress:沒人在 critical section 時,只有想進去的 process 參與決定誰進,且不能無限期延後
bounded waiting:提出進入要求後,別的 process 先進入的次數有上界
210%
[File System and I/O: 10%] (1) What is a mount point? (2%) (2) What is the advantage of multilevel naming? (2%) (3) What are the two parts of the random-access time for a magnetic disk? (2%) (4) Please explain the two interrupt request lines for a CPU? (4%)
(1) mount point:既有檔案系統中用來掛載另一個檔案系統(volume)的目錄;掛上後走到該目錄看到的是新檔案系統的 root,原目錄內容被遮住,unmount 後才回來
(2) multilevel(階層式)naming:以完整 path name 識別檔案,不同目錄可有同名檔案而不衝突;每個使用者只搜自己那一層,搜尋範圍縮小;便於分類、共享與存取控制
[Memory Management: 15%] (1) Please explain the three common solutions to the dynamic storage allocation problem in memory. (6%) (2) What are the purposes of MMU and TLB? (2%) (3) Show that a stack algorithm will never encounter the Belady's anomaly. (4%) (4) How does the Buddy system work to allocate kernel memory? (3%)
[Protection and Security: 15%] (1) Please give three methods to implement a protection domain and explain when domain switching will occur in each method. (3%) (2) Please list the advantages of using language-based protection. (4%) (3) What is the difference between a computer virus and a computer worm? (4%) (4) In asymmetric encryption, how do you realize key distribution? (2%) (5) What is the difference between signature-based and anomaly detection? (2%)
(1) 每個 user 一個 domain:換使用者(登入/登出)時 domain switching
每個 process 一個 domain:process 送訊息給另一個 process 並等回應時切換
[Hash and Heap: 10%] (1) Supposing that we store n keys in a hash table with size of n2 by a universal hash function, prove that the collision probability is less than 0.5. (5%)
(2) Given a binomial heap below, please show the result of extracting the node with minimum key. (5%)
Binomial heap(head → root list):40 → 13 → 4。40 的 child 是 44;13 的 children 是 31(其 child 80)與 16;4 的 children 是 9、19、15、28,其中 9 的 children 是 11、17、32(11 的 children 14、20,14 的 child 30;17 的 child 41),19 的 children 是 29、26(29 的 child 45),15 的 child 是 21。
[Search and Sort: 10%] (1) What is the major property of a binary search tree? (2%) (2) Given a set of numbers 8, 2, 7, 9, 14, 16, 3, 1, 4, and 10, draw the heap used by the heapsort method. (5%) (3) Prove that the best-case complexity of the quicksort method is O(n lgn). (3%)
[Trees: 15%] (1) What are the two major properties of a tree? (2%) (2) Prove that any red-black tree with k internal nodes can have a height no more than 2lg(k+1). (10%) (3) Explain three variants of a B-tree: B+-tree, B*-tree, and 2-3-4 tree. (3%)
[Graphs: 15%] Given a graph below, please answer the following questions, where you should denote an edge between two vertices i and j by (i,j).
(1) Starting from node E, give the sequence by breadth-first-search. If you have multiple choices, just follow the alphabetical order. (3%) (2) Starting from node D, give the sequence by depth-first-search. If you have multiple choices, just follow the alphabetical order. (3%) (3) Show the result by the Kruskal's algorithm. (3%) (4) Starting from node I, show the result by the Prim's algorithm. (3%) (5) Show the minimum connected dominating set. (3%)