Framework for creating spawnable worker processes with defined semantics