aboutsummaryrefslogtreecommitdiff
path: root/src/grid
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2024-09-25 23:13:20 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2024-09-25 23:15:10 +0300
commitef2b77be011e2b4b415d1c5bb4901431d81dfaee (patch)
treea724518db2d00b35a73e0a0e62009fd2083ef89e /src/grid
parent6d0e7c5eba49efc171e63ff2631722a5c7f95460 (diff)
downloadgran-ef2b77be011e2b4b415d1c5bb4901431d81dfaee.tar.gz
gran-ef2b77be011e2b4b415d1c5bb4901431d81dfaee.zip
somewhat working grid
+ Starvation is still an issue, but adding a slight bit of randomness seems to help a bit. Also, simulating massive systems like 64x64 is a bit too slow, so scale grid example down to 16x16. 256 cores is still a fair bit, but I might try to think of some optimization methods. I wonder at what point threading becomes faster than just running on a single core? + Test now also sets processor nodes to sleep to avoid starvation issue, seems like an opportunity for a DoS attack if someone can get enough cores to bombard a single node with enough traffic. The riscv64 processor has an initial control interface, very messy code, should probably come up with a more elegant way to deal with sleep/wakeups
Diffstat (limited to 'src/grid')
-rw-r--r--src/grid/node.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/grid/node.c b/src/grid/node.c
index 16cce1b..df237c7 100644
--- a/src/grid/node.c
+++ b/src/grid/node.c
@@ -56,6 +56,9 @@ static stat port_receive(struct port *port, struct packet pkt)
static stat grid_receive(struct grid_node *grid, struct component *from, struct packet pkt)
{
+ if (rand() % 256 == 0)
+ return EBUSY;
+
uint16_t x;
uint16_t y;
uint64_t addr = pkt.to;