LoginSignup
1
0

More than 1 year has passed since last update.

Minix は Linux より速かった(?)

Posted at

計測したプログラム

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カーネル`)

スクリーンショット_2022-03-27_05-04-48.png

Minix 2.0.4 from http://minix1.woodhull.com/pub/demos-2.0/VMWarePlayer/

CCに-O2を付けてコンパイルし直した。かなり速い…😱
スクリーンショット_2022-03-27_05-54-20.png

Minix 3.4RC6 from http://download.minix3.org/iso/snapshot/

スクリーンショット_2022-03-27_09-41-05.png

Minix current with SMP fix from https://github.com/Stichting-MINIX-Research-Foundation/minix/pull/292

めっちゃ遅いやんけ…😭SMPはいい加減に作ると遅くなるという教訓か…
スクリーンショット_2022-03-27_09-44-54.png

比較に用いたQEMUディスクイメージ

http://p1437140-ipoe.ipoe.ocn.ne.jp:63873/minixsmp/ にある。Minix3用ディスクイメージはカーネルコマンドラインに virtio_blk=yesがついているが,IDEドライブから起動する場合にはそれを取らないと起動しないので注意。

さらなる比較

もっと幅広い比較をした人がおられたらコメント欄で教えて下さい

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0