X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pintos-anon;a=blobdiff_plain;f=src%2Fthreads%2Finit.c;h=b89b282435ffa4fd284c776049dcc4c45a60c66c;hp=5893ce970b21fe12f707e4c3be55767e31c0034f;hb=0fd3a243b790dd1cfc9e0a40c57dddde56cf344d;hpb=ed04361f6ec91e4f0db1550c2cc487a461b2d17b diff --git a/src/threads/init.c b/src/threads/init.c index 5893ce9..b89b282 100644 --- a/src/threads/init.c +++ b/src/threads/init.c @@ -13,6 +13,7 @@ #include "devices/serial.h" #include "devices/timer.h" #include "devices/vga.h" +#include "devices/rtc.h" #include "threads/interrupt.h" #include "threads/io.h" #include "threads/loader.h" @@ -251,6 +252,16 @@ parse_options (char **argv) else PANIC ("unknown option `%s' (use -h for help)", name); } + + /* Initialize the random number generator based on the system + time. This has no effect if an "-rs" option was specified. + + When running under Bochs, this is not enough by itself to + get a good seed value, because the pintos script sets the + initial time to a predictable value, not to the local time, + for reproducibility. To fix this, give the "-r" option to + the pintos script to request real-time execution. */ + random_init (rtc_get_time ()); return argv; }