🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.xinu
Article #165

Q: is there a bug in sleep10() ?

#165
From: Bruce M. Walker
Date: Sun, 13 Dec 1992 19:55
37 lines
1845 bytes
Here is a question about a possibly subtle problem in interrupt
handling in XINU:

Early in the text [1], the importance of preventing kernel structures
from being corrupted by conflicting processes is stressed.  The notion
of surrounding critical regions with

    char ps;
    disable(ps);
    ...              /* critical code */
    restore(ps);

is discussed in section 5.2 "System Calls".

The area I'm interested in is resched() and ctxsw().  Examination of
the code reveals that in almost all cases, the functions calling
resched() do so when the interrupts are off (ie: inside of
disable/restore sections).

Except: in the SYSCALLs "sleep()" and "sleep10()" from sections 10.5
and 10.6, resched() is called directly from these functions, and
*with the interrupts enabled*!

Now the question:  am I missing something, or does this not violate the
rules about protecting the pentry structures?  What would happen if an
interrupt went off while we're executing inside ctxsw(); that is, when
we're half way through exchanging registers from one process context to
the next?  Wouldn't this result in complete havoc?

---
[1] my reference copy is: "Operating System Design: The XINU Approach",
    Comer; 1984

--
"Eventually, I decided that thinking was not getting me very far and it
 was time to try building."           -- Rob Pike, The Text Editor sam
      bmw@isgtec.com   [ ...!uunet.ca!isgtec!bmw ]  Bruce Walker
Technical Details
Message-ID: <3854@isgtec.isgtec.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!torn!utzoo!censor!isgtec!bmw

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!torn!utzoo!censor!isgtec!bmw
From: bmw@isgtec.com (Bruce M. Walker)
Newsgroups: comp.os.xinu
Subject: Q: is there a bug in sleep10() ?
Message-ID: <3854@isgtec.isgtec.com>
Date: 13 Dec 92 19:55:37 GMT
Sender: root@isgtec.com
Distribution: world
Organization: ISG Technologies Inc., Mississauga Ontario
Lines: 37