aboutsummaryrefslogtreecommitdiffstats
path: root/research/experiments/030-app-lifecycle/items-body.aup
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-10-19 09:58:47 +0100
committereunhhu <[email protected]>2026-10-19 09:58:47 +0100
commitb8e6a2e5b8fc64ec47adfbe583b8a27200cc5a2e (patch)
treed3a2a5041e42e4ca2fa4a7ec8e5cd10147c9030b /research/experiments/030-app-lifecycle/items-body.aup
parent31ef28609c6135058ffa0645fed9edd75c1086c7 (diff)
downloadpure-b8e6a2e5b8fc64ec47adfbe583b8a27200cc5a2e.tar.gz
pure-b8e6a2e5b8fc64ec47adfbe583b8a27200cc5a2e.zip
The modules an app ran are freed (research 115's next step): every app's module a Loaded with holds (each snapshot of it, each request read with it); one replaced is retired and freed on the apps thread once no app runs it, every connection thread has begun a pass since (woken for it), and nothing holds it; who keeps a module to ask later whether it is the same asks its serial (core: PureModule.serial, a reader's module_serial, pure_snapshot_module, pure_snapshot_release says it freed; serve: routes, groups, links, bindings, queries, the published snapshot), as an address may come back; a link binds under its receiver's lock, a link naming an input under binding_lock; 030's memory.py: 4,000 changes 0 bytes a change (was 19,284), 4,100 freed; stress.py: readers, view workers, push streams and a body across changes, 586 of 600 loads at a freed module's address, every answer right, ASan 1,000 changes clean; a push group that looked while its app resumed missed the new snapshot (published before the app took requests) and waited for its next save: woken again once it takes them (server_view_workers had failed once under load)
Diffstat (limited to 'research/experiments/030-app-lifecycle/items-body.aup')
-rw-r--r--research/experiments/030-app-lifecycle/items-body.aup43
1 files changed, 43 insertions, 0 deletions
diff --git a/research/experiments/030-app-lifecycle/items-body.aup b/research/experiments/030-app-lifecycle/items-body.aup
new file mode 100644
index 0000000..dcb5477
--- /dev/null
+++ b/research/experiments/030-app-lifecycle/items-body.aup
@@ -0,0 +1,43 @@
+record Pick {
+ n = 0
+}
+record Item {
+ n = 0
+}
+state items: list of Item
+state more: list of Item
+state hits = 0
+input seed = message { n: number }
+input grow = message { step: number }
+input add = message { step: number }
+on seed {
+ items.append(Item { n: seed.n })
+}
+on grow {
+ for i in items {
+ more.append(Item { n: i.n + grow.step })
+ }
+ for m in more {
+ items.append(Item { n: m.n })
+ }
+ for m in more {
+ more.remove(m)
+ }
+}
+on add {
+ hits = hits + add.step
+}
+view count = count(i in items where i.n > 0)
+view total = hits
+view summed {
+ let t = 0
+ for i in items { t = t + i.n }
+ return t
+}
+view picked {
+ let ps: list of Pick
+ for i in items {
+ if i.n > 9 { ps.append(Pick { n: i.n }) }
+ }
+ return ps.count
+}