home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / realtime / 1451 < prev    next >
Encoding:
Text File  |  1992-12-18  |  2.8 KB  |  61 lines

  1. Newsgroups: comp.realtime
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!cbnewsm!lfd
  3. From: lfd@cbnewsm.cb.att.com (Lee Derbenwick)
  4. Subject: Re: Real_time systems
  5. Organization: AT&T
  6. Date: Thu, 17 Dec 1992 23:44:30 GMT
  7. Message-ID: <1992Dec17.234430.18247@cbnewsm.cb.att.com>
  8. Summary: Preemption implies processes; real-time doesn't.
  9. References: <1992Dec16.120723.6377@lut.ac.uk>
  10. Lines: 49
  11.  
  12. In article <1992Dec16.120723.6377@lut.ac.uk>, R.Sheikhan2@lut.ac.uk (ZAGROS) writes:
  13. > Is it true to say that, preemption is an essential characteristic of 
  14. > a real_time system? if not how can we make sure that all tasks will
  15. > meet their deadlines? 
  16.  
  17. "Preemption" assumes that you've got processes to be preempted,
  18. which is already saying way too much.
  19.  
  20. A classic real-time technique is simply an infinite loop, which
  21. calls one function for each "task" it needs to do.  Each function
  22. is restricted to a maximum operating time (i.e., _they_ can't
  23. have unrestricted loops), and the sum of all these times must be
  24. less than the maximum tolerable latency for any action.  You
  25. don't even need interrupts.
  26.  
  27. (Of course, vendors of "real-time operating systems" do _not_
  28. want you to consider this approach.  :-)
  29.  
  30. Lots of elaboration is possible.  Add interrupts to register events
  31. or to support (a very few) short-maximum-latency actions.  The
  32. timing calculations are more difficult, but still trivial compared
  33. to multiple processes.
  34.  
  35. I worked on one project that had, instead of a fixed loop, a priority
  36. queue of "joblets": ordinary C functions each of which was called to
  37. do some job (or part thereof), and each of which had a maximum
  38. processing time.  If a job required too much time for one joblet, it
  39. was required to save any state it needed, add itself to the queue
  40. again, then return.
  41.  
  42. This scheme gave much the flexibility of arbitrary multi-programming,
  43. while making synchronization trivial, since there was no preemption
  44. except for interrupt handlers.  Testing was also much simpler, and
  45. it was easy to monitor what was going on in the executing system.
  46. We worried some about the state saving, but it turned out that in
  47. most cases one or two variables (usually a loop counter) was all
  48. that was needed beyond variables already in memory.  "Context switch"
  49. time was much faster than would have been possible for a true
  50. process implementation, and since we were working on an _abysmally_
  51. slow processor, this was important.
  52.  
  53. This turns out to be rather similar to the way "streams" work in UNIX
  54. System V: a stream module is called as an ordinary function (within
  55. the kernel); it is required to execute, save any state it needs for
  56. future executions, and return.
  57.  
  58.  -- Speaking strictly for myself,
  59.  --   Lee Derbenwick, AT&T Bell Laboratories, Holmdel, NJ
  60.  --   lfd@cbnewsm.ATT.COM  or  <wherever>!att!cbnewsm!lfd
  61.