[Preface] A Hope That My Crude Remarks May Draw Forth By Abler People
[前言]拋磚引玉
GitHub: MIT-6.828-Adventure-Lab4
- Part A: Multiprocessor Support and Cooperative Multitasking.
- Initialize hardware support.
- Main goal: Make every CPUs have its own independent data.
- Booting CPU triggers the bootaps() to set up each CPU by env_init_percpu() through mpentry.S to call mp_main().
- ma_main() triggers
- env_init_percpu
- trap_init_percpu() setup each CPU's own TSS and stack allocated from mem_init_mp()
- ltr(tss)
- lidt
- trap_init_percpu()
- setup es/ds/fs/gs/fs/ss
- setup CS by ljmp
- Big Kernel Lock setup to ensure only one trap to capable to enter the kernel mode in the same time between all CPUs.
- Implement Round-Robin scheduling.
- Part B: Copy-on-Write Fork.
- I must say this part is very very interesting!!!
- user mode page fault handler
- The translation between UXSTACK, Kernel stack, and normal user stack.
- The guide on Lab4 is very very detailed, I hope U could enjoy this part!
- Note: Difference between faultalloc.c and faultallocbad.c
- faultallocbad.c trigger user_mem_assert under kernel mode, so it can't print out.
- faultalloc.c trigger 3 times page fault under user mode
- 1 by deadbeef printing.
- 2 by cafebffe printing.(contains recursive page fault)
- Part C: Preemptive Multitasking and Inter-Process communication (IPC).
- Avoid one user process keep occupying CPU if it likes.
- Enable timer interrupt as the Force in Jedi to make Process release CPU.
- IPC here is applied in Blocking Send and Blocking Receive.
- It could be used as the basic lock mechanism, too.
- This part could be the Integration system test for lab 1~4, for interactions between kernel and users. :)
- Some questions assignment after exercises.