Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.arch.embedded > #28485
| From | "A.P.Richelieu" <aprichelieu@gmail.com> |
|---|---|
| Newsgroups | comp.arch.embedded |
| Subject | Re: How to avoid a task not executed in a real-time OS? |
| Date | 2019-01-28 20:15 +0100 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <q2nkd5$1j3h$1@gioia.aioe.org> (permalink) |
| References | <f2f8fe2e-e554-4a13-b28c-b918604405fd@googlegroups.com> <65410e9a-455a-4508-a5d3-60f46edaca4d@googlegroups.com> |
Den 2019-01-28 kl. 16:17, skrev StateMachineCOM: > A watchdog timer is really a hardware-assisted, time-based assertion in the code. As such, it is just a part of the larger software development strategy known as Design by Contract (DbC). > > The value of identifying the watchdog timer as an *assertion* is that it informs you what to expect from it. For example, you can't expect an assertion to "avoid" or "fix" a problem (like in the OP "avoid a task not executed"). This is because assertions neither handle nor prevent errors, in the same way as fuses in electrical circuits don't prevent accidents or abuse. In fact, a fuse is an intentionally introduced weak spot in the circuit that is designed to fail sooner than anything else, so actually the whole circuit with a fuse is less robust than without it. > > Now, regarding using watchdog timers in the context of an RTOS: you should service the watchdog from the context of the task. A common mistake is to service a watchdog from a periodic timer service. RTOS timers typically run in the ISR context, so they might be running and being serviced, while the task is starving. Another mistake along these lines is to service a watchdog from various RTOS callbacks, also known as "hooks", which might also run in a different context than your task. > > Once you use a watchdog timer, you need to carefully design (and test!) the behavior of the system when the watchdog expires. Here again, identifying the watchdog as an assertion helps, because you can use your general strategy of handling failed assertions. I've written more about this in the blog: ["A nail for a fuse"](https://embeddedgurus.com/state-space/2009/11/a-nail-for-a-fuse/). > > I am always amazed by embedded designs, where developers go to great lengths to apply memory protection (MPU or MMU) or watchdogs, while at the same time they don't sprinkle their code with basic code assertions that perform rudimentary sanity checks. > > Even more bizarre to me is when developers use assertions, but *disable* them in the production release (while keeping the MPU and the watchdogs.) I'm sure the readers of this forum never do such an illogical thing, and always ship the products with carefully designed assertions, right? > Assertions are there to check that your code is sane. They are designed to be removed in production code. Assertions are not the same thing as checking your input. You definitely need to check your input, but once validated, they do not need revalidation. if the input is not valid, an intelligent handling/recovery of the erronous output is preferred over some rough action generated by an assertion failure.
Back to comp.arch.embedded | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to avoid a task not executed in a real-time OS? Robert Willy <rxjwg98@gmail.com> - 2019-01-21 04:40 -0800
Re: How to avoid a task not executed in a real-time OS? John Speth <johnspeth@yahoo.com> - 2019-01-21 06:27 -0800
Re: How to avoid a task not executed in a real-time OS? Stef <stef33d@yahooI-N-V-A-L-I-D.com.invalid> - 2019-01-21 17:55 +0100
Re: How to avoid a task not executed in a real-time OS? Richard Damon <Richard@Damon-Family.org> - 2019-01-21 13:05 -0500
Re: How to avoid a task not executed in a real-time OS? upsidedown@downunder.com - 2019-01-22 08:05 +0200
Re: How to avoid a task not executed in a real-time OS? Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2019-01-21 22:44 +0100
Re: How to avoid a task not executed in a real-time OS? David Brown <david.brown@hesbynett.no> - 2019-01-22 09:19 +0100
Re: How to avoid a task not executed in a real-time OS? Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2019-01-22 22:10 +0100
Re: How to avoid a task not executed in a real-time OS? Dave Nadler <drn@nadler.com> - 2019-01-22 13:28 -0800
Re: How to avoid a task not executed in a real-time OS? David Brown <david.brown@hesbynett.no> - 2019-01-23 08:57 +0100
Re: How to avoid a task not executed in a real-time OS? Paul Rubin <no.email@nospam.invalid> - 2019-01-23 13:13 -0800
Re: How to avoid a task not executed in a real-time OS? David Brown <david.brown@hesbynett.no> - 2019-01-24 08:31 +0100
Re: How to avoid a task not executed in a real-time OS? George Neuner <gneuner2@comcast.net> - 2019-01-22 05:01 -0500
Re: How to avoid a task not executed in a real-time OS? StateMachineCOM <statemachineguru@gmail.com> - 2019-01-28 07:17 -0800
Re: How to avoid a task not executed in a real-time OS? "A.P.Richelieu" <aprichelieu@gmail.com> - 2019-01-28 20:15 +0100
Re: How to avoid a task not executed in a real-time OS? StateMachineCOM <statemachineguru@gmail.com> - 2019-01-28 12:31 -0800
Re: How to avoid a task not executed in a real-time OS? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2019-01-28 16:22 -0500
Re: How to avoid a task not executed in a real-time OS? Clifford Heath <no.spam@please.net> - 2019-01-29 10:17 +1100
Re: How to avoid a task not executed in a real-time OS? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2019-01-29 10:08 -0500
Re: How to avoid a task not executed in a real-time OS? StateMachineCOM <statemachineguru@gmail.com> - 2019-01-29 09:30 -0800
Re: How to avoid a task not executed in a real-time OS? Tom Gardner <spamjunk@blueyonder.co.uk> - 2019-01-29 18:22 +0000
Re: How to avoid a task not executed in a real-time OS? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2019-01-29 13:50 -0500
Re: How to avoid a task not executed in a real-time OS? Clifford Heath <no.spam@please.net> - 2019-01-30 09:45 +1100
Re: How to avoid a task not executed in a real-time OS? Tom Gardner <spamjunk@blueyonder.co.uk> - 2019-01-30 00:56 +0000
Re: How to avoid a task not executed in a real-time OS? Reinhardt Behm <rbehm@hushmail.com> - 2019-01-30 13:32 +0800
Re: How to avoid a task not executed in a real-time OS? "A.P.Richelieu" <aprichelieu@gmail.com> - 2019-01-30 19:07 +0100
Re: How to avoid a task not executed in a real-time OS? StateMachineCOM <statemachineguru@gmail.com> - 2019-01-30 12:31 -0800
Re: How to avoid a task not executed in a real-time OS? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2019-01-30 16:23 -0500
Re: How to avoid a task not executed in a real-time OS? "A.P.Richelieu" <aprichelieu@gmail.com> - 2019-01-31 06:05 +0100
Re: How to avoid a task not executed in a real-time OS? kegs@provalid.com (Kent Dickey) - 2019-02-02 10:44 -0600
Re: How to avoid a task not executed in a real-time OS? Phil Hobbs <pcdhSpamMeSenseless@electrooptical.net> - 2019-02-02 12:19 -0500
csiph-web