Have you ever pondered why your garage light goes off after you shut the garage door? Probably just in passing, right? It's a line of computer programming that has to do with something called asynchronicity. That's a big word for a simple concept. It means one-sided. Something that ends. The relatively new programming language called Elixir is the culprit. But how is Elixir at asynchronous systems? Why is asynchronicity important? Many believe that the future belongs to the Internet of Things (IoT). Consider that by 2050, there won't be simply Internet users, there will be an estimated 100 BILLION devices running the IoT. That includes your garage door and light.
Let's Get Tech: The Elixir Processes
Elixir code runs inside isolated processes that run concurrently to and sends messages to each other. Elixir code is fault-tolerant. That means if your garage door doesn't shut, your light won't go off. It won't get the message. In layman's terms, if one process goes down, the failed process says "oops" and starts another one. It's a regeneration of sorts. But what if you want a process to end asynchronously and not go on? That's where your garage door comes in to play.
Okay, Just A Bit More Tech: Asynchronous Tasks Within Elixir Processes
By definition, an asynchronous task ends when a given task is performed. When that task is performed, a message is sent with the Elixir code with the result of the task that ends that task. For instance, you want your garage light to turn off after your garage door is closed.
Here's basically how that asynchronous task would work:
task = Task.async(fn -> do_some_work() end)
res = do_some_other_work()
res + Task.await(task)
That looks complicated. But it really is very simple in code-speak. The asynchronous task function is closing the garage door. Once that ends, it calls for a signal to do some other work--that is, to turn off the garage light. So once the task is spawned and the functional computation is complete for that task (closing the garage door), the receiver, known as the caller (and only that particular caller) awaits the result to do the other work, or turn off the light. Yes, that's a long sentence just to say that the asynchronous task will be done.
Ah, Finally, Layman's Terms (Kind of): Why Elixir's Asynchronous Systems Matter to the IoT (and My Garage)
According to a recent IBM report, the IoT needs a "reboot" to a more open access, decentralized, distributed cloud. The cloud is where life happens in the computer world now. The IoT will have billions of devices sending processes concurrently across the network to back-end servers. Which means billions of devices will be using asynchronous systems to start and stop processes all over the world at the same time. Elixir's lean syntax, concurrent and fault-tolerant processes can help create that reboot. So when devices worldwide want to turn off their garage lights at the same time, Elixir's simplicity may just be the ticket to keep the world running smoothly. Wow...aren't you glad you pondered?
For more information about garage doors, contact a local business.