Yan Cui
I help clients go faster for less using serverless technologies.
This article is brought to you by
MongoDB 8.0 is here to change the game. Faster reads and inserts, and brand-new vector search to support modern AI-powered apps.
Ever wondered when you should use Monitor.Pulse and when you should use Monitor.PulseAll given that only one thread will be able to acquire the lock even if you wake up multiple threads? I did, and that’s when I stumbled across a similar question on StackOverflow and as ever, Jon Skeet came up with a really good analogy for when either should be used:
Imagine you’ve got a single printer. Only one person can use it at a time, so if you’re got a lot of people waiting, you send them all to sleep – but you only wake one person up when the printer becomes free. This mirrors the use of
Pulse
.Now imagine you run a shop. While you’re closed, customers wait outside the shop. When you open the shop, you don’t just want to wake up one customer – they can all come in now. This mirrors the use of
PulseAll
.
References:
StackOverflow question on the difference between Pulse and PulseAll
Whenever you’re ready, here are 3 ways I can help you:
- Production-Ready Serverless: Join 20+ AWS Heroes & Community Builders and 1000+ other students in levelling up your serverless game. This is your one-stop shop for quickly levelling up your serverless skills.
- I help clients launch product ideas, improve their development processes and upskill their teams. If you’d like to work together, then let’s get in touch.
- Join my community on Discord, ask questions, and join the discussion on all things AWS and Serverless.