If you’re a developer, you already know that node.js is a runtime environment and how it was developed by binding C++ and V8 engine. But how do we visualize it?
Being from non-tech background I kept thinking what is actually a runtime environment?, I had this vague idea seeing the name, but I searched about it, because I wanted to have the clear picture.
• Basically To execute a code you need collections of software and hardware components. Why? Because software tells you how to execute that code and hardware actually does that execution.
• The Runtime Environment is just abstraction layer between code, Os and Hardware components which provides essential services and allows programs to run consistently across different platforms i.e runtime gives us pre-written code that acts as a functionality so we don’t have to deal with OS or hardware directly!
• Without those services we would actually have to manage memory system, handle the CPU instructions, andd deal with the networking protocols ourselves, doesn’t seem practical right?!!
Now, we should know what are the key components involved in this. Just a little summary of what I wrote above:
• An execution engine (Interpreter):
Computer does not understand JS, only 0s & 1s. So, you need something that reads our code, convert it into 0s & 1s, and finally run it. That’s what we have execution engine for, and there are actually 2 ways to do it. But do that search on you own.
• Runtime Libraries:
Collections of pre-written code (APIs), which provides basic, common functionality to the program.
• Memory management system:
RTE manages how memory gets allocated ( Stack / Heap ) and deallocated during execution and most of the time it also includes garbage collection to prevent memory leaks.
• Core system interface:
This is a interface for the OS and the Hardware, that handles scheduling and exception tasks.
Well, We all have been using a runtime environment way before we started with the JavaScript, Web Browser.
It’s a Runtime environment for the frontend Javascript application.
Top comments (1)
if you're reading this, and if there's something i should know, let me know!