diff --git a/.dir-locals.el b/.dir-locals.el new file mode 100644 index 0000000..2676c09 --- /dev/null +++ b/.dir-locals.el @@ -0,0 +1,2 @@ +((c-mode . ((indent-tabs-mode . nil) + (c-basic-offset . 4)))) diff --git a/.gitignore b/.gitignore index 8621919..5555472 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,5 @@ a.out *.log *.exe chytesting +disk0 +*.orig diff --git a/labcodes/lab1/.projectile b/labcodes/lab1/.projectile new file mode 100644 index 0000000..e69de29 diff --git a/labcodes/lab2/.projectile b/labcodes/lab2/.projectile new file mode 100644 index 0000000..e69de29 diff --git a/labcodes/lab3/.projectile b/labcodes/lab3/.projectile new file mode 100644 index 0000000..e69de29 diff --git a/labcodes/lab4/.projectile b/labcodes/lab4/.projectile new file mode 100644 index 0000000..e69de29 diff --git a/labcodes/lab5/.projectile b/labcodes/lab5/.projectile new file mode 100644 index 0000000..e69de29 diff --git a/labcodes/lab5/Makefile b/labcodes/lab5/Makefile index d5ea58f..f416699 100644 --- a/labcodes/lab5/Makefile +++ b/labcodes/lab5/Makefile @@ -294,6 +294,9 @@ MAKEOPTS := --quiet --no-print-directory run-%: build-% $(V)$(QEMU) -parallel stdio $(QEMUOPTS) -serial null +run-nox-%: build-% + $(V)$(QEMU) -serial mon:stdio $(QEMUOPTS) -nographic + build-%: touch $(V)$(MAKE) $(MAKEOPTS) "DEFS+=-DTEST=$* -DTESTSTART=$(RUN_PREFIX)$*_out_start -DTESTSIZE=$(RUN_PREFIX)$*_out_size" diff --git a/labcodes/lab6/.projectile b/labcodes/lab6/.projectile new file mode 100644 index 0000000..e69de29 diff --git a/labcodes/lab6/Makefile b/labcodes/lab6/Makefile index fe161c0..7f21bcf 100644 --- a/labcodes/lab6/Makefile +++ b/labcodes/lab6/Makefile @@ -294,6 +294,9 @@ MAKEOPTS := --quiet --no-print-directory run-%: build-% $(V)$(QEMU) -parallel stdio $(QEMUOPTS) -serial null +run-nox-%: build-% + $(V)$(QEMU) -serial mon:stdio $(QEMUOPTS) -nographic + build-%: touch $(V)$(MAKE) $(MAKEOPTS) "DEFS+=-DTEST=$* -DTESTSTART=$(RUN_PREFIX)$*_out_start -DTESTSIZE=$(RUN_PREFIX)$*_out_size" diff --git a/labcodes/lab6/kern/schedule/sched.h b/labcodes/lab6/kern/schedule/sched.h index ca33799..766ac03 100644 --- a/labcodes/lab6/kern/schedule/sched.h +++ b/labcodes/lab6/kern/schedule/sched.h @@ -5,7 +5,7 @@ #include #include -#define MAX_TIME_SLICE 20 +#define MAX_TIME_SLICE 5 struct proc_struct; diff --git a/labcodes/lab6/user/priority.c b/labcodes/lab6/user/priority.c index bcbc29d..6a1cae4 100644 --- a/labcodes/lab6/user/priority.c +++ b/labcodes/lab6/user/priority.c @@ -5,7 +5,7 @@ #define TOTAL 5 /* to get enough accuracy, MAX_TIME (the running time of each process) should >1000 mseconds. */ -#define MAX_TIME 2000 +#define MAX_TIME 1000 unsigned int acc[TOTAL]; int status[TOTAL]; int pids[TOTAL]; diff --git a/labcodes/lab7/.projectile b/labcodes/lab7/.projectile new file mode 100644 index 0000000..e69de29 diff --git a/labcodes/lab7/Makefile b/labcodes/lab7/Makefile index 613b097..b680479 100644 --- a/labcodes/lab7/Makefile +++ b/labcodes/lab7/Makefile @@ -294,6 +294,9 @@ MAKEOPTS := --quiet --no-print-directory run-%: build-% $(V)$(QEMU) -parallel stdio $(QEMUOPTS) -serial null +run-nox-%: build-% + $(V)$(QEMU) -serial mon:stdio $(QEMUOPTS) -nographic + build-%: touch $(V)$(MAKE) $(MAKEOPTS) "DEFS+=-DTEST=$* -DTESTSTART=$(RUN_PREFIX)$*_out_start -DTESTSIZE=$(RUN_PREFIX)$*_out_size" diff --git a/labcodes/lab7/kern/schedule/sched.c b/labcodes/lab7/kern/schedule/sched.c index 8c3ff99..53c2e3c 100644 --- a/labcodes/lab7/kern/schedule/sched.c +++ b/labcodes/lab7/kern/schedule/sched.c @@ -49,7 +49,7 @@ sched_init(void) { sched_class = &default_sched_class; rq = &__rq; - rq->max_time_slice = 20; + rq->max_time_slice = 5; sched_class->init(rq); cprintf("sched class: %s\n", sched_class->name); diff --git a/labcodes/lab7/kern/schedule/sched.h b/labcodes/lab7/kern/schedule/sched.h index ca33799..766ac03 100644 --- a/labcodes/lab7/kern/schedule/sched.h +++ b/labcodes/lab7/kern/schedule/sched.h @@ -5,7 +5,7 @@ #include #include -#define MAX_TIME_SLICE 20 +#define MAX_TIME_SLICE 5 struct proc_struct; diff --git a/labcodes/lab7/user/priority.c b/labcodes/lab7/user/priority.c index d71147e..d097270 100644 --- a/labcodes/lab7/user/priority.c +++ b/labcodes/lab7/user/priority.c @@ -5,7 +5,7 @@ #define TOTAL 5 /* to get enough accuracy, MAX_TIME (the running time of each process) should >1000 mseconds. */ -#define MAX_TIME 2000 +#define MAX_TIME 1000 #define SLEEP_TIME 400 unsigned int acc[TOTAL]; int status[TOTAL]; @@ -39,7 +39,7 @@ main(void) { spin_delay(); ++ acc[i]; if(acc[i]%4000==0) { - if((time=gettime_msec())>MAX_TIME) { + if((time=gettime_msec())>MAX_TIME+SLEEP_TIME) { cprintf("child pid %d, acc %d, time %d\n",getpid(),acc[i],time); exit(acc[i]); } diff --git a/labcodes/lab8/.projectile b/labcodes/lab8/.projectile new file mode 100644 index 0000000..e69de29 diff --git a/labcodes/lab8/Makefile b/labcodes/lab8/Makefile index d87f0a8..b2e287d 100644 --- a/labcodes/lab8/Makefile +++ b/labcodes/lab8/Makefile @@ -273,6 +273,9 @@ $(foreach p,$(USER_BINS),$(eval $(call fscopy,$(p),$(SFSROOT)$(SLASH)))) $(SFSROOT): if [ ! -d "$(SFSROOT)" ]; then mkdir $(SFSROOT); fi +$(SFSROOT): + $(V)$(MKDIR) $@ + $(SFSIMG): $(SFSROOT) $(SFSBINS) | $(call totarget,mksfs) $(V)dd if=/dev/zero of=$@ bs=1M count=128 @$(call totarget,mksfs) $@ $(SFSROOT) @@ -340,6 +343,9 @@ run-%: build-% sh-%: script-% $(V)$(QEMU) -parallel stdio $(QEMUOPTS) -serial null +run-nox-%: build-% + $(V)$(QEMU) -serial mon:stdio $(QEMUOPTS) -nographic + build-%: touch $(V)$(MAKE) $(MAKEOPTS) "DEFS+=-DTEST=$*" diff --git a/labcodes/lab8/kern/schedule/sched.h b/labcodes/lab8/kern/schedule/sched.h index ca33799..766ac03 100644 --- a/labcodes/lab8/kern/schedule/sched.h +++ b/labcodes/lab8/kern/schedule/sched.h @@ -5,7 +5,7 @@ #include #include -#define MAX_TIME_SLICE 20 +#define MAX_TIME_SLICE 5 struct proc_struct; diff --git a/labcodes/lab8/user/priority.c b/labcodes/lab8/user/priority.c index d71147e..5624ec6 100644 --- a/labcodes/lab8/user/priority.c +++ b/labcodes/lab8/user/priority.c @@ -5,7 +5,7 @@ #define TOTAL 5 /* to get enough accuracy, MAX_TIME (the running time of each process) should >1000 mseconds. */ -#define MAX_TIME 2000 +#define MAX_TIME 1000 #define SLEEP_TIME 400 unsigned int acc[TOTAL]; int status[TOTAL]; @@ -39,7 +39,7 @@ main(void) { spin_delay(); ++ acc[i]; if(acc[i]%4000==0) { - if((time=gettime_msec())>MAX_TIME) { + if((time=gettime_msec())>SLEEP_TIME+MAX_TIME) { cprintf("child pid %d, acc %d, time %d\n",getpid(),acc[i],time); exit(acc[i]); } diff --git a/labcodes_answer/lab1_result/.projectile b/labcodes_answer/lab1_result/.projectile new file mode 100644 index 0000000..e69de29 diff --git a/labcodes_answer/lab2_result/.projectile b/labcodes_answer/lab2_result/.projectile new file mode 100644 index 0000000..e69de29 diff --git a/labcodes_answer/lab3_result/.projectile b/labcodes_answer/lab3_result/.projectile new file mode 100644 index 0000000..e69de29 diff --git a/labcodes_answer/lab4_result/.projectile b/labcodes_answer/lab4_result/.projectile new file mode 100644 index 0000000..e69de29 diff --git a/labcodes_answer/lab5_result/.projectile b/labcodes_answer/lab5_result/.projectile new file mode 100644 index 0000000..e69de29 diff --git a/labcodes_answer/lab5_result/Makefile b/labcodes_answer/lab5_result/Makefile index 2ec80da..3ebf64c 100644 --- a/labcodes_answer/lab5_result/Makefile +++ b/labcodes_answer/lab5_result/Makefile @@ -285,6 +285,9 @@ MAKEOPTS := --quiet --no-print-directory run-%: build-% $(V)$(QEMU) -parallel stdio $(QEMUOPTS) -serial null +run-nox-%: build-% + $(V)$(QEMU) -serial mon:stdio $(QEMUOPTS) -nographic + build-%: touch $(V)$(MAKE) $(MAKEOPTS) "DEFS+=-DTEST=$* -DTESTSTART=$(RUN_PREFIX)$*_out_start -DTESTSIZE=$(RUN_PREFIX)$*_out_size" diff --git a/labcodes_answer/lab6_result/.projectile b/labcodes_answer/lab6_result/.projectile new file mode 100644 index 0000000..e69de29 diff --git a/labcodes_answer/lab6_result/Makefile b/labcodes_answer/lab6_result/Makefile index ff4355c..4a2caf8 100644 --- a/labcodes_answer/lab6_result/Makefile +++ b/labcodes_answer/lab6_result/Makefile @@ -285,6 +285,9 @@ MAKEOPTS := --quiet --no-print-directory run-%: build-% $(V)$(QEMU) -parallel stdio $(QEMUOPTS) -serial null +run-nox-%: build-% + $(V)$(QEMU) -serial mon:stdio $(QEMUOPTS) -nographic + build-%: touch $(V)$(MAKE) $(MAKEOPTS) "DEFS+=-DTEST=$* -DTESTSTART=$(RUN_PREFIX)$*_out_start -DTESTSIZE=$(RUN_PREFIX)$*_out_size" diff --git a/labcodes_answer/lab6_result/kern/schedule/sched.h b/labcodes_answer/lab6_result/kern/schedule/sched.h index ca33799..766ac03 100644 --- a/labcodes_answer/lab6_result/kern/schedule/sched.h +++ b/labcodes_answer/lab6_result/kern/schedule/sched.h @@ -5,7 +5,7 @@ #include #include -#define MAX_TIME_SLICE 20 +#define MAX_TIME_SLICE 5 struct proc_struct; diff --git a/labcodes_answer/lab6_result/user/priority.c b/labcodes_answer/lab6_result/user/priority.c index bcbc29d..6a1cae4 100644 --- a/labcodes_answer/lab6_result/user/priority.c +++ b/labcodes_answer/lab6_result/user/priority.c @@ -5,7 +5,7 @@ #define TOTAL 5 /* to get enough accuracy, MAX_TIME (the running time of each process) should >1000 mseconds. */ -#define MAX_TIME 2000 +#define MAX_TIME 1000 unsigned int acc[TOTAL]; int status[TOTAL]; int pids[TOTAL]; diff --git a/labcodes_answer/lab7_result/.projectile b/labcodes_answer/lab7_result/.projectile new file mode 100644 index 0000000..e69de29 diff --git a/labcodes_answer/lab7_result/Makefile b/labcodes_answer/lab7_result/Makefile index c5aa235..53da09a 100644 --- a/labcodes_answer/lab7_result/Makefile +++ b/labcodes_answer/lab7_result/Makefile @@ -285,6 +285,9 @@ MAKEOPTS := --quiet --no-print-directory run-%: build-% $(V)$(QEMU) -parallel stdio $(QEMUOPTS) -serial null +run-nox-%: build-% + $(V)$(QEMU) -serial mon:stdio $(QEMUOPTS) -nographic + build-%: touch $(V)$(MAKE) $(MAKEOPTS) "DEFS+=-DTEST=$* -DTESTSTART=$(RUN_PREFIX)$*_out_start -DTESTSIZE=$(RUN_PREFIX)$*_out_size" diff --git a/labcodes_answer/lab7_result/kern/schedule/sched.c b/labcodes_answer/lab7_result/kern/schedule/sched.c index e272635..c0dab33 100644 --- a/labcodes_answer/lab7_result/kern/schedule/sched.c +++ b/labcodes_answer/lab7_result/kern/schedule/sched.c @@ -48,7 +48,7 @@ sched_init(void) { sched_class = &default_sched_class; rq = &__rq; - rq->max_time_slice = 20; + rq->max_time_slice = 5; sched_class->init(rq); cprintf("sched class: %s\n", sched_class->name); diff --git a/labcodes_answer/lab7_result/user/priority.c b/labcodes_answer/lab7_result/user/priority.c index d71147e..d097270 100644 --- a/labcodes_answer/lab7_result/user/priority.c +++ b/labcodes_answer/lab7_result/user/priority.c @@ -5,7 +5,7 @@ #define TOTAL 5 /* to get enough accuracy, MAX_TIME (the running time of each process) should >1000 mseconds. */ -#define MAX_TIME 2000 +#define MAX_TIME 1000 #define SLEEP_TIME 400 unsigned int acc[TOTAL]; int status[TOTAL]; @@ -39,7 +39,7 @@ main(void) { spin_delay(); ++ acc[i]; if(acc[i]%4000==0) { - if((time=gettime_msec())>MAX_TIME) { + if((time=gettime_msec())>MAX_TIME+SLEEP_TIME) { cprintf("child pid %d, acc %d, time %d\n",getpid(),acc[i],time); exit(acc[i]); } diff --git a/labcodes_answer/lab8_result/.projectile b/labcodes_answer/lab8_result/.projectile new file mode 100644 index 0000000..e69de29 diff --git a/labcodes_answer/lab8_result/Makefile b/labcodes_answer/lab8_result/Makefile index 0f28ca1..1e3e279 100644 --- a/labcodes_answer/lab8_result/Makefile +++ b/labcodes_answer/lab8_result/Makefile @@ -261,6 +261,9 @@ endef $(foreach p,$(USER_BINS),$(eval $(call fscopy,$(p),$(SFSROOT)$(SLASH)))) +$(SFSROOT): + $(V)$(MKDIR) $@ + $(SFSIMG): $(SFSROOT) $(SFSBINS) | $(call totarget,mksfs) $(V)dd if=/dev/zero of=$@ bs=1M count=128 @$(call totarget,mksfs) $@ $(SFSROOT) @@ -332,6 +335,9 @@ run-%: build-% sh-%: script-% $(V)$(QEMU) -parallel stdio $(QEMUOPTS) -serial null +run-nox-%: build-% + $(V)$(QEMU) -serial mon:stdio $(QEMUOPTS) -nographic + build-%: touch $(V)$(MAKE) $(MAKEOPTS) "DEFS+=-DTEST=$*" diff --git a/labcodes_answer/lab8_result/kern/schedule/sched.c b/labcodes_answer/lab8_result/kern/schedule/sched.c index e272635..c0dab33 100644 --- a/labcodes_answer/lab8_result/kern/schedule/sched.c +++ b/labcodes_answer/lab8_result/kern/schedule/sched.c @@ -48,7 +48,7 @@ sched_init(void) { sched_class = &default_sched_class; rq = &__rq; - rq->max_time_slice = 20; + rq->max_time_slice = 5; sched_class->init(rq); cprintf("sched class: %s\n", sched_class->name); diff --git a/labcodes_answer/lab8_result/user/priority.c b/labcodes_answer/lab8_result/user/priority.c index d71147e..5624ec6 100644 --- a/labcodes_answer/lab8_result/user/priority.c +++ b/labcodes_answer/lab8_result/user/priority.c @@ -5,7 +5,7 @@ #define TOTAL 5 /* to get enough accuracy, MAX_TIME (the running time of each process) should >1000 mseconds. */ -#define MAX_TIME 2000 +#define MAX_TIME 1000 #define SLEEP_TIME 400 unsigned int acc[TOTAL]; int status[TOTAL]; @@ -39,7 +39,7 @@ main(void) { spin_delay(); ++ acc[i]; if(acc[i]%4000==0) { - if((time=gettime_msec())>MAX_TIME) { + if((time=gettime_msec())>SLEEP_TIME+MAX_TIME) { cprintf("child pid %d, acc %d, time %d\n",getpid(),acc[i],time); exit(acc[i]); }