Skip to contentSkip to conversation

SMP alternatives

PATCH [email protected] 1 participant 1 message Nov 24, 2005

lore
Share & tools
lore
#0 lore raw
Quoted 3 lines

For user space the primary trigger event would be "has any shared writable mappings or multiple threads". Even on a real MP systems it's perfectly ok to run a program with no writable shared mappings with LOCK off.

^ single-threaded

Quoted 3 lines

Depending on the workload this transistion could happen quite often. Especially there is a worst case of an application allocating a few GB of memory and then starting a new thread.

One more thing, that may be to cute to be practical, but is worth mentioning:
shared address space or shared mappings only require LOCK if the memory is ACTIVELY shared, i.e. used by DMA or by another task that is running right now.

If you have a process with a helper thread that's asleep 99% of the time, the savings of running with LOCK off might be worth the occasional IPI to enable it on the main thread on the rare occasions that the helper wakes up on a different processor.

For example, imagine a threaded async DNS resolver that tracks TTL and times out cache entries.

If you have heavier-weight mutual exclusion, you don't need LOCK.