計測したプログラム
Minix 3 SMP が何かもっさりしている感があり,Minix 2にはperlがなくて標準的なByte UnixBenchがそのままでは動かないので,取り敢えず以下のようなfork()
, wait()
をひたすら繰り返すプログラムをコンパイルして,/usr/bin/time -p
で時間を測ってみた。
/*
clang -Wall -static -O3 -ffunction-sections -fdata-sections -Wl,--gc-sections forktest.c
*/
#include <sys/types.h>
#include <sys/wait.h>
#include <errno.h>
#include <unistd.h>
#include <stdio.h>
int main(void) {
int counter=200000, exitcode;
pid_t r;
errno=0;
while (counter>0) {
r=fork();
if (r<0) { perror("fork():"); errno=0; }
if (r > 0) {/* parent */
if (wait(&exitcode)<0) { perror("wait():"); errno=0; }
else --counter;
/*fprintf(stderr, "%d\n", counter);*/
}
if (r==0) return 0; /* child */
}
return 0;
}
Minix を実機で動かすのは面倒なので,QEMU 6.2でqemu-system-i386 -machine pc -cpu pentium3-v1 -accel kvm -smp sockets=4 -m 1920M -net user -net nic,model=e1000 -drive discard=unmap,detect-zeroes=unmap,if=ide,file=ディスクイメージ.qcow2 -serial vc -serial vc -serial vc -serial vc -boot c
ですべてのOSを起動した。
計測結果
Debian 11 i386 (linux-image-686-pae
カーネル`)
Minix 2.0.4 from http://minix1.woodhull.com/pub/demos-2.0/VMWarePlayer/
Minix 3.4RC6 from http://download.minix3.org/iso/snapshot/
Minix current with SMP fix from https://github.com/Stichting-MINIX-Research-Foundation/minix/pull/292
めっちゃ遅いやんけ…😭SMPはいい加減に作ると遅くなるという教訓か…
比較に用いたQEMUディスクイメージ
http://p1437140-ipoe.ipoe.ocn.ne.jp:63873/minixsmp/ にある。Minix3用ディスクイメージはカーネルコマンドラインに virtio_blk=yes
がついているが,IDEドライブから起動する場合にはそれを取らないと起動しないので注意。
さらなる比較
もっと幅広い比較をした人がおられたらコメント欄で教えて下さい