Question

I'm currently revising for an exam and came across this question:

Under what circumstances is a spinlock a suitable implementation for a lock? When would it be a bad choice of implementation? Describe a better solution and write a pseudo-code definition for it.

I can answer the question about the un/suitability of spinlocks, but I am absolutely stumped what constitutes a "better solution" and how to implement that in pseudo-code. I'd appreciate if someone could point me in the right direction.

Was it helpful?

Solution

I would do some investigation into topics like "Critical Section", "Mutex", "Semaphore", "I/O Completion Ports" and think about mechanisms for posting waiting threads.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top