Skip to content

Commit 699f5d4

Browse files
committed
up
1 parent 5cff297 commit 699f5d4

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
title: Parallel iNet
3+
date: 2023-11-30
4+
---
5+
6+
# Problem
7+
8+
To implement parallel interaction nets,
9+
we need to let many threads share the same memory.
10+
11+
To allocate memory of cells of the same size,
12+
we can use an array, and a stack of unused indexes
13+
(let's call this free-stack).
14+
15+
But the stack will still be the part where multi-thread is not safe
16+
right? If any part of the implementation is not lock-free, the fine
17+
grain parallel advantage of inet might be lost.
18+
19+
# Solution A
20+
21+
Maybe i can just use 8 "free-stacks" for 8 threads.
22+
23+
When a used index is to be freed, i can see which thread is having the
24+
least free indexes, and give the new freed index to it.
25+
26+
And a "free-stack" can be viewed as a ring, i give back to the front
27+
instead of the end, thus lock-free.
28+
29+
The query about "the least free indexes" is just heuristic, thus also
30+
lock-free.
31+
32+
# Datatypes
33+
34+
I need to allocate the following kinds of datatypes:
35+
36+
```
37+
Node {
38+
definition: NodeDefinition
39+
ports: List<Port>
40+
}
41+
42+
Port {
43+
node: Node
44+
halfEdge?: HalfEdge
45+
}
46+
47+
HalfEdge {
48+
otherHalfEdge: HalfEdge
49+
port?: Port
50+
}
51+
```

0 commit comments

Comments
 (0)