Paul Krill
Editor at Large

Microsoft open-sources P language for IoT

news
Oct 14, 20162 mins

The platform specializes in asynchronous programming for embedded systems, device drivers, and distributed services

open source keyboard
Credit: Thinkstock

Microsoft’s P language, for asynchronous event-driven programming and the IoT (internet of things), has been open-sourced.

Geared for embedded systems, device drivers, and distributed services, P is a domain-specific language the compiles to and interoperates with C, which itself has been commonly leveraged in embedded systems and the IoT. “The goal of P is to provide language primitives to succinctly and precisely capture protocols that are inherent to communication among components,” said Ethan Jackson and Shaz Qadeer of Microsoft, in a tutorial on the language.

With P, modeling and programming are melded into a single activity. “Not only can a P program be compiled into executable code, but it can also be validated using systematic testing,” according to the language’s documentation on GitHub. “P has been used to implement and validate the USB device driver stack that ships with Microsoft Windows 8 and Windows Phone.”

Microsoft has described P as offering “safe” event-driven programming. In their tutorial, Jackson and Qadeer say P programs have a computational model that features state machines communicating via messages, an approach commonly used in embedded, networked, and distributed systems.

Each state machine has an input queue, states, transitions, event handlers, and machine-local store for a variables collection. State machines run concurrently, with each executing an event loop that de-queues a message from the input queue. The state machine also examines the local store, sends messages between machines, and can create new machines. “In P, a send operation is non-blocking; the message is simply executed into the input queue of the target machine.” A program features a collection of event and machine declarations.

Microsoft also offers P#, an extension to C# that targets asynchronous programming, as open source. And in June, Microsoft open-sourced Checked C, a modified version of C that adds new syntax and typing to the C language, with the intent of improving safety in C.

Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author