From ef2b77be011e2b4b415d1c5bb4901431d81dfaee Mon Sep 17 00:00:00 2001 From: Kimplul Date: Wed, 25 Sep 2024 23:13:20 +0300 Subject: 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 --- src/grid/node.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/grid/node.c') 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; -- cgit v1.3