Skip to content

Commit 9dbeddf

Browse files
committed
Correction to atomvm-internals.md
This fixed the formatting of /doc/src/atomvm-internals.md for better html rendering, and more importantly excludes some graphs from the PDF version of the documentation that prevent the PDF from successfully being assembled. Signed-off-by: Winford <winford@object.stream>
1 parent c3aab43 commit 9dbeddf

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

doc/src/atomvm-internals.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ When an element is inserted into the table or retrieved from the table (e.g., vi
277277

278278
For more information about the `Heap` data structure, see the [Memory Management](memory-management.md) chapter of the AtomVM documentation.
279279

280+
```{only} html
280281
The relationship between an `EtsTable` and `EtsHashTable` and its elements is illustrated in the following "class" diagram (some elements are removed for the sake of brevity):
281282
282283
+--------------------+
@@ -312,9 +313,11 @@ The relationship between an `EtsTable` and `EtsHashTable` and its elements is il
312313
+----------+ +----------+
313314
| ... | | ... |
314315
+----------+ +----------+
316+
```
315317

316318
The `Ets` structure contains a `SyncList` of `EtsTable` structures, protected from concurrent access via a read-write lock. A single instance of an `Ets` structure is stored in the `GlobalContext` structure.
317319

320+
```{only} html
318321
+---------------+
319322
| GlobalContext |
320323
+---------------+
@@ -327,8 +330,11 @@ The `Ets` structure contains a `SyncList` of `EtsTable` structures, protected fr
327330
+----------+ | +----------+
328331
| next --------+ | next ------> ...
329332
+----------+ +----------+
333+
```
330334

331-
> Note. A deficiency in this implementation is that lookup of an ETs table in this list is `O(<number of ETS tables>)`, whereas a "promise" of ETS is that insertion, lookup, and deletion of entries in at least the `set` table type is or should be constant (modulo poor hashing functions). A future implementation of this data structure could use a map or table structure to make lookup of ETS tables more efficient (i.e., constant), but at the expense of i) increased memory consumption and heap fragmentation, and ii) code complexity. Given the likely relative paucity of ETS tables instances likely to be instantiated by applications, we feel that using a list of ETS tables is an acceptable tradeoff for embedded systems deployments, but we are open to being wrong about our assumptions.
335+
```{note}
336+
A deficiency in this implementation is that lookup of an ETs table in this list is `O(<number of ETS tables>)`, whereas a "promise" of ETS is that insertion, lookup, and deletion of entries in at least the `set` table type is or should be constant (modulo poor hashing functions). A future implementation of this data structure could use a map or table structure to make lookup of ETS tables more efficient (i.e., constant), but at the expense of i) increased memory consumption and heap fragmentation, and ii) code complexity. Given the likely relative paucity of ETS tables instances likely to be instantiated by applications, we feel that using a list of ETS tables is an acceptable tradeoff for embedded systems deployments, but we are open to being wrong about our assumptions.
337+
```
332338

333339
### Ownership and Lookup
334340

@@ -337,7 +343,7 @@ An ETS table is conceptually "owned" by the Erlang process that creates it (via
337343
* The owning process has exclusive access for reading and writing entries in the table (unless the table is declared `public`, in which case other processes may change entries in the table, e.g., via `ets:insert/2` or `ets:delete/2`);
338344
* The lifecycle of the ETS table is associated with the lifecycle of the owning process, meaning that the ETS table is destroyed when the owning process terminates. Note that any references to the ETS table are invalid once the table has been destroyed.
339345

340-
> Note that AtomVM does not currently support transfer of ownership of an ETS table from one process to another.
346+
```{important} AtomVM does not currently support transfer of ownership of an ETS table from one process to another.```
341347

342348
When a table is used in an `ets` operation (e.g., `ets:insert/2`, `ets:lookup/2`, `ets:delete/2`, etc), the `ets_tables` sync list is searched for the first entry in the table that matches the requested table id (as a name or reference).
343349

0 commit comments

Comments
 (0)