summaryrefslogtreecommitdiff
path: root/docs/contributing/architecture.md
diff options
context:
space:
mode:
authorLuca Casonato <lucacasonato@yahoo.com>2020-05-07 00:21:13 +0200
committerGitHub <noreply@github.com>2020-05-06 18:21:13 -0400
commit34ec3b225425cecdccf754fbc87f4a8f3728890d (patch)
tree35db52bf25ccf64425692116197df61a69ea8838 /docs/contributing/architecture.md
parent846c049c9b3ab36d0893292a204c4d0a18de4c8e (diff)
Multi page manual (#5110)
Diffstat (limited to 'docs/contributing/architecture.md')
-rw-r--r--docs/contributing/architecture.md50
1 files changed, 50 insertions, 0 deletions
diff --git a/docs/contributing/architecture.md b/docs/contributing/architecture.md
new file mode 100644
index 000000000..0a1ba3b4d
--- /dev/null
+++ b/docs/contributing/architecture.md
@@ -0,0 +1,50 @@
+## Internal details
+
+### Deno and Linux analogy
+
+| **Linux** | **Deno** |
+| ------------------------------: | :------------------------------- |
+| Processes | Web Workers |
+| Syscalls | Ops |
+| File descriptors (fd) | [Resource ids (rid)](#resources) |
+| Scheduler | Tokio |
+| Userland: libc++ / glib / boost | https://deno.land/std/ |
+| /proc/\$\$/stat | [Deno.metrics()](#metrics) |
+| man pages | deno 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.
+
+```ts
+const { resources, close } = Deno;
+console.log(resources());
+// { 0: "stdin", 1: "stdout", 2: "stderr" }
+close(0);
+console.log(resources());
+// { 1: "stdout", 2: "stderr" }
+```
+
+#### Metrics
+
+Metrics is Deno's internal counter for various statistics.
+
+```shell
+> console.table(Deno.metrics())
+┌──────────────────┬────────┐
+│ (index) │ Values │
+├──────────────────┼────────┤
+│ opsDispatched │ 9 │
+│ opsCompleted │ 9 │
+│ bytesSentControl │ 504 │
+│ bytesSentData │ 0 │
+│ bytesReceived │ 856 │
+└──────────────────┴────────┘
+```
+
+### Schematic diagram
+
+![architectural schematic](https://deno.land/images/schematic_v0.2.png)