Internal details

Deno and Linux analogy

LinuxDeno
ProcessesWeb Workers
SyscallsOps
File descriptors (fd)Resource ids (rid)
SchedulerTokio
Userland: libc++ / glib / boosthttps://deno.land/std/
/proc/$$/statDeno.metrics()
man pagesdeno types

Resources

Resources (AKA rid) are Deno's version of file descriptors. They are integer values used to refer to open files, sockets, and other concepts. For testing it would be good to be able to query the system for how many open resources there are.

console.log(Deno.resources());
// { 0: "stdin", 1: "stdout", 2: "stderr" }
Deno.close(0);
console.log(Deno.resources());
// { 1: "stdout", 2: "stderr" }

Metrics

Metrics is Deno's internal counter for various statistics.

> console.table(Deno.metrics())
┌──────────────────┬────────┐
│     (index)      │ Values │
├──────────────────┼────────┤
│  opsDispatched   │   9    │
│   opsCompleted   │   9    │
│ bytesSentControl │  504   │
│  bytesSentData   │   0    │
│  bytesReceived   │  856   │
└──────────────────┴────────┘

Schematic diagram

architectural schematic