DragonFly BSD
DragonFly kernel List (threaded) for 2004-04
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: serializing token


From: Joerg Sonnenberger <joerg@xxxxxxxxxxxxxxxxx>
Date: Sat, 24 Apr 2004 11:43:37 +0200

On Fri, Apr 23, 2004 at 11:40:16PM -0700, joe pistritto wrote:
> I didn't quite get this. Let's say a thread A is
> holding token T, protecting list L. A is then
> preempted by an interrupt and the interrupt thread
> also tries to acquire token T. Are you saying that
> interrupt thread will block when it tries to acquire T
> (because A still owns the token even though thread A
> belongs to the same LWKT scheduler/CPU as the
> interrupt thread)? If this isn't correct, then how do
> you guarantee that L is safe in A?

Don't forget that tokens are inter-CPU synchronisation primitives.
You can always acquire a token in the interrupt thread if it was
hold by the preempted thread. This is in fact the supposed and optimized
case.

For guarantying atomicy in this case, use either splXXX or crit_enter,
depending on the concrete code path.

Joerg

> 
> Thanks so much for your answers!
> 
> -J
> 
> 
> 
> 	
> 		
> __________________________________
> Do you Yahoo!?
> Yahoo! Photos: High-quality 4x6 digital prints for 25?
> http://photos.yahoo.com/ph/print_splash
> 



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]