{"id":8464,"date":"2017-11-27T10:13:14","date_gmt":"2017-11-27T09:13:14","guid":{"rendered":"https:\/\/blogs.mentor.com\/colinwalls\/?p=8464"},"modified":"2017-11-27T10:13:14","modified_gmt":"2017-11-27T09:13:14","slug":"rtos-event-groups","status":"publish","type":"post","link":"https:\/\/blogs.stage.sw.siemens.com\/embedded-software\/2017\/11\/27\/rtos-event-groups\/","title":{"rendered":"RTOS event groups"},"content":{"rendered":"<p>This is the latest in my occasional series of posts about RTOS features and I want to talk about event groups &#8211; also called event flags. This is a feature available in many RTOS products, including, of course, our own <a href=\"https:\/\/www.mentor.com\/embedded-software\/nucleus\/\" target=\"_blank\" rel=\"noopener noreferrer\">Nucleus RTOS<\/a>. Although my comments are inspired by the Nucleus implementation, they are very similar in other RTOSes \u2026<!--more--><\/p>\n<p>An event group is a set of 1-bit flags. In Nucleus, an event group has 32 flags, but other RTOSes may offer 8- or 16-flag groups. An event group is a standalone object &#8211; it does not \u201cbelong&#8221; to any specific task. Their purpose is to provide a very simple, but flexible, intertask communications mechanism. They are normally used for one task to advise another that some kind of event has occurred.<\/p>\n<p>Any task can set or clear event flags. This may be done using AND\/OR operations, which enables any number of flags in a group to be set to 1 or 0 [or not be changed].<\/p>\n<p><a href=\"https:\/\/blogs.sw.siemens.com\/wp-content\/uploads\/sites\/51\/2017\/11\/04-1.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-8466\" src=\"https:\/\/blogs.sw.siemens.com\/wp-content\/uploads\/sites\/51\/2017\/11\/04-1-520x282.png\" alt=\"\" width=\"520\" height=\"282\" \/><\/a><\/p>\n<p>Another task can \u201cretrieve\u201d the flags. This may be done by reading their state, which may be performed with a task suspend that pends on a specific flag, one of several flags or a combination of flags. The retrieve process may also \u201cconsume\u201d the flags; this means that the flags are cleared down by the process of retrieval.<\/p>\n<p>When designing a multithreaded embedded application, intertask communication and synchronization needs to be considered. Event flags provide a very simple mechanism with low overhead, that may be used in many applications.<\/p>\n<p><a href=\"http:\/\/www.linkedin.com\/in\/colinwalls\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-6579\" src=\"http:\/\/s3-blogs.mentor.com\/colinwalls\/files\/2014\/01\/linkedin.png\" alt=\"\" width=\"40\" height=\"40\" \/><\/a><a href=\"https:\/\/twitter.com\/colin_walls\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-6583\" src=\"http:\/\/s3-blogs.mentor.com\/colinwalls\/files\/2014\/01\/twitter.png\" alt=\"\" width=\"40\" height=\"40\" \/><\/a><a href=\"https:\/\/www.facebook.com\/colinwalls.author\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-6591\" src=\"http:\/\/s3-blogs.mentor.com\/colinwalls\/files\/2014\/01\/facebook.png\" alt=\"\" width=\"40\" height=\"40\" \/><\/a><a href=\"https:\/\/plus.google.com\/116301748426290440139\/posts?hl=en%3Fhl=en\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-6587\" src=\"http:\/\/s3-blogs.mentor.com\/colinwalls\/files\/2014\/01\/google.png\" alt=\"\" width=\"40\" height=\"40\" \/><\/a><a href=\"http:\/\/www.slideshare.net\/ColinWalls\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-6595\" src=\"http:\/\/s3-blogs.mentor.com\/colinwalls\/files\/2014\/01\/slideshare.jpg\" alt=\"\" width=\"41\" height=\"41\" \/><\/a><a href=\"http:\/\/blogs.mentor.com\/colinwalls\/\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-6599\" src=\"http:\/\/s3-blogs.mentor.com\/colinwalls\/files\/2014\/01\/wordpress.jpg\" alt=\"\" width=\"44\" height=\"44\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is the latest in my occasional series of posts about RTOS features and I want to talk about event&#8230;<\/p>\n","protected":false},"author":71677,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spanish_translation":"","french_translation":"","german_translation":"","italian_translation":"","polish_translation":"","japanese_translation":"","chinese_translation":"","footnotes":""},"categories":[1],"tags":[300,671,304,374,378,309],"industry":[],"product":[],"coauthors":[],"class_list":["post-8464","post","type-post","status-publish","format-standard","hentry","category-news","tag-embedded-software","tag-event-flags","tag-nucleus","tag-nucleus-os","tag-nucleus-rtos","tag-rtos"],"_links":{"self":[{"href":"https:\/\/blogs.stage.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/posts\/8464","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.stage.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.stage.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.stage.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/users\/71677"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.stage.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/comments?post=8464"}],"version-history":[{"count":0,"href":"https:\/\/blogs.stage.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/posts\/8464\/revisions"}],"wp:attachment":[{"href":"https:\/\/blogs.stage.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/media?parent=8464"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.stage.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/categories?post=8464"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.stage.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/tags?post=8464"},{"taxonomy":"industry","embeddable":true,"href":"https:\/\/blogs.stage.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/industry?post=8464"},{"taxonomy":"product","embeddable":true,"href":"https:\/\/blogs.stage.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/product?post=8464"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/blogs.stage.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/coauthors?post=8464"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}