# 2016q3 Homework3 (mergesort-concurrent) contributed by <`HuangWenChen`> ## 開發環境 * Description : Ubuntu 16.04.1 LTS * linux kernel version : 4.4.0-38-generic * CPU : AMD A6-4455M APU with Radeon(tm) HD Graphics * Cache : * L1d cache : 16K * L1i cache : 64K * L2 cache : 2048K 可使用`$ lscpu` and `$ cat /etc/os-release` 查看規格 ## 簡單測試 * 參考閱讀 [A07: mergesort-concurrent](https://hackmd.io/s/rJ-GWtJ0) ```shell $ make $ ./sort ``` 程式輸出,提示以下用法: `usage: ./sort [thread_count] [input_count]` 在 GNU bash 中,可善用 $RANDOM 環境變數,取得介於 0~32767 之間的亂數,下指令來作自動測試。 ```shell $ (for i in {1..8}; do echo $RANDOM; done) | ./sort 4 8 ``` 結果 ``` input unsorted data line-by-line sorted results: [570] [7158] [9019] [15576] [22505] [22590] [27815] [28834] ``` 但是在 Z Shell 重複下此指令會產生相同數值,在 bash 無發生此問題。 ``` RANDOM <S> A pseudo-random integer from 0 to 32767, newly generated each time this parameter is referenced. The random number generator can be seeded by assigning a numeric value to RANDOM. The values of RANDOM form an intentionally-repeatable pseudo-random sequence; subshells that reference RANDOM will result in identical pseudo-random values unless the value of RANDOM is referenced or seeded in the parent shell in between subshell invocations. ``` 上網查了有關RANDOM的[文件](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=828180)。