On 05/05/16(Thu) 19:03, Pavan Maddamsetti wrote:
> I have been reading about ongoing improvements to SMP in OpenBSD. My
> understanding is that context switching from userspace to the kernel can be
> hazardous if shared resources are not protected by locking. 

The context switching it not the problem, the problem is that if two
CPUs modify kernel states at the same time corruptions are very likely
to happen.  Why?  Simply because the kernel hasn't been written to be
executed on multiple CPUs simultaneously.

>                                                             OpenBSD
> currently has a "giant lock" for safe concurrent access to kernel data
> structures. It will eventually be replaced by finer grained locking in
> order for the kernel to execute on multiple CPUs simultaneously.

Well a "giant lock" prevent concurrent access in order to guarantee data
integrity.

> Has any thought been given to an alternative design where each CPU has its
> own thread scheduler, like DragonFly BSD?

Certainly, people talk a lot!  Now keep in mind that having a different
scheduling class for kernel threads wont prevent kernel threads from
accessing shared data concurrently.

Reply via email to