Event Driven vs Polling |
|
|
|
| Written by Graham Stoney | |||
|
You probably don't need me to tell you that event driven systems are more efficient than polling. In any non-trivial embedded or real-time system, chances are that the operating system model is interrupt- and event-driven; and your custom drivers and application software should be too. Polling sometimes gets used because it's simpler to implement and easier to get right. It's not just access to hardware devices where polling can creep into embedded systems, it also sometimes gets used in higher level software. Any time you have a loop that waits for something other than a blocking event, you're using polling; and that's sacrificing your system efficiency. Any event-driven system can be modelled as a state machine. Complex systems usually require multiple interacting state machines, or perhaps a whole heirarchy of them, to be modelled optimally. If you can't find an event trigger for every action in your system, it's a symptom that polling may have crept into your design.
|











