6 ms·
I don’t understand how this works with systems like toothpaste? I get if you somehow stored your toothpaste in some queue-like structure where you only see 1 at
by jphoward 2y ago
I don’t understand how this works with systems like toothpaste? I get if you somehow stored your toothpaste in some queue-like structure where you only see 1 at a time, then yes, reaching the last would be helpful. But surely they are in a cupboard or drawer or something?
To know to start the sentinel toothpaste he must search around and prove it’s the only one left - by doing this he doesn’t need the sentinel anyway, as the searching process with yield only one, sentinel or not?
If it doesn’t need a search, e.g. they are in a line/all on easy view - then it’s obvious it’s the last even without a sentinel?
- Retr0id 2y agoI assume OP's solution has thread-safety requirements. The toothpaste may be retrieved from long-term storage by another thread, and that thread may not be configured to check for termination conditions.
- alexchamberlain 2y agoChildren act more like separate processes than threads - it would be a miracle if we could read their minds or put them to sleep for a bit.
- deleted 2y ago[deleted]
- gweinberg 2y agoIt helps if you are forgetful in a certain way. If you can remember to buy new toothpaste when you get the last tube out of the drawer, you don;t need a sentinel. But if you forget that the tube you just brought out is your last 5 minutes after you took it out, the sentinel reminds you. Similarly with the emoji list. If can reliably remember which emoji is last, then each is equally as good as a sentinel. But if you can't, having one which is "special" will help remind you.
- IanCal 2y agoThe benefit imo here is not that you realize you need more toothpaste only while you search for the last one, it's that while you're using it there's a clear signal to get more.