登录 注册
当前位置:主页 > 资源下载 > 9 > 一份操作系统课程设计实验报告

一份操作系统课程设计实验报告

  • 更新:2024-09-28 21:04:08
  • 大小:1.53MB
  • 推荐:★★★★★
  • 来源:网友上传分享
  • 类别:Ubuntu - 操作系统
  • 格式:DOC

资源介绍

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?