《操作系统》的实验代码。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 rivejä
3.4 KiB

11 vuotta sitten
11 vuotta sitten
11 vuotta sitten
  1. 第二次作业
  2. OS concept ver7课本第8章、第九章的习题:
  3. 8.3 Given ?ve memory partitions of 100 KB, 500 KB, 200 KB, 300 KB,and
  4. 600 KB (in order), how would each of the ?rst-?t, best-?t, and worst-?t
  5. algorithms place processes of 212 KB, 417 KB, 112 KB, and 426 KB (in
  6. order)?Which algorithm makes the most ef?cient use of memory?
  7. 8.4 Most systems allow programs to allocate more memory to its address
  8. space during execution.Data allocated in the heap segments of programs
  9. is an example of such allocated memory. What is required to support
  10. dynamic memory allocation in the following schemes:
  11. a. contiguous-memory allocation
  12. b. pure segmentation
  13. c. pure paging
  14. 8.12 Consider the following segment table:
  15. Segment Base Length
  16. 0 219 600
  17. 1 2300 14
  18. 2 90 100
  19. 3 1327 580
  20. 4 1952 96
  21. What are the physical addresses for the following logical addresses?
  22. a. 0,430
  23. b. 1,10
  24. c. 2,500
  25. d. 3,400
  26. e. 4,112
  27. 9.5 Assume we have a demand-paged memory. The page table is held in
  28. registers. It takes 8 milliseconds to service a page fault if an empty page
  29. is available or the replaced page is not modi?ed, and 20 milliseconds if
  30. the replaced page is modi?ed. Memory access time is 100 nanoseconds.
  31. Assume that the page to be replaced is modi?ed 70 percent of the time.
  32. What is the maximum acceptable page-fault rate for an effective access
  33. time of no more than 200 nanoseconds?
  34. 9.13 A page-replacement algorithm should minimize the number of page
  35. faults. We can do this minimization by distributing heavily used pages
  36. evenly over all of memory, rather than having them compete for a small
  37. number of page frames.We can associatewith each page frame a counter
  38. of the number of pages that are associated with that frame. Then, to
  39. replace a page, we search for the page frame with the smallest counter.
  40. a. De?ne a page-replacement algorithmusing this basic idea. Specif-
  41. ically address the problems of (1) what the initial value of the
  42. counters is, (2) when counters are increased, (3) when counters
  43. are decreased, and (4) how the page to be replaced is selected.
  44. b. Howmany page faults occur for your algorithmfor the following
  45. reference string, for four page frames?
  46. 1, 2, 3, 4, 5, 3, 4, 1, 6, 7, 8, 7, 8, 9, 7, 8, 9, 5, 4, 5, 4, 2.
  47. c. What is the minimumnumber of page faults for an optimal page-
  48. replacement strategy for the reference string in part b with four
  49. page frames?
  50. 实验相关
  51. ------------------
  52. 1 lab1的proj1的ucore的代码中是否有使用了绝对地址(编译期间指定的绝对内存地址)?
  53. 2 lab2 的ucore的小os的load addr和link addr分别是多少?
  54. 3 ucore用了哪个数据结构来管理空闲内存,位于内存什么地方,占多少空间?
  55. 4 请考虑在ucore中实现second chance/enhanced clock页替换算法的设计思路。主要描述如何利用相关x86相关硬件、如何设计数据结构,大致要实现哪些函数,函数的大致功能和整体流程。
  56. 5 实现enhanced clock algorithm中,
  57. IF before clock sweep: (used,dirty) = (1,1), THEN after clock sweep: (used, dirty)=(0,1).
  58. 如果把上述转换改为:
  59. IF before clock sweep: (used,dirty) = (1,1), THEN after clock sweep: (used, dirty)=(1,0).
  60. 是否可行?
  61. 6 在clock算法实现中,pte中的uesd bit位是否可以让os来设置1 or 0 ? 为什么?
  62. 7 在enhanced clock算法中的dirty bit位是否可以让os来设置1 or 0 ? 为什么?
  63. 8 如果在ucore中实现精确的LRU算法,如何设计?需要硬件和OS分别完成什么事情?