Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Feb 2004 11:48:24 -0800 (PST)
From:      Julian Elischer <julian@elischer.org>
To:        Dag-Erling =?iso-8859-1?q?Sm=F8rgrav?= <des@des.no>
Cc:        threads@freebsd.org
Subject:   Re: cross-thread locking
Message-ID:  <Pine.BSF.4.21.0402201143250.23674-100000@InterJet.elischer.org>
In-Reply-To: <xzp8yix7vae.fsf@dwp.des.no>

next in thread | previous in thread | raw e-mail | index | archive | help


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@des.no
> _______________________________________________
> freebsd-threads@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-threads
> To unsubscribe, send any mail to "freebsd-threads-unsubscribe@freebsd.org=
"
>=20



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0402201143250.23674-100000>