4 ms·
Probably depends on your work load. If you assume there’s almost no crosstalk, you can likely get away with a thread-id and an optimistic mutex per pool: the m
by masklinn 3y ago
Probably depends on your work load.
If you assume there’s almost no crosstalk, you can likely get away with a thread-id and an optimistic mutex per pool: the mutex will only contend if one thread tries to (de)alloc while an other thread has a cross-thread free running.
If you assume there will be more contention than that, then scaling up complexity might be a good idea e.g. lock per size class / arena, or push cross-thread frees to a queue and have the owning thread check the queue once in a while. You can then make that queue lock-free or even wait-free if that is better for your workload / issues.