Messages in this thread | | | Date | Sat, 4 Sep 1999 23:18:47 +0100 (BST) | From | Mark Cooke <> | Subject | Re: SMP linux help |
| |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Sat, 4 Sep 1999, Nate Eldredge wrote:
> * Does "lock the kernel" mean "prevent anyone else from executing any > kernel code"?
No.
When you have the kernel lock you can guarantee that accesses to anything else protected by the kernel lock can't happen.
So, generally you:
1. Acquire the kernel lock You can now guarantee that no other access to code/data protected by the kernel lock can happen.
2. Mess with shared lists / page tables / etc
3. Let go of the lock
The big kernel lock used to protect lots of stuff. Ie, acquiring the lock used to stop a whole lot of stuff running.
These days, the big lock is being replaced with more localised locks, to improve the granularity of access. Hence, you can have 1 CPU doing one kernel task, and another CPU doing something unrelated, provided they are protected by different locks.
> * If so, what happens if some other CPU is already inside the kernel? > Is there some mechanism to stop the other CPU??
The call to acquire the kernel lock blocks until the other CPU drops the kernel lock. Therefore you need to be careful that you don't produce interactions that can cause deadlocks.
Eg,
CPU 1 CPU 2
acquire lock 1 acquire lock2 get to a point where we need lock 2, so wait for lock 2 to be released. get to a point needing lock 1, so wait for lock 1 to be released.
Result: Waiting for lock 1 Waiting for lock 2 which is which is held on CPU 2 held on CPU 1
Mark
+-------------------------------------------------------------------------+ Mark Cooke The views expressed above are mine and are not Systems Programmer necessarily representative of university policy University Of Birmingham URL: http://www.sr.bham.ac.uk/~mpc/ +-------------------------------------------------------------------------+
-----BEGIN PGP SIGNATURE----- Version: PGPfreeware 5.0i for non-commercial use Charset: noconv
iQA/AwUBN9Ga0Hlbx4ZElNuLEQIo+gCdFJ+uxZTq7Dz1UelwPJ+fD6BK27sAnRPf EuIHNNTsYqRtRDcRiRNWTcQd =hnn2 -----END PGP SIGNATURE-----
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |