Remove fixed item.
[pintos-anon] / TODO
1 -*- text -*-
2
3 * Bochs is not fully reproducible.
4
5 Godmar says:
6
7 - In Project 2, we're missing tests that pass arguments to system calls
8 that span multiple pages, where some are mapped and some are not. 
9 An implementation that only checks the first page, rather than all pages 
10 that can be touched during a call to read()/write() passes all tests.
11
12 - In Project 2, we're missing a test that would fail if they assumed
13 that contiguous user-virtual addresses are laid out contiguously 
14 in memory.  The loading code should ensure that non-contiguous 
15 physical pages are allocated for the data segment (at least.)
16
17 - Need some tests that test that illegal accesses lead to process
18 termination. I have written some, will add them. In P2, obviously, 
19 this would require that the students break this functionality since 
20 the page directory is initialized for them, still it would be good 
21 to have.
22
23 - There does not appear to be a test that checks that they close all
24 fd's on exit.  Idea: add statistics & self-diagnostics code to palloc.c
25 and malloc.c.  Self-diagnostics code could be used for debugging.
26 The statistics code would report how much kernel memory is free.
27 Add a system call "get_kernel_memory_information".  User programs
28 could engage in a variety of activities and notice leaks by checking
29 the kernel memory statistics.
30
31 ---
32
33 From: "Godmar Back" <godmar@gmail.com>
34 Subject: priority donation tests
35 To: "Ben Pfaff" <blp@cs.stanford.edu>
36 Date: Fri, 3 Mar 2006 11:02:08 -0500
37
38 Ben,
39
40 it seems the priority donation tests are somewhat incomplete and allow
41 incorrect implementations to pass with a perfect score.
42
43 We are seeing the following wrong implementations pass all tests:
44
45 - Implementations that assume locks are released in the opposite order
46 in which they're acquired. The students implement this by
47 popping/pushing on the donation list.
48
49 - Implementations that assume that the priority of a thread waiting on
50 a semaphore or condition variable cannot change between when the
51 thread was blocked and when it is unblocked. The students implement
52 this by doing an insert into an ordered list on block, rather than
53 picking the maximum thread on unblock.
54
55 Neither of these two cases is detected; do you currently check for
56 these mistakes manually?
57
58 I wrote a test that checks for the first case; it is here:
59 http://people.cs.vt.edu/~gback/pintos/priority-donate-multiple-2.patch
60
61 [...]
62
63 I also wrote a test case for the second scenario:
64 http://people.cs.vt.edu/~gback/pintos/priority-donate-sema.c
65 http://people.cs.vt.edu/~gback/pintos/priority-donate-sema.ck
66
67 I put the other tests up here:
68 http://people.cs.vt.edu/~gback/pintos/priority-donate-multiple2.c
69 http://people.cs.vt.edu/~gback/pintos/priority-donate-multiple2.ck
70
71 From: "Godmar Back" <godmar@gmail.com>
72 Subject: multiple threads waking up at same clock tick
73 To: "Ben Pfaff" <blp@cs.stanford.edu>
74 Date: Wed, 1 Mar 2006 08:14:47 -0500
75
76 Greg Benson points out another potential TODO item for P1.
77
78 ----
79 One thing I recall:
80
81 The alarm tests do not test to see if multiple threads are woken up if
82 their timers have expired.  That is, students can write a solution
83 that just wakes up the first thread on the sleep queue rather than
84 check for additional threads.  Of course, the next thread will be
85 woken up on the next tick.  Also, this might be hard to test.
86
87 ---
88 Way to test this: (from Godmar Back)
89
90 Thread A with high priority spins until 'ticks' changes, then calls to
91 timer_sleep(X), Thread B with lower priority is then resumed, calls
92 set_priority to make its priority equal to that of thread A, then
93 calls timer_sleep(X), all of that before the next clock interrupt
94 arrives.
95
96 On wakeup, each thread records wake-up time and calls yield
97 immediately, forcing the scheduler to switch to the other
98 equal-priority thread. Both wake-up times must be the same (and match
99 the planned wake-up time.)
100
101 PS:
102 I actually tested it and it's hard to pass with the current ips setting.
103 The bounds on how quickly a thread would need to be able to return after
104 sleep appear too tight.  Need another idea.
105
106 ---
107 From: "Waqar Mohsin" <wmohsin@gmail.com>
108 Subject: 3 questions about switch_threads() in switch.S
109 To: blp@cs.stanford.edu, joshwise@stanford.edu
110 Date: Fri, 3 Mar 2006 17:09:21 -0800
111
112 QUESTION 2
113
114   # This stack frame must match the one set up by thread_create().
115   pushl %ebx
116   pushl %ebp
117   pushl %esi
118   pushl %edi
119
120 I find the comment confusing. thread_create() is a special case: the set of
121 registers popped from switch_threads stack frame for a newly created thread
122 are all zero, so their order shouldn't dictate the order above.
123
124 I think all that matters is that the order of pops at the end of
125 switch_threads() is the opposite of the pushes at the beginning (as shown
126 above).
127
128 QUESTION 3
129
130 Is it true that struct switch_threads_frame does NOT strictly require
131
132     struct thread *cur;         /* 20: switch_threads()'s CUR argument. */
133     struct thread *next;        /* 24: switch_threads()'s NEXT argument. */
134 at the end ?
135
136 When a newly created thread's stack pointer is installed in switch_threads(),
137 all we do is pop the saved registers and return to switch_entry() which pops
138 off and discards the above two simulated (and not used) arguments to
139 switch_threads().
140
141 If we remove these two from struct switch_threads_frame and don't do a
142
143   # Discard switch_threads() arguments.
144   addl $8, %esp
145 in switch_entry(), things should still work. Am I right ?
146
147 Thanks
148 Waqar
149
150 From: "Godmar Back" <godmar@gmail.com>
151 Subject: thread_yield in irq handler
152 To: "Ben Pfaff" <blp@cs.stanford.edu>
153 Date: Wed, 22 Feb 2006 22:18:50 -0500
154
155 Ben,
156
157 you write in your Tour of Pintos:
158
159 "Second, an interrupt handler must not call any function that can
160 sleep, which rules out thread_yield(), lock_acquire(), and many
161 others. This is because external interrupts use space on the stack of
162 the kernel thread that was running at the time the interrupt occurred.
163 If the interrupt handler tried to sleep and that thread resumed, then
164 the two uses of the single stack would interfere, which cannot be
165 allowed."
166
167 Is the last sentence really true?
168
169 I thought the reason that you couldn't sleep is that you would put
170 effectively a random thread/process to sleep, but I don't think it
171 would cause problems with the kernel stack.  After all, it doesn't
172 cause this problem if you call thread_yield at the end of
173 intr_handler(), so why would it cause this problem earlier.
174
175 As for thread_yield(), my understanding is that the reason it's called
176 at the end is to ensure it's done after the interrupt is acknowledged,
177 which you can't do until the end because Pintos doesn't handle nested
178 interrupts.
179
180  - Godmar
181
182 From: "Godmar Back" <godmar@gmail.com>
183
184 For reasons I don't currently understand, some of our students seem
185 hesitant to include each thread in a second "all-threads" list and are
186 looking for ways to implement the advanced scheduler without one.
187
188 Currently, I believe, all tests for the mlfqs are such that all
189 threads are either ready or sleeping in timer_sleep(). This allows for
190 an incorrect implementation in which recent-cpu and priorities are
191 updated only for those threads that are on the alarm list or the ready
192 list.
193
194 The todo item would be a test where a thread is blocked on a
195 semaphore, lock or condition variable and have its recent_cpu decay to
196 zero, and check that it's scheduled right after the unlock/up/signal.
197
198 From: "Godmar Back" <godmar@gmail.com>
199 Subject: set_priority & donation - a TODO item
200 To: "Ben Pfaff" <blp@cs.stanford.edu>
201 Date: Mon, 20 Feb 2006 22:20:26 -0500
202
203 Ben,
204
205 it seems that there are currently no tests that check the proper
206 behavior of thread_set_priority() when called by a thread that is
207 running under priority donation.  The proper behavior, I assume, is to
208 temporarily drop the donation if the set priority is higher, and to
209 reassume the donation should the thread subsequently set its own
210 priority again to a level that's lower than a still active donation.
211
212  - Godmar
213
214 From: Godmar Back <godmar@gmail.com>
215 Subject: project 4 question/comment regarding caching inode data
216 To: Ben Pfaff <blp@cs.stanford.edu>
217 Date: Sat, 14 Jan 2006 15:59:33 -0500
218
219 Ben,
220
221 in section 6.3.3 in the P4 FAQ, you write:
222
223 "You can store a pointer to inode data in struct inode, if you want,"
224
225 Should you point out that if they indeed do that, they likely wouldn't
226 be able to support more than 64 open inodes systemwide at any given
227 point in time.
228
229 (This seems like a rather strong limitation; do your current tests
230 open more than 64 files?
231 It would also point to an obvious way to make the projects harder by
232 specifically disallowing that inode data be locked in memory during
233 the entire time an inode is kept open.)
234
235  - Godmar
236
237 From: Godmar Back <godmar@gmail.com>
238 Subject: on caching in project 4
239 To: Ben Pfaff <blp@cs.stanford.edu>
240 Date: Mon, 9 Jan 2006 20:58:01 -0500
241
242 here's an idea for future semesters.
243
244 I'm in the middle of project 4, I've started by implementing a buffer
245 cache and plugging it into the existing filesystem.  Along the way I
246 was wondering how we could test the cache.
247
248 Maybe one could adopt a similar testing strategy as in project 1 for
249 the MLQFS scheduler: add a function that reads "get_cache_accesses()"
250 and a function "get_cache_hits()".  Then create a version of pintos
251 that creates access traces for a to-be-determined workload.  Run an
252 off-line analysis that would determine how many hits a perfect cache
253 would have (MAX), and how much say an LRU strategy would give (MIN).
254 Then add a fudge factor to account for different index strategies and
255 test that the reported number of cache hits/accesses is within (MIN,
256 MAX) +/- fudge factor.
257
258 (As an aside - I am curious why you chose to use a clock-style
259 algorithm rather than the more straightforward LRU for your buffer
260 cache implementation in your sample solution. Is there a reason for
261 that?  I was curious to see if it made a difference, so I implemented
262 LRU for your cache implementation and ran the test workload of project
263 4 and printed cache hits/accesses.
264 I found that for that workload, the clock-based algorithm performs
265 almost identical to LRU (within about 1%, but I ran nondeterministally
266 with QEMU). I then reduced the cache size to 32 blocks and found again
267 the same performance, which raises the suspicion that the test
268 workload might not force any cache replacement, so the eviction
269 strategy doesn't matter.)
270
271 Godmar Back <godmar@gmail.com> writes:
272
273 > in your sample solution to P4, dir_reopen does not take any locks when
274 > changing a directory's open_cnt. This looks like a race condition to
275 > me, considering that dir_reopen is called from execute_process without
276 > any filesystem locks held.
277
278 * Get rid of rox--causes more trouble than it's worth
279
280 * Reconsider command line arg style--confuses everyone.
281
282 * Finish writing tour.
283
284 * Introduce a "yield" system call to speed up the syn-* tests.
285
286 via Godmar Back:
287
288 * Project 3 solution needs FS lock.
289
290 * Get rid of mmap syscall, add sbrk.
291
292 * Make backtrace program accept multiple object file arguments,
293   e.g. add -u option to allow backtracing user program also.
294
295 * page-linear, page-shuffle VM tests do not use enough memory to force
296   eviction.  Should increase memory consumption.
297
298 * Add FS persistence test(s).
299
300 * lock_acquire(), lock_release() don't need additional intr_dis/enable
301   calls, because the semaphore protects lock->holder.
302   [ Think this over: is this really true when priority donation is 
303     implemented?  intr_dis/enable prevents the race with thread_set_priority. 
304     Leaving it there could help the students getting the correct synchronization
305     right.
306   ]
307
308
309
310 * process_death test needs improvement
311
312 * Internal tests.
313
314 * Improve automatic interpretation of exception messages.
315
316 * Userprog project:
317
318   - Mark read-only pages as actually read-only in the page table.  Or,
319     since this was consistently rated as the easiest project by the
320     students, require them to do it.
321
322   - Don't provide per-process pagedir implementation but only
323     single-process implementation and require students to implement
324     the separation?  This project was rated as the easiest after all.
325     Alternately we could just remove the synchronization on pid
326     selection and check that students fix it.
327
328 * Filesys project:
329
330   - Need a better way to measure performance improvement of buffer
331     cache.  Some students reported that their system was slower with
332     cache--likely, Bochs doesn't simulate a disk with a realistic
333     speed.
334
335 * Documentation:
336
337   - Add "Digging Deeper" sections that describe the nitty-gritty x86
338     details for the benefit of those interested.
339
340   - Add explanations of what "real" OSes do to give students some
341     perspective.
342
343 * Assignments:
344
345   - Add extra credit:
346
347     . Low-level x86 stuff, like paged page tables.
348
349     . Specifics on how to implement sbrk, malloc.
350
351     . Other good ideas.
352
353     . opendir/readdir/closedir
354
355     . everything needed for getcwd()