Saltar al contenido ForoHackers

Runtimes: start here

Entornos de ejecución
#3387 · · Citar · Denunciar

A runtime is the support code that runs alongside your program: it starts it, manages its memory, schedules its threads and connects it to the system. Some languages ship a small one, such as C's library; others a large virtual machine with a garbage collector and a just-in-time compiler. Knowing what the runtime does explains most surprising behaviour.

Key concepts

  • Execution models: native code, bytecode on a virtual machine, or an interpreter reading source.
  • Garbage collection: the runtime finds unreachable objects and reclaims them, trading pauses and memory for safety.
  • Just-in-time compilation: hot code is compiled while the program runs, using what it has observed.
  • Concurrency support: threads, event loops, green threads or lightweight tasks, with their own scheduler.
  • Foreign interfaces: how managed code calls native libraries, and the cost and risk at that border.

Vocabulary

  • Virtual machine: a program that executes a portable instruction format.
  • Bytecode: the compact instruction set a virtual machine runs.
  • Warm-up: the time a runtime needs before just-in-time compilation reaches full speed.
  • Stop-the-world pause: a moment when a collector halts the program.

What to study, in order

  1. Write the same small program in a compiled and in an interpreted language, and compare startup and memory.
  2. Read the bytecode your language produces and run it by hand for a few lines.
  3. Implement a tiny stack-based virtual machine with a loop and a few instructions.
  4. Add a simple mark-and-sweep collector to it.
  5. Measure a program's garbage collection behaviour with the runtime's own tools and change one setting.

Related tags

#interpreters #compilers #memory-management #java #webassembly

No has iniciado sesión, así que esto se publica como anónimo: no se guarda con ello ninguna cuenta, nombre ni dirección, y no puede llevar enlaces ni imágenes. Inicia sesión o únete para publicar con tu nombre. Los registros de nuestro servidor web guardan la dirección y la hora de cada petición hasta 14 días; para que la tuya no quede en ellos, usa Tor. Para escribir al equipo de forma confidencial, usa el buzón. Firmar como fuente habitual (una clave guardada solo en este navegador)

Enviar tarda unos segundos aquí: tu navegador resuelve antes una prueba de trabajo contra el spam.

Responder