-
一份操作系统课程设计实验报告
资源介绍
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
2. answer the following questions:
(a) What are the addresses of the following functions in your Nachos:
i. InterruptEnable()
ii. SimpleThread()
iii. ThreadFinish()
iv. ThreadRoot()
and describe how did you find them.
(b) What are the addresses of the thread objects for
i. the main thread of the Nachos
ii. the forked thread created by the main thread and describe how did you find them.
(c) When the main thread executes SWITCH() function for the first time, to what address the CPU returns when it executes the last instruction ret of SWITCH()? What location in the program that address is referred to?
(d) When the forked thread executes SWITCH() function for the first time, to what address the CPU returns when it executes the last instruction ret of SWITCH()? What location in the program that address is referred to?
- 上一篇: 操作系统文件系统实验报告
- 下一篇: FreeRTOS移植实验——STM32F103通用模板