1、ZBus-the lightweight and flexible Zephyr message busRodrigo Peixoto,Edge-UFAL/Citriniorodrigopex1MotivationThread AThread BONE-TO-ONEFIFOLIFOStackMessage queueMailboxPipe2MotivationThread AThread BThread CThread DFIFOLIFOStackMessage queueMailboxPipeONE-TO-MANY3MotivationThread AThread BThread CThre
2、ad DThread EMANY-TO-MANYFIFOLIFOStackMessage queueMailboxPipe4Solution ideaMessage busThread AThread BThread CThread DThread EFIFOLIFOStackMessage queueMailboxPipeBus5Bus topologies6ONE-TO-ONEONE-TO-MANYMANY-TO-MANYEmbedded systems challenges Memory constraints Processing limitations Battery-powered
3、 devices7 ZBusChan 1Chan 2Chan 3Chan N8Thread AThread BThread CSubscribersAsynchronous ZBusChan 1Chan 2Chan 3Chan NDecoupled9TimeSpaceSynchronizationThread AThread BThread CCallback DCallback ESubscribersListenersAsynchronousSynchronousTimeSpaceSynchronizationDecoupledCoupled ZBusChan 1Chan 2Chan 3C
4、han N1011ThreadReadChannelAvailable actions12ThreadPublishNotify*ChannelAvailable actionsSubscriber Notification queue Listener Callbackexecuteput13Channel AChannel BMessage:“Hi!”Subscribers:Thread 2Listeners:listener1()listener2()Channel CChannel DBusEvent DispatcherThread 2Thread 1void listener1()
5、void listener2()125346Virtual Distributed Event DispatcherVDED is the bus logic responsible for sending notifications about message publications to the channels observers.There is no central entity that acts as an event dispatcher on ZBus.14Virtual Distributed Event Dispatcher ZBusThread 1Chan AThre
6、ad 2BroadcastexampleListener 1Listener 2Thread 3Thread 415Virtual Distributed Event Dispatcher16Virtual Distributed Event Dispatcher ZBusThread 1Chan AThread 2Chan BThread 4Thread 3High priority contextLow priority context1718ThreadClaim/FinishChannelAvailable actionsExample19ExampleButton20Example2