• 請在 lilina.csie.ncnu.edu.tw 的個人目錄下先建立 up7 的子目錄. (注意大小寫). 在此目錄內置入這次作業所需檔案
    若你在自己電腦上寫作業, 請在上傳後測試一遍, 程式可否執行與是否正確 由 lilina 決定.
  • 作業所需檔案為:
    • Makefile (請參關 make 之相關文件)
    • README
    • 其它 .....
  • 作業說明:
    • 此作業模擬樂透開獎, 主程式一開始產生六個 thread. 每個 thread 負責產生一個 號碼, 不能重複. 其過程大略如下:
               create 6 threads
               count[1..42] = 0   /* initiate the count array */
               loop  
                 get six numbers, n[1..6], from threads
                 for i=1 to 6 do   count[n[i]]++    /* increase count */ 
               end loop 
               print the histogram
           
    • thread 與 thread 間的 sync control 請用 mutex 及 condtional variable, 不要用 semaphore.
    • 注意 random number 的 seed 必須每個 thread 都用自己的, 也就是 thread-specific .
  • 關於 Makefile 的要求:
    最少要有二個 target:
    default target: 產生所有的執行檔.
    clean: 清除所有的執行檔, *.o 及空檔等, 將目錄回復到只有 source 的狀態.
  • 關於 README 的要求:
    說明你的執行檔名字, 如何執行, 如何測試等.
  • Due day, 2004/05/19 00:05am