Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Apr 2008 15:50:23 -0700
From:      Julian Elischer <julian@elischer.org>
To:        "Murty, Ravi" <ravi.murty@intel.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Do you really "sleep" when blocked on a mutex?
Message-ID:  <480D1A2F.2000605@elischer.org>
In-Reply-To: <AEBCFC23C0E40949B10BA2C224FC61B0070446F0@orsmsx416.amr.corp.intel.com>
References:  <AEBCFC23C0E40949B10BA2C224FC61B00704441C@orsmsx416.amr.corp.intel.com> <480CF0F2.20609@elischer.org> <AEBCFC23C0E40949B10BA2C224FC61B00704452C@orsmsx416.amr.corp.intel.com> <480CFA15.9050807@elischer.org> <AEBCFC23C0E40949B10BA2C224FC61B0070446F0@orsmsx416.amr.corp.intel.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Murty, Ravi wrote:
> That's actually what I was trying to get to.
> 
> If I look at vm_daemon(), it checks to see if every thread of the
> process is running, on the runq or sleeping. If any threads fails the
> condition - and I can think of the case where a thread is blocked
> waiting for a lock - it is not a target to be swapped out. I guess this
> means that if a thread is holding a lock, it can be swapped out.

no. because if it holds a lock it must be in the run queue, running or 
waiting for another lock. no other state is permitted.


> How
> does this guarantee that the thread is not holding a kernel lock? Why
> don't they allow threads waiting for a lock (blocked threads/processes)
> to be swapped out?
> 
> Related question: how can a process/thread running on a CPU be swapped
> out, do they suspend the threads before they pull out memory from
> underneath them?

not sure, I'd have to read the code again.


> 
> Thanks
> Ravi
> 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?480D1A2F.2000605>