From: Ben Pfaff Date: Tue, 20 Dec 2005 18:35:50 +0000 (+0000) Subject: Clarify that adding code where interrupts are already disabled may be X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b08d79f8b1891415cfb6727b11ea83c4ef0b8f5e;p=pintos-anon Clarify that adding code where interrupts are already disabled may be necessary. --- diff --git a/doc/threads.texi b/doc/threads.texi index 28b87fa..6b93dbb 100644 --- a/doc/threads.texi +++ b/doc/threads.texi @@ -328,9 +328,14 @@ timer ticks or input events. Turning off interrupts also increases the interrupt handling latency, which can make a machine feel sluggish if taken too far. +You may need to add or modify code where interrupts are already +disabled, such as in @func{sema_up} or @func{sema_down}. You should +still try to keep this code as short as you can. + Disabling interrupts can be useful for debugging, if you want to make sure that a section of code is not interrupted. You should remove -debugging code before turning in your project. +debugging code before turning in your project. (Don't just comment it +out, because that can make the code difficult to read.) There should be no busy waiting in your submission. A tight loop that calls @func{thread_yield} is one form of busy waiting.