logoalt Hacker News

BoingBoomTschakyesterday at 9:28 PM2 repliesview on HN

I think Linus says it well: https://www.realworldtech.com/forum/?threadid=189711&curpost...


Replies

pamcaketoday at 2:10 AM

> Note that even OS kernels can have this issue - imagine what happens in virtualized environments with overcommitted physical CPU's scheduled by a hypervisor as virtual CPU's? Yeah - exactly. Don't do that. Or at least be aware of it, and have some virtualization-aware paravirtualized spinlock so that you can tell the hypervisor that "hey, don't do that to me right now, I'm in a critical region".

I can't be the only one who learned this the hard way by cramming too many vCPUs onto too few physical cores and initially wondering where the high load and latencies came from.

markus_zhangtoday at 12:40 AM

Thanks for sharing. Can someone tell me what does this paragraph mean?

> Use a lock where you tell the system that you're waiting for the lock, and where the unlocking thread will let you know when it's done, so that the scheduler can actually work with you, instead of (randomly) working against you.

I have “implemented” a sleep lock in xv6. Is it what he meant? What does the Linux scheduler “know” about it and will do differently? (Trying to figure out what does “work with you” mean)

Thanks in advance.

show 1 reply