What is Native Code? How does it relate to a virtual environment?
Computing Theory, MRI, Interpreter, Native Code, Runtime Environment

Native Code is code that translates (compiles) directly to machine code and damit interacts directly with the computer's CPU and particular processor.

Ruby, or at least the most widely used version of Ruby, runs in a virtual environment. RVM manages different virtual environments based on different versions and runtime libraries of Ruby. Ruby has an interpreter. Ruby's main interpreter is called Matz's Ruby Interpreter (MRI) - written in C. The Ruby interpreter converts your Ruby code into byte code - which is one step before machine code

Another distinction that might be helpful to think about is non-managed versus managed code. Non-managed code is code written in C, C++, compiling directly to machine code. In this code, you must manually manage memory.

Managed code, or managed runtime environments, is code written in Ruby, Python, Java and other languages. Managed code includes elements like garbage collection, which manages memory allocation for you, and dynamic typing.

| Back

Footerfull