From 0d095b17daaed97df1943ac031058b428ad3f5fa Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sat, 7 Jan 2006 02:08:18 +0000 Subject: [PATCH] Add explanatory comments to threads tests. --- src/tests/threads/alarm-negative.c | 4 +- src/tests/threads/alarm-priority.c | 3 + src/tests/threads/alarm-wait.c | 4 +- src/tests/threads/alarm-zero.c | 4 +- src/tests/threads/mlfqs-fair.c | 16 +++ src/tests/threads/mlfqs-load-1.c | 8 ++ src/tests/threads/mlfqs-load-60.c | 99 ++++++++++++++++++ src/tests/threads/mlfqs-load-avg.c | 100 +++++++++++++++++++ src/tests/threads/mlfqs-recent-1.c | 99 +++++++++++++++++- src/tests/threads/priority-condvar.c | 3 + src/tests/threads/priority-donate-multiple.c | 8 +- src/tests/threads/priority-donate-nest.c | 8 +- src/tests/threads/priority-donate-one.c | 8 +- src/tests/threads/priority-fifo.c | 3 +- src/tests/threads/priority-fifo.ck | 23 +++++ src/tests/threads/priority-preempt.c | 2 +- src/tests/threads/priority-sema.c | 3 + 17 files changed, 380 insertions(+), 15 deletions(-) diff --git a/src/tests/threads/alarm-negative.c b/src/tests/threads/alarm-negative.c index 83b3ac3..aec52cf 100644 --- a/src/tests/threads/alarm-negative.c +++ b/src/tests/threads/alarm-negative.c @@ -1,6 +1,4 @@ -/* Problem 1-1: Alarm Clock tests. - - Tests timer_sleep(-100). Only requirement is that it not crash. */ +/* Tests timer_sleep(-100). Only requirement is that it not crash. */ #include #include "tests/threads/tests.h" diff --git a/src/tests/threads/alarm-priority.c b/src/tests/threads/alarm-priority.c index 291861f..51ca6a9 100644 --- a/src/tests/threads/alarm-priority.c +++ b/src/tests/threads/alarm-priority.c @@ -1,3 +1,6 @@ +/* Checks that when the alarm clock wakes up threads, the + higher-priority threads run first. */ + #include #include "tests/threads/tests.h" #include "threads/init.h" diff --git a/src/tests/threads/alarm-wait.c b/src/tests/threads/alarm-wait.c index 1e58438..8030d20 100644 --- a/src/tests/threads/alarm-wait.c +++ b/src/tests/threads/alarm-wait.c @@ -1,6 +1,4 @@ -/* Problem 1-1: Alarm Clock tests. - - Creates N threads, each of which sleeps a different, fixed +/* Creates N threads, each of which sleeps a different, fixed duration, M times. Records the wake-up order and verifies that it is valid. */ diff --git a/src/tests/threads/alarm-zero.c b/src/tests/threads/alarm-zero.c index 472b9d0..c8a3ee2 100644 --- a/src/tests/threads/alarm-zero.c +++ b/src/tests/threads/alarm-zero.c @@ -1,6 +1,4 @@ -/* Problem 1-1: Alarm Clock tests. - - Tests timer_sleep(0). Only requirement is that it not crash. */ +/* Tests timer_sleep(0), which should return immediately. */ #include #include "tests/threads/tests.h" diff --git a/src/tests/threads/mlfqs-fair.c b/src/tests/threads/mlfqs-fair.c index fd8ab86..30282c3 100644 --- a/src/tests/threads/mlfqs-fair.c +++ b/src/tests/threads/mlfqs-fair.c @@ -1,3 +1,19 @@ +/* Measures the correctness of the "nice" implementation. + + The "fair" tests run either 2 or 20 threads all niced to 0. + The threads should all receive approximately the same number + of ticks. + + The mlfqs-nice-2 test runs 2 threads, one with nice 0, the + other with nice 5, which should receive 1,904 and 1,096 ticks, + respectively, over 30 seconds. + + The mlfqs-nice-10 test runs 10 threads with nice 0 through 9. + They should receive 672, 588, 492, 408, 316, 232, 152, 92, 40, + and 8 ticks, respectively, over 30 seconds. + + (The above are computed via simulation in mlfqs.pm.) */ + #include #include #include "tests/threads/tests.h" diff --git a/src/tests/threads/mlfqs-load-1.c b/src/tests/threads/mlfqs-load-1.c index 652407c..da99729 100644 --- a/src/tests/threads/mlfqs-load-1.c +++ b/src/tests/threads/mlfqs-load-1.c @@ -1,3 +1,11 @@ +/* Verifies that a single busy thread raises the load average to + 0.5 in 38 to 45 seconds. The expected time is 42 seconds, as + you can verify: + perl -e '$i++,$a=(59*$a+1)/60while$a<=.5;print "$i\n"' + + Then, verifies that 10 seconds of inactivity drop the load + average back below 0.5 again. */ + #include #include "tests/threads/tests.h" #include "threads/init.h" diff --git a/src/tests/threads/mlfqs-load-60.c b/src/tests/threads/mlfqs-load-60.c index 0d01cba..81caa39 100644 --- a/src/tests/threads/mlfqs-load-60.c +++ b/src/tests/threads/mlfqs-load-60.c @@ -1,3 +1,102 @@ +/* Starts 60 threads that each sleep for 10 seconds, then spin in + a tight loop for 60 seconds, and sleep for another 60 seconds. + Every 2 seconds after the initial sleep, the main thread + prints the load average. + + The expected output is this (some margin of error is allowed): + + After 0 seconds, load average=1.00. + After 2 seconds, load average=2.95. + After 4 seconds, load average=4.84. + After 6 seconds, load average=6.66. + After 8 seconds, load average=8.42. + After 10 seconds, load average=10.13. + After 12 seconds, load average=11.78. + After 14 seconds, load average=13.37. + After 16 seconds, load average=14.91. + After 18 seconds, load average=16.40. + After 20 seconds, load average=17.84. + After 22 seconds, load average=19.24. + After 24 seconds, load average=20.58. + After 26 seconds, load average=21.89. + After 28 seconds, load average=23.15. + After 30 seconds, load average=24.37. + After 32 seconds, load average=25.54. + After 34 seconds, load average=26.68. + After 36 seconds, load average=27.78. + After 38 seconds, load average=28.85. + After 40 seconds, load average=29.88. + After 42 seconds, load average=30.87. + After 44 seconds, load average=31.84. + After 46 seconds, load average=32.77. + After 48 seconds, load average=33.67. + After 50 seconds, load average=34.54. + After 52 seconds, load average=35.38. + After 54 seconds, load average=36.19. + After 56 seconds, load average=36.98. + After 58 seconds, load average=37.74. + After 60 seconds, load average=37.48. + After 62 seconds, load average=36.24. + After 64 seconds, load average=35.04. + After 66 seconds, load average=33.88. + After 68 seconds, load average=32.76. + After 70 seconds, load average=31.68. + After 72 seconds, load average=30.63. + After 74 seconds, load average=29.62. + After 76 seconds, load average=28.64. + After 78 seconds, load average=27.69. + After 80 seconds, load average=26.78. + After 82 seconds, load average=25.89. + After 84 seconds, load average=25.04. + After 86 seconds, load average=24.21. + After 88 seconds, load average=23.41. + After 90 seconds, load average=22.64. + After 92 seconds, load average=21.89. + After 94 seconds, load average=21.16. + After 96 seconds, load average=20.46. + After 98 seconds, load average=19.79. + After 100 seconds, load average=19.13. + After 102 seconds, load average=18.50. + After 104 seconds, load average=17.89. + After 106 seconds, load average=17.30. + After 108 seconds, load average=16.73. + After 110 seconds, load average=16.17. + After 112 seconds, load average=15.64. + After 114 seconds, load average=15.12. + After 116 seconds, load average=14.62. + After 118 seconds, load average=14.14. + After 120 seconds, load average=13.67. + After 122 seconds, load average=13.22. + After 124 seconds, load average=12.78. + After 126 seconds, load average=12.36. + After 128 seconds, load average=11.95. + After 130 seconds, load average=11.56. + After 132 seconds, load average=11.17. + After 134 seconds, load average=10.80. + After 136 seconds, load average=10.45. + After 138 seconds, load average=10.10. + After 140 seconds, load average=9.77. + After 142 seconds, load average=9.45. + After 144 seconds, load average=9.13. + After 146 seconds, load average=8.83. + After 148 seconds, load average=8.54. + After 150 seconds, load average=8.26. + After 152 seconds, load average=7.98. + After 154 seconds, load average=7.72. + After 156 seconds, load average=7.47. + After 158 seconds, load average=7.22. + After 160 seconds, load average=6.98. + After 162 seconds, load average=6.75. + After 164 seconds, load average=6.53. + After 166 seconds, load average=6.31. + After 168 seconds, load average=6.10. + After 170 seconds, load average=5.90. + After 172 seconds, load average=5.70. + After 174 seconds, load average=5.52. + After 176 seconds, load average=5.33. + After 178 seconds, load average=5.16. +*/ + #include #include "tests/threads/tests.h" #include "threads/init.h" diff --git a/src/tests/threads/mlfqs-load-avg.c b/src/tests/threads/mlfqs-load-avg.c index 32238c9..1462a80 100644 --- a/src/tests/threads/mlfqs-load-avg.c +++ b/src/tests/threads/mlfqs-load-avg.c @@ -1,3 +1,103 @@ +/* Starts 60 threads numbered 0 through 59. Thread #i sleeps for + (10+i) seconds, then spins in a loop for 60 seconds, then + sleeps until a total of 120 seconds have passed. Every 2 + seconds, starting 10 seconds in, the main thread prints the + load average. + + The expected output is this (some margin of error is allowed): + + After 0 seconds, load average=0.00. + After 2 seconds, load average=0.05. + After 4 seconds, load average=0.16. + After 6 seconds, load average=0.34. + After 8 seconds, load average=0.58. + After 10 seconds, load average=0.87. + After 12 seconds, load average=1.22. + After 14 seconds, load average=1.63. + After 16 seconds, load average=2.09. + After 18 seconds, load average=2.60. + After 20 seconds, load average=3.16. + After 22 seconds, load average=3.76. + After 24 seconds, load average=4.42. + After 26 seconds, load average=5.11. + After 28 seconds, load average=5.85. + After 30 seconds, load average=6.63. + After 32 seconds, load average=7.46. + After 34 seconds, load average=8.32. + After 36 seconds, load average=9.22. + After 38 seconds, load average=10.15. + After 40 seconds, load average=11.12. + After 42 seconds, load average=12.13. + After 44 seconds, load average=13.16. + After 46 seconds, load average=14.23. + After 48 seconds, load average=15.33. + After 50 seconds, load average=16.46. + After 52 seconds, load average=17.62. + After 54 seconds, load average=18.81. + After 56 seconds, load average=20.02. + After 58 seconds, load average=21.26. + After 60 seconds, load average=22.52. + After 62 seconds, load average=23.71. + After 64 seconds, load average=24.80. + After 66 seconds, load average=25.78. + After 68 seconds, load average=26.66. + After 70 seconds, load average=27.45. + After 72 seconds, load average=28.14. + After 74 seconds, load average=28.75. + After 76 seconds, load average=29.27. + After 78 seconds, load average=29.71. + After 80 seconds, load average=30.06. + After 82 seconds, load average=30.34. + After 84 seconds, load average=30.55. + After 86 seconds, load average=30.68. + After 88 seconds, load average=30.74. + After 90 seconds, load average=30.73. + After 92 seconds, load average=30.66. + After 94 seconds, load average=30.52. + After 96 seconds, load average=30.32. + After 98 seconds, load average=30.06. + After 100 seconds, load average=29.74. + After 102 seconds, load average=29.37. + After 104 seconds, load average=28.95. + After 106 seconds, load average=28.47. + After 108 seconds, load average=27.94. + After 110 seconds, load average=27.36. + After 112 seconds, load average=26.74. + After 114 seconds, load average=26.07. + After 116 seconds, load average=25.36. + After 118 seconds, load average=24.60. + After 120 seconds, load average=23.81. + After 122 seconds, load average=23.02. + After 124 seconds, load average=22.26. + After 126 seconds, load average=21.52. + After 128 seconds, load average=20.81. + After 130 seconds, load average=20.12. + After 132 seconds, load average=19.46. + After 134 seconds, load average=18.81. + After 136 seconds, load average=18.19. + After 138 seconds, load average=17.59. + After 140 seconds, load average=17.01. + After 142 seconds, load average=16.45. + After 144 seconds, load average=15.90. + After 146 seconds, load average=15.38. + After 148 seconds, load average=14.87. + After 150 seconds, load average=14.38. + After 152 seconds, load average=13.90. + After 154 seconds, load average=13.44. + After 156 seconds, load average=13.00. + After 158 seconds, load average=12.57. + After 160 seconds, load average=12.15. + After 162 seconds, load average=11.75. + After 164 seconds, load average=11.36. + After 166 seconds, load average=10.99. + After 168 seconds, load average=10.62. + After 170 seconds, load average=10.27. + After 172 seconds, load average=9.93. + After 174 seconds, load average=9.61. + After 176 seconds, load average=9.29. + After 178 seconds, load average=8.98. +*/ + #include #include "tests/threads/tests.h" #include "threads/init.h" diff --git a/src/tests/threads/mlfqs-recent-1.c b/src/tests/threads/mlfqs-recent-1.c index 727bcb1..c217f83 100644 --- a/src/tests/threads/mlfqs-recent-1.c +++ b/src/tests/threads/mlfqs-recent-1.c @@ -1,3 +1,100 @@ +/* Checks that recent_cpu is calculated properly for the case of + a single ready process. + + The expected output is this (some margin of error is allowed): + + After 2 seconds, recent_cpu is 6.40, load_avg is 0.03. + After 4 seconds, recent_cpu is 12.60, load_avg is 0.07. + After 6 seconds, recent_cpu is 18.61, load_avg is 0.10. + After 8 seconds, recent_cpu is 24.44, load_avg is 0.13. + After 10 seconds, recent_cpu is 30.08, load_avg is 0.15. + After 12 seconds, recent_cpu is 35.54, load_avg is 0.18. + After 14 seconds, recent_cpu is 40.83, load_avg is 0.21. + After 16 seconds, recent_cpu is 45.96, load_avg is 0.24. + After 18 seconds, recent_cpu is 50.92, load_avg is 0.26. + After 20 seconds, recent_cpu is 55.73, load_avg is 0.29. + After 22 seconds, recent_cpu is 60.39, load_avg is 0.31. + After 24 seconds, recent_cpu is 64.90, load_avg is 0.33. + After 26 seconds, recent_cpu is 69.27, load_avg is 0.35. + After 28 seconds, recent_cpu is 73.50, load_avg is 0.38. + After 30 seconds, recent_cpu is 77.60, load_avg is 0.40. + After 32 seconds, recent_cpu is 81.56, load_avg is 0.42. + After 34 seconds, recent_cpu is 85.40, load_avg is 0.44. + After 36 seconds, recent_cpu is 89.12, load_avg is 0.45. + After 38 seconds, recent_cpu is 92.72, load_avg is 0.47. + After 40 seconds, recent_cpu is 96.20, load_avg is 0.49. + After 42 seconds, recent_cpu is 99.57, load_avg is 0.51. + After 44 seconds, recent_cpu is 102.84, load_avg is 0.52. + After 46 seconds, recent_cpu is 106.00, load_avg is 0.54. + After 48 seconds, recent_cpu is 109.06, load_avg is 0.55. + After 50 seconds, recent_cpu is 112.02, load_avg is 0.57. + After 52 seconds, recent_cpu is 114.89, load_avg is 0.58. + After 54 seconds, recent_cpu is 117.66, load_avg is 0.60. + After 56 seconds, recent_cpu is 120.34, load_avg is 0.61. + After 58 seconds, recent_cpu is 122.94, load_avg is 0.62. + After 60 seconds, recent_cpu is 125.46, load_avg is 0.64. + After 62 seconds, recent_cpu is 127.89, load_avg is 0.65. + After 64 seconds, recent_cpu is 130.25, load_avg is 0.66. + After 66 seconds, recent_cpu is 132.53, load_avg is 0.67. + After 68 seconds, recent_cpu is 134.73, load_avg is 0.68. + After 70 seconds, recent_cpu is 136.86, load_avg is 0.69. + After 72 seconds, recent_cpu is 138.93, load_avg is 0.70. + After 74 seconds, recent_cpu is 140.93, load_avg is 0.71. + After 76 seconds, recent_cpu is 142.86, load_avg is 0.72. + After 78 seconds, recent_cpu is 144.73, load_avg is 0.73. + After 80 seconds, recent_cpu is 146.54, load_avg is 0.74. + After 82 seconds, recent_cpu is 148.29, load_avg is 0.75. + After 84 seconds, recent_cpu is 149.99, load_avg is 0.76. + After 86 seconds, recent_cpu is 151.63, load_avg is 0.76. + After 88 seconds, recent_cpu is 153.21, load_avg is 0.77. + After 90 seconds, recent_cpu is 154.75, load_avg is 0.78. + After 92 seconds, recent_cpu is 156.23, load_avg is 0.79. + After 94 seconds, recent_cpu is 157.67, load_avg is 0.79. + After 96 seconds, recent_cpu is 159.06, load_avg is 0.80. + After 98 seconds, recent_cpu is 160.40, load_avg is 0.81. + After 100 seconds, recent_cpu is 161.70, load_avg is 0.81. + After 102 seconds, recent_cpu is 162.96, load_avg is 0.82. + After 104 seconds, recent_cpu is 164.18, load_avg is 0.83. + After 106 seconds, recent_cpu is 165.35, load_avg is 0.83. + After 108 seconds, recent_cpu is 166.49, load_avg is 0.84. + After 110 seconds, recent_cpu is 167.59, load_avg is 0.84. + After 112 seconds, recent_cpu is 168.66, load_avg is 0.85. + After 114 seconds, recent_cpu is 169.69, load_avg is 0.85. + After 116 seconds, recent_cpu is 170.69, load_avg is 0.86. + After 118 seconds, recent_cpu is 171.65, load_avg is 0.86. + After 120 seconds, recent_cpu is 172.58, load_avg is 0.87. + After 122 seconds, recent_cpu is 173.49, load_avg is 0.87. + After 124 seconds, recent_cpu is 174.36, load_avg is 0.88. + After 126 seconds, recent_cpu is 175.20, load_avg is 0.88. + After 128 seconds, recent_cpu is 176.02, load_avg is 0.88. + After 130 seconds, recent_cpu is 176.81, load_avg is 0.89. + After 132 seconds, recent_cpu is 177.57, load_avg is 0.89. + After 134 seconds, recent_cpu is 178.31, load_avg is 0.89. + After 136 seconds, recent_cpu is 179.02, load_avg is 0.90. + After 138 seconds, recent_cpu is 179.72, load_avg is 0.90. + After 140 seconds, recent_cpu is 180.38, load_avg is 0.90. + After 142 seconds, recent_cpu is 181.03, load_avg is 0.91. + After 144 seconds, recent_cpu is 181.65, load_avg is 0.91. + After 146 seconds, recent_cpu is 182.26, load_avg is 0.91. + After 148 seconds, recent_cpu is 182.84, load_avg is 0.92. + After 150 seconds, recent_cpu is 183.41, load_avg is 0.92. + After 152 seconds, recent_cpu is 183.96, load_avg is 0.92. + After 154 seconds, recent_cpu is 184.49, load_avg is 0.92. + After 156 seconds, recent_cpu is 185.00, load_avg is 0.93. + After 158 seconds, recent_cpu is 185.49, load_avg is 0.93. + After 160 seconds, recent_cpu is 185.97, load_avg is 0.93. + After 162 seconds, recent_cpu is 186.43, load_avg is 0.93. + After 164 seconds, recent_cpu is 186.88, load_avg is 0.94. + After 166 seconds, recent_cpu is 187.31, load_avg is 0.94. + After 168 seconds, recent_cpu is 187.73, load_avg is 0.94. + After 170 seconds, recent_cpu is 188.14, load_avg is 0.94. + After 172 seconds, recent_cpu is 188.53, load_avg is 0.94. + After 174 seconds, recent_cpu is 188.91, load_avg is 0.95. + After 176 seconds, recent_cpu is 189.27, load_avg is 0.95. + After 178 seconds, recent_cpu is 189.63, load_avg is 0.95. + After 180 seconds, recent_cpu is 189.97, load_avg is 0.95. +*/ + #include #include "tests/threads/tests.h" #include "threads/init.h" @@ -7,7 +104,7 @@ #include "devices/timer.h" /* Sensitive to assumption that recent_cpu updates happen exactly - when timer_ticks()%TIMER_FREQ == 0. */ + when timer_ticks() % TIMER_FREQ == 0. */ void test_mlfqs_recent_1 (void) diff --git a/src/tests/threads/priority-condvar.c b/src/tests/threads/priority-condvar.c index 0d34380..51008ab 100644 --- a/src/tests/threads/priority-condvar.c +++ b/src/tests/threads/priority-condvar.c @@ -1,3 +1,6 @@ +/* Tests that cond_signal() wakes up the highest-priority thread + waiting in cond_wait(). */ + #include #include "tests/threads/tests.h" #include "threads/init.h" diff --git a/src/tests/threads/priority-donate-multiple.c b/src/tests/threads/priority-donate-multiple.c index 836f3ed..6905691 100644 --- a/src/tests/threads/priority-donate-multiple.c +++ b/src/tests/threads/priority-donate-multiple.c @@ -1,4 +1,10 @@ -/* Based on a test originally submitted for Stanford's CS 140 in +/* The main thread acquires locks A and B, then it creates two + higher-priority threads. Each of these threads blocks + acquiring one of the locks and thus donate their priority to + the main thread. The main thread releases the locks in turn + and relinquishes its donated priorities. + + Based on a test originally submitted for Stanford's CS 140 in winter 1999 by Matt Franklin , Greg Hutchins , Yu Ping Hu . Modified by arens. */ diff --git a/src/tests/threads/priority-donate-nest.c b/src/tests/threads/priority-donate-nest.c index 15141b7..1f24584 100644 --- a/src/tests/threads/priority-donate-nest.c +++ b/src/tests/threads/priority-donate-nest.c @@ -1,4 +1,10 @@ -/* Based on a test originally submitted for Stanford's CS 140 in +/* Low-priority main thread L acquires lock A. Medium-priority + thread M then acquires lock B then blocks on acquiring lock A. + High-priority thread H then blocks on acquiring lock B. Thus, + thread H donates its priority to M, which in turn donates it + to thread L. + + Based on a test originally submitted for Stanford's CS 140 in winter 1999 by Matt Franklin , Greg Hutchins , Yu Ping Hu . Modified by arens. */ diff --git a/src/tests/threads/priority-donate-one.c b/src/tests/threads/priority-donate-one.c index d3b3d96..603a7fe 100644 --- a/src/tests/threads/priority-donate-one.c +++ b/src/tests/threads/priority-donate-one.c @@ -1,4 +1,10 @@ -/* Based on a test originally submitted for Stanford's CS 140 in +/* The main thread acquires a lock. Then it creates two + higher-priority threads that block acquiring the lock, causing + them to donate their priorities to the main thread. When the + main thread releases the lock, the other threads should + acquire it in priority order. + + Based on a test originally submitted for Stanford's CS 140 in winter 1999 by Matt Franklin , Greg Hutchins , Yu Ping Hu . Modified by arens. */ diff --git a/src/tests/threads/priority-fifo.c b/src/tests/threads/priority-fifo.c index 541cf5a..e71b7e5 100644 --- a/src/tests/threads/priority-fifo.c +++ b/src/tests/threads/priority-fifo.c @@ -1,4 +1,5 @@ -/* Problem 1-3: Priority Scheduling tests. +/* Creates several threads all at the same priority and ensures + that they consistently run in the same round-robin order. Based on a test originally submitted for Stanford's CS 140 in winter 1999 by by Matt Franklin diff --git a/src/tests/threads/priority-fifo.ck b/src/tests/threads/priority-fifo.ck index 2407e54..a5322ec 100644 --- a/src/tests/threads/priority-fifo.ck +++ b/src/tests/threads/priority-fifo.ck @@ -1,4 +1,27 @@ # -*- perl -*- + +# The expected output looks like this: +# +# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 +# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 +# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 +# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 +# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 +# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 +# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 +# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 +# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 +# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 +# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 +# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 +# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 +# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 +# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 +# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 +# +# A different permutation of 0...15 is acceptable, but every line must +# be in the same order. + use strict; use warnings; use tests::tests; diff --git a/src/tests/threads/priority-preempt.c b/src/tests/threads/priority-preempt.c index f6f799c..452c680 100644 --- a/src/tests/threads/priority-preempt.c +++ b/src/tests/threads/priority-preempt.c @@ -1,4 +1,4 @@ -/* Problem 1-3: Priority Scheduling tests. +/* Ensures that a high-priority thread really preempts. Based on a test originally submitted for Stanford's CS 140 in winter 1999 by by Matt Franklin diff --git a/src/tests/threads/priority-sema.c b/src/tests/threads/priority-sema.c index 743b05a..8ca17a0 100644 --- a/src/tests/threads/priority-sema.c +++ b/src/tests/threads/priority-sema.c @@ -1,3 +1,6 @@ +/* Tests that the highest-priority thread waiting on a semaphore + is the first to wake up. */ + #include #include "tests/threads/tests.h" #include "threads/init.h" -- 2.30.2