home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / realtime / 1507 < prev    next >
Encoding:
Text File  |  1993-01-06  |  7.3 KB  |  134 lines

  1. Newsgroups: comp.realtime
  2. Path: sparky!uunet!cs.utexas.edu!zaphod.mps.ohio-state.edu!uwm.edu!linac!att!cbnewse!cbnewsd!varney
  3. From: varney@cbnewsd.cb.att.com (Al Varney)
  4. Subject: Re: Real_time systems
  5. Organization: AT&T Network Systems, Lisle, IL
  6. Distribution: na
  7. Date: Wed, 6 Jan 1993 04:52:41 GMT
  8. Message-ID: <1993Jan6.045241.22957@cbnewsd.cb.att.com>
  9. References: <1992Dec17.234430.18247@cbnewsm.cb.att.com> <1992Dec22.041024.25911@megadata.mega.oz.au>
  10. Sender: Al Varney <varney@ihlpl.ih.att.com>
  11. Lines: 121
  12.  
  13. In article <1992Dec22.041024.25911@megadata.mega.oz.au> andrew@megadata.mega.oz.au (Andrew McRae) writes:
  14. >From article <1992Dec17.234430.18247@cbnewsm.cb.att.com>, by lfd@cbnewsm.cb.att.com (Lee Derbenwick):
  15. >> In article <1992Dec16.120723.6377@lut.ac.uk>, R.Sheikhan2@lut.ac.uk (ZAGROS) writes:
  16. >>> Is it true to say that, preemption is an essential characteristic of 
  17. >>> a real_time system? if not how can we make sure that all tasks will
  18. >>> meet their deadlines? 
  19. >> 
  20. >> "Preemption" assumes that you've got processes to be preempted,
  21. >> which is already saying way too much.
  22. >> 
  23. >> A classic real-time technique is simply an infinite loop, which
  24. >> calls one function for each "task" it needs to do.  Each function
  25. >> is restricted to a maximum operating time (i.e., _they_ can't
  26. >> have unrestricted loops), and the sum of all these times must be
  27. >> less than the maximum tolerable latency for any action.  You
  28. >> don't even need interrupts.
  29.  
  30. >>  --   Lee Derbenwick, AT&T Bell Laboratories, Holmdel, NJ
  31.  
  32.    Excellent description of the basic software in the No. 1/1A ESS(tm)
  33. and 4ESS(tm) switching systems.  The former do use a single repeated
  34. 5 msec. interrupt to drive "timing-dependent" functions, because the
  35. basic "peripheral hardware" doesn't buffer things like dial pulses and
  36. DTMF digits.  The actual loop isn't really constrained to some fixed
  37. time for each cycle, but the average time around the loop over time had
  38. better be below a fixed time period -- if not, the offered load is above
  39. your CPU capacity (you're in overload).  Adding a pre-emptive scheduler
  40. in such an environment will just use up more CPU cycles, since the offered
  41. load is beyond capacity.  The key is to have each "task" do a small amount
  42. of work with very little overhead.  When "stitched" together, all the tasks
  43. cooperate to perform useful work.
  44.  
  45.    Where pre-emption is needed is when "tasks" are added to such a system
  46. that are not performing time-critical or capacity-related functions.
  47. Thus the pre-emptive scheduler can "defer" these tasks and let the time-
  48. critical tasks run.  Even if interrupts are needed in a system, one can
  49. structure the non-critical tasks as pre-emptive and run the others in
  50. a higher-priority "supervisor" or "kernel" layer using the infinite loop
  51. technique.  Interrupts (other than sanity timers, routine timers and fault
  52. detection) are usually a "bad" design idea for real-time systems.  After
  53. all, it means that at peak load (max. interrupt rate), you're spending
  54. a lot of CPU time saving/restoring process state.  Instead, spend those
  55. CPU cycles "scanning" for work, which at peak load will usually be presented
  56. to the CPU at just the rate it can get around to servicing it.
  57.  
  58.    Note that the "anti-interrupt" statement above means that the real-time
  59. software/CPU will spend a lot of time in useless "scanning" when there's
  60. very little load.  So what? -- unless you have something non-critical to
  61. also run on the CPU, there isn't any more useful way to use up those CPU
  62. cycles.  In the same two states, the pre-emptive/interrupt-intensive
  63. model will do very well at small loads (CPU cycles are allocated well),
  64. but will itself consume much of the CPU during peak load.
  65.  
  66.    Of course, bigger/faster CPUs fix the latter problem -- if they exist
  67. and you can afford to replace what's "out there".
  68.  
  69.    Several AT&T products use the 3B20D(tm) processor as an embedded part
  70. of the product.  The OS [UNIX(tm in transition] RTR) supports a kernel
  71. with message passing, events, dynamically-loaded/replaceable device drivers,
  72. etc. on a paged/segmented architecture.  The UNIX part is really a scheduler
  73. with support processes that basically all run at USER levels.  But the
  74. OS supports "kernel processes" at various priority levels, and provides
  75. mechanisms supporting "light-weight processes" within the kernel.  The
  76. combination provides for multiple "mini-OSes" running on the kernel, each
  77. managing it's own processes.  UNIX is just one of those "mini-OSes".
  78.  
  79.    While not ideal, RTR does allow for some fairly efficient task execution
  80. at the kernel process level (you don't have to have pre-emption of kernel
  81. processes), and still gives you a UNIX environment at the USER level for
  82. all those non-critical processes.  Seems like a reasonable trade-off to me.
  83. (Still, in the end, the CPU has to eventually get around to running everything
  84. or you're still out of capacity.)
  85.  
  86.    UNIX RTR is described in one of the Bell System Technical Journals
  87. that was devoted to the 3B20 processor (the "D" in 3B20D is for DUPLEX,
  88. a loosely-coupled dual-CPU reliable verion of the basic 3B20).  The early
  89. fore-runner of RTR was called DMERT (Duplex Multi-Execution Real-Time),
  90. which was an enhanced version of MERT, documented in one of the original
  91. Bell System Technical Journal issues devoted to UNIX.  MERT ran on the
  92. DEC PDP-11/70, and supported such things as DMA I/O direct to/from user
  93. address space (even for block devices) and asynchronous I/O with event
  94. waiting at the user level.  I can remember virtually stalling an 11/70
  95. by doing a double-buffered tape-to-tape copy with 20K blocks -- the UNIBUS
  96. just didn't have many cycles to spare when two tape devices were both
  97. transferring data.  On the other hand, the tapes really MOVED!!!
  98.  
  99. >Having worked on embedded real time systems for 10 years, and
  100. >written a number of embedded operating systems on various
  101. >platforms, I heartily agree. I see a lot of companies selling
  102. >whiz-bang `Real Time' Operating Systems that have complex
  103. >priority and preemption schemes; especially true with the
  104. >Unix-compatible systems, where non-realtime and realtime tasks
  105. >are mixed (IMHO put the real time tasks where they belong - out
  106. >of Unix and into embedded systems...)
  107.  
  108. >The complexity of these systems is mostly (I say again, *mostly*,
  109. >not *always*) unwarranted and often add to the overall cost
  110. >of the system (in terms of memory, CPU, software cost etc.)
  111. >In the truly embedded world, it is often better to simplify
  112. >the OS and make the processes/tasks running under it `co-operative',
  113. >so that timing contracts are met.
  114.  
  115.    Well, I'll add my 20 years on to that -- interrupts and pre-emption
  116. work well at SHARING a CPU, and there are lots of reasons to do that --
  117. "real-time" and "sharing" just don't go together well.  Co-operative,
  118. non-premptive methods, on the other hand, support the maximum utilization
  119. of the CPU under load.  It's hard to believe an OS can support both needs
  120. on the same CPU without supporting non-premptive tasks above pre-emptive
  121. ones (support for communication with low/no interrupts may also be needed).
  122.  
  123. >I have come to the conclusion that preemption is to be
  124. >avoided *if at all possible*, since it carries a lot of
  125. >baggage with it. But having said all that, it certainly
  126. >has its place outside of the hard real time world, ....
  127.  
  128. >Only my opinion, of course.
  129. >
  130. >Andrew McRae            inet:    andrew@mega.oz.au
  131.  
  132. Al Varney - just MY opinion, too.
  133.  
  134.