請問可以用 make -j4 來編譯 kernel 嗎?? - BBS

Table of Contents

小弟我最近在學習編譯 world & kernel

在編譯 world 的時後, 在官網的 handbook

http://www.freebsd.org/doc/zh_TW.Big5/books/handbook/makeworld.html

看到這段

It is possible to specify a -j option to make which will cause it
to spawn several simultaneous processes. This is most useful on
multi-CPU machines. However, since much of the compiling process is
IO bound rather than CPU bound it is also useful on single CPU machines.

On a typical single-CPU machine you would run:

# make -j4 buildworld

make(1) will then have up to 4 processes running at any one time.
Empirical evidence posted to the mailing lists shows this generally
gives the best performance benefit.

小弟看到這邊有兩個疑問

(1) 為甚麼 compiling 這個動作是 io bound, 將一個語言編譯成另一個語

言應該需要大量的運算, 不是 cpu bound 嗎?

(2) 因為在文件後面編譯 kernel 時所下的指令是 make buildkernel

KERNCONF=MYKERNEL, 請問這邊可以改用 make -j4 buildkernel

KERNCONF=MYKERNEL 嗎?? 會因此而使得編譯時間變短嗎??

以上的問題爬文找不到解答

在這邊先感謝大家的回答 <(__)>

--

All Comments