The Role of Operating Systems in IoT

The number of Internet of Things devices both in our homes and in the world has exploded in the last few years. Smart IoT devices can now replace everything from the humble light switch all the way to smart lawnmowers, All of these devices are driven by an Operating System of some sort. What Operating Systems are available and what do you need to consider when selecting an OS for a new product?