mighty-gerbils / gerbil

Gerbil Scheme
https://cons.io
GNU Lesser General Public License v2.1
1.15k stars 111 forks source link

Revisit SMP Locking of core data structures #1128

Open vyzo opened 7 months ago

vyzo commented 7 months ago

We have some core data structures in the runtime that are protected by spin locks.

The rationale for this is that they are virtually free (compared to mutexes) in UP, and workable in SMP as they tend to be fast but busy wasting power depending on contention. With low contention they are very performant, but with high contention they are power hungry.

This is an acceptable trade off for now, where SMP is still WIP, but when it's time for production we'll need a more coherent locking strategy. I would love to see some form of futex, so that we can avoid the overhead of full blown mutexes and still protect critical structures without using too much power.