Security of process’s data inside Critical Section(in locking)
I read Linux Kernel Development Second Edition By Robert Love. And in section Big Kernel Lock I found this:
lock_kernel();
/*
* Critical section, synchronized against all other BKL users...
* Note, you can safely sleep here and the lock will be transparently
* released. When you reschedule, the lock will be transparently
* reacquired. This implies you will not deadlock, but you still do
* not want to sleep if you need the lock to protect data here!
*/
unlock_kernel();
It is about kernel 2.6.10 and before it.
why process datas is not secure here? So what is the usage of locking the kernel? I thougt that when a process want to leave CPU temporary, it’s values save in a stack, before switch context.
This situation is like the situation that scheduler take BKL from a process after a timestamp (with release_kernel_lock(prev)) and take time to another process. If it is so, this situation is not safe for a process too. Is it true? What is the difference between this condition and others that a process leaves CPU?
Best regards
|