cross-thread locking
Julian Elischer
julian at elischer.org
Fri Feb 20 11:48:27 PST 2004
On Fri, 20 Feb 2004, Dag-Erling [iso-8859-1] Sm=F8rgrav wrote:
> - What happens when a thread locks a mutex and then starts another
> thread? Does the new thread in any way inherit the lock, or will it
> have to acquire its own?
do you mean userland mutexes or kernel mutexes?
I'll only cover kernel mutexes..
In KSE the new thread in teh kernel does not start out in the same
context as the parent thread.. in this way it is not like fork().
the new thread starts out about to return to user land pretty much as if
it has just completed a special system call.
this return-without-having-done-the-call-in-the-first-place
is called an upcall. The upcall is into the userland thread scheduler
and a new userland thread is jumped into in userland.. the original
thread is still blocked or running in the kernel and still owns the
mutex.
>=20
> - What about spin locks? Are there any semantic differences between
> mutexes and spin locks in POSIX, or are spin locks simply mutexes
> that spin instead of sleeping?
>=20
> DES
> --=20
> Dag-Erling Sm=F8rgrav - des at des.no
> _______________________________________________
> freebsd-threads at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-threads
> To unsubscribe, send any mail to "freebsd-threads-unsubscribe at freebsd.org=
"
>=20
More information about the freebsd-threads
mailing list