Sunday, 13 May 2018

Azure Sphere - New Kid On The Block


WHAT?? Microsoft's own Linux distribution!! That's music to my ears. Who would have thought that Microsoft will launch its own Linux distribution? In this blog, I am penning down few thoughts which struck my mind as I was wondering what might have made them take this step. I am no expert in this, so just bouncing my thoughts from a beginner's perspective.

Firstly, why Linux kernel? Why not Windows core?




Few months back I was reading articles and watching Channel9 videos to see how Windows team has created a minimal kernel for Windows (the Windows Core). When Azure Sphere was announced, I could immediately relate it to the research I did on windows core and see why MS had to take this step. Below is a brief summary of my findings (in case you didn't get a chance to go through Windows core kernel articles).

The monolithic kernel was a pain
Back in around 2000, MS realized that monolithic kernel is a pain to maintain and started decoupling the windows components to extract a minimal kernel. The reasons for them to take up this initiative were that 
  • It was too difficult to maintain a huge monolithic kernel with a heavily coupled code base
  • They couldn't put Windows on small devices
There was a time when they tried to separate out GUI component from Windows and the OS broke. So back then it wasn't possible to create a non-GUI version of Windows. Also, a change in one of the component would break multiple separate components from other departments. This made testing cycles very long and it wasn't a reliable design. 


Creation of the Windows Core Kernel

To address these issues with tangled OS code base, they formed an internal team by selecting few MS architects from all over the world whose primary motive was to extract a core kernel from Windows code base. This team of experts started ranking each component based on their role in the OS. For example, core OS components like the scheduler would be ranked at level 0 and components like the GUI would be ranked at higher levels. Next step was to decouple various components and remove any dependencies where lower ranked modules depended on higher ranked ones. Finally, they extracted the lowest rank subsystems as the "Windows Core Kernel". In recent years, they have started using this minimal core kernel and across all devices (not just desktops).


Coming back to the question, why Linux kernel?

I see few points which go in favor of using Linux kernel for IoT devices. Before digging into this, let's take a look at the Azure Sphere's OS layers.


Azure Sphere has a "customized Linux kernel" as its layer 2. Although windows team has worked really hard in last 2 decades to decouple the traditional Monolith kernel; I think it is still far from a perfect minimal kernel. The other day my sister was doing some experiments with an IoT device and told me that Linux distributions are better than Win10 IoT. Well, we might be wrong in concluding that, as it was a part of basic experiments.

But if you see Win and Linux architectures, Linux has been designed to be a module kernel from its origin. It's very easy to compile a customized minimal Linux kernel image. I still remember my first successful Linux recompilation back in engineering days; such small tasks seemed to be huge achievements back then :)

I had one experience with such stuff when I was working on an embedded systems project in railways. We had to deploy a device at train stations which could network boot few embedded devices for monitoring trains. We chose a device with Linux distribution (uCLinux) and created a minimal kernel image with basic modules like TFTP, DHCP. It took me a couple of hours to get this up and running. To be honest, I don't know if it was possible to do the same thing with Windows kernel or not. But Linux distributions are surely favorite in the Embedded systems and IoT world as they are lightweight and it's very easy to customize them for small devices.

Linux is more secure with more policing around it
Linux is considered more secure than Windows (that's debatable). All commercial OSs have vulnerabilities. However, few fundamental concepts of Linux kernel make it more secure like opensource, privilege levels etc. It was a common myth that opensource is insecure as anyone can see the code. But having many people read the code had an opposite effect. Having more number of eyeballs watching the code base means more policing around the vulnerabilities. Anyone can contribute the security patches, almost instantly (as soon as a bug is identified). So there is very less chance of a security hole getting unnoticed.

Linking it to the Cloud
Azure sphere's layer 3 is built for providing cloud connectivity to the IoT devices. I don't know the details of this but looks like a good option for sharing data across devices (however data protection issues might come up in few cases).

Much needed initiative for IoT Security

For the first time, an OS vendor is taking the initiative to secure small IoT devices. It might not be a perfect solution, but it's a good initiative for sure. Few years down the line, more IoT devices will be in use and security will become a major issue. There has also been a word coined as "zombie devices" where a hacker could control many such small IoT devices; that's a scary thought. There has to be a way to protect these millions of small devices sooner rather than later. So, its a good initiative by Azure team.

I wish it was made open source as MS's new rules are to opt for open source solutions unless there is a good reason not to. But I do understand that Azure team might have their own reasons not to do so. Maybe it is too risky to make a kernel opensource especially as it will be used for IoT security. Well, I am happy that MS is looking into securing millions of IoT devices without limiting itself to Windows kernel. I think it will be welcomed by techies from both Win and Linux worlds!

Priya Saxena. 

No comments:

Post a Comment