動作環境
PetaLinux 2014.4
MicroZed
2014年のメモより。
T-1. 標準スタックサイズ on MicroZed
ここにあるプログラムにてPOSIXスレッドの標準スタックサイズを計測できる
MicroZed上でPetaLinuxを起動して実行してみたのが以下。
root@zynq-microzed-z7010:~# /bin/myapp
Default stack size 8388608[8M]; guard size 4096 minimum is 16384[16K]
set stack size is 1023410176 [976M] pthread_create error. [11][Resource temporarily unavailable]
memory allocate is 1023410176 [976M] malloc error. [12][Cannot allocate memory]
inner thread : [0xb6bfee54]
inner thread : [0xb63fde54]
デフォルトでは8MBとのこと。
上記、pthread_createとmallocにてエラーがでている。
T-2. POSIX スレッドのimplementationの確認
$ getconf GNU_LIBPTHREAD_VERSION
NPTL 2.12
NPTL : Native POSIX Thread Library
T-3. command > 設定可能な優先度の範囲表示
util-linuxパッケージに含まれる chrt コマンドを使う
$ chrt -m
SCHED_OTHER min/max priority : 0/0
SCHED_FIFO min/max priority : 1/99
SCHED_RR min/max priority : 1/99
SCHED_BATCH min/max priority : 0/0
SCHED_IDLE min/max priority : 0/0
優先度を設定する場合、 SCHED_FIFO を使うことになる。 上記にて 1 から 99 の範囲で設定できることが分かる。
優先度は、数値が大きい方が優先度が高い。