home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / os / os2 / misc / 27433 < prev    next >
Encoding:
Internet Message Format  |  1992-08-14  |  3.8 KB

  1. Xref: sparky comp.os.os2.misc:27433 comp.os.os2.programmer:4233
  2. Newsgroups: comp.os.os2.misc,comp.os.os2.programmer
  3. Path: sparky!uunet!wupost!darwin.sura.net!jvnc.net!princeton!newross!elan!mg
  4. From: mg@elan (Michael Golan)
  5. Subject: Re: Request for info about kernel pre-emption and priorities
  6. Message-ID: <mg.713847158@elan>
  7. Sender: news@newross.Princeton.EDU (USENET News System)
  8. Organization: Princeton University, Dept. of Computer Science
  9. References: <1992Aug13.221616.7894@ttinews.tti.com>             <1992Aug14.054245.25657@nuscc.nus.sg> <19920814.005557.382@almaden.ibm.com>
  10. Date: 15 Aug 92 02:52:38 GMT
  11. Lines: 61
  12.  
  13. peterf@vnet.ibm.com (Peter Forsberg) writes:
  14. >When a thread has entered the kernel, it is allowed to execute there
  15. >until it either exits the kernel or waits for some event (I/O etc.).
  16. >No other thread will be dispatched as long as the kernel thread is still
  17. >running. The kernel thread can be interrupted by a hardware
  18. >interrupt at any time though (unless it has disabled interrupts).
  19. >When the thread is about to exit the kernel it calls the dispatcher,
  20. >which decides if a context switch should occur. Of course a context
  21. >switch always occurs when the thread in the kernel waits for an event.
  22.  
  23. >Disclaimer: This posting represents the poster's views, not those of IBM
  24.  
  25. Is this the last word on this subject? Thanks god, I was about to go
  26. read my OS books again :-)
  27.  
  28. The above means that OS2's kernel is designed just like most (if not all)
  29. kernels:
  30. 1) when a thread executes a system call, the system call executes in the
  31.    kernel until it *decides* to release control (= wait for event =
  32.    co-operative multi-tasking internally to the kernel).
  33. 2) Some system calls decide to release control just because they take long
  34.    and see that some high-priority process is waiting. but from the technical
  35.    point this is just like the system-call putting itself to sleep for an
  36.    event. Hack this is probably implemented as a 'wait for event' where
  37.    the event is 'no more high-priority tasks on the ready queue'...
  38.    (or even more simple: release control once. it returns to you if no
  39.    high-priority task exist. else they execute and then return to you)
  40. 3) OS2 kernel differs from Unix in that a systemcall check if a high-priority
  41.    process is waiting before it returns. Otherwise it is pretty similar
  42.    (in general! I know it differs a lot)
  43. 4) hardware interrupts can of course occur even in kernel mode. Their
  44.    processing occur immediately, which can wake up some high-priority 
  45.    processes. these processes can continue execution, in turn, when the 
  46.    existing system call (as in (1) and (2)) ends or release cpu control. 
  47.    of course if this happens in user mode, the user thread IS preempted.
  48.  
  49. So:
  50. * No magic, no 'multi threaded kernel' nor 'preemptinve kernel',
  51.   which are weird (and I think expensive. Anyone know of a commercial
  52.   widely used system designed that way?)
  53. * the 4ms (6?) delay is the time for a kernel system call to end, or 
  54.   release control (worst case for worst sys call)
  55. * unlike god-damn Unix, OS2 will preempt user processes in user mode or
  56.   at the end of their kernel mode to run high-priority processes.
  57.   oops i mean threads
  58.  
  59. (I didn't read anything specific about OS2 internals except this group, BTW.
  60. the above is my guesstimate/understanding)
  61.  
  62. Now what was this nonsense about making the kernel 'completely re-entrant
  63. and preemptive'? Did I hear that IBM is redesigning the whole thing, or
  64. simply looking into some slow sys-calls to make them give control,
  65. voluntarily more often/in more cases (which, as a result, requires more
  66. semaphores to be put in to make those calls re-entrant)? Which one is it:
  67. 1) A bad rumor (not the post I followed up, BTW)
  68. 2) A total new amazing design of a truly preempting kernel
  69. 3) An improvement of some of the more sluggish syscalls to put this 4ms figure
  70.    down to 1ms or so?
  71.  
  72. -- Michael Golan
  73.    mg@princeton.edu
  74.