home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / realtime / 1469 < prev    next >
Encoding:
Text File  |  1992-12-22  |  4.1 KB  |  85 lines

  1. Newsgroups: comp.realtime
  2. Path: sparky!uunet!munnari.oz.au!metro!dmssyd.syd.dms.CSIRO.AU!megadata!andrew
  3. From: andrew@megadata.mega.oz.au (Andrew McRae)
  4. Subject: Re: Real_time systems
  5. Message-ID: <1992Dec22.041024.25911@megadata.mega.oz.au>
  6. Originator: andrew@noah
  7. Sender: news@megadata.mega.oz.au
  8. Organization: Megadata P/L, North Ryde, Sydney, Aust.
  9. References: <1992Dec17.234430.18247@cbnewsm.cb.att.com>
  10. Date: Tue, 22 Dec 1992 04:10:24 GMT
  11. Lines: 72
  12.  
  13. From article <1992Dec17.234430.18247@cbnewsm.cb.att.com>, by lfd@cbnewsm.cb.att.com (Lee Derbenwick):
  14. > In article <1992Dec16.120723.6377@lut.ac.uk>, R.Sheikhan2@lut.ac.uk (ZAGROS) writes:
  15. >> Is it true to say that, preemption is an essential characteristic of 
  16. >> a real_time system? if not how can we make sure that all tasks will
  17. >> meet their deadlines? 
  18. > "Preemption" assumes that you've got processes to be preempted,
  19. > which is already saying way too much.
  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. > (Of course, vendors of "real-time operating systems" do _not_
  27. > want you to consider this approach.  :-)
  28. >  --   Lee Derbenwick, AT&T Bell Laboratories, Holmdel, NJ
  29.  
  30. Having worked on embedded real time systems for 10 years, and
  31. written a number of embedded operating systems on various
  32. platforms, I heartily agree. I see a lot of companies selling
  33. whiz-bang `Real Time' Operating Systems that have complex
  34. priority and preemption schemes; especially true with the
  35. Unix-compatible systems, where non-realtime and realtime tasks
  36. are mixed (IMHO put the real time tasks where they belong - out
  37. of Unix and into embedded systems...)
  38.  
  39. The complexity of these systems is mostly (I say again, *mostly*,
  40. not *always*) unwarranted and often add to the overall cost
  41. of the system (in terms of memory, CPU, software cost etc.)
  42. In the truly embedded world, it is often better to simplify
  43. the OS and make the processes/tasks running under it `co-operative',
  44. so that timing contracts are met.
  45.  
  46. Preemption and priorities are a slippery slope; once you
  47. are on them, you quickly slide down into a sticky swamp. Why?
  48. Prioritisation implies preemption - there would be no point in
  49. having a higher priority task if it did not preempt a lower
  50. priority task. If you have preemption, then you have a problem
  51. with synchronisation and locking, especially with shared data structures
  52. such as lists and queues. Fine, you then add semaphores, messaging
  53. and mailboxes so that you can overcome the locking problems, but
  54. you have to ensure that preemption works properly and that
  55. tasks do not get switched in the middle of critical sections. So you
  56. add monitors, or have the concept of priviledge (priviledged sections
  57. do not get switched), and then after each monitor/semaphore you have
  58. checking for preemption... And then you find that your real time
  59. operating system has grown too big and slow for your real time
  60. processing needs, since it spends all its time locking and
  61. messaging and semaphoring and preempting, so you have to
  62. buy a bigger processor with more memory, and buy a more
  63. expensive licence for your whiz-bang real time OS.
  64.  
  65. I have come to the conclusion that preemption is to be
  66. avoided *if at all possible*, since it carries a lot of
  67. baggage with it. But having said all that, it certainly
  68. has its place outside of the hard real time world, especially
  69. in systems that require some aspects of real time behaviour, such
  70. as responding quickly to user input, yet sharing CPU resources
  71. fairly amongst competing processes, where some processes are considered
  72. higher priority (e.g the X server responding to mouse/keyboard events,
  73. yet while processing large bit images). Threads will help a lot.
  74.  
  75. Only my opinion, of course.
  76.  
  77. Andrew McRae            inet:    andrew@mega.oz.au
  78. Megadata Pty Ltd,        uucp:    ..!uunet!mega.oz.au!andrew
  79. North Ryde  2113        Phone:    +61 2 805 0899
  80. NSW    AUSTRALIA        Fax:    +61 2 887 4847
  81.