nachos的奇奇怪怪的问题太多了,我预测到之后肯定会有好多学弟学妹来问,所以直接放上来存这算了哈哈哈哈~
The main.cc program of Nachos in ../threads/ calls function ThreadTest() as follows:
void
ThreadTest()
{
DEBUG(’t’, "Entering SimpleTest");
Thread *t = new Thread("forked thread");
t->Fork(SimpleThread, 1);
SimpleThread(0);
}
The SimpleThread() function used above is as follows:
void
SimpleThread(_int which)
{
int num;
for (num = 0; num < 5; num++) {
printf("*** thread %d looped %d times\n", (int) which, num);
currentThread->Yield();
}
}
Your tasks of this lab session is to
1. trace the execution of Nachos and observe the executions of
(a) context switch function SWITCH()
(b) function ThreadRoot()
using gdb and