serializing token

Joerg Sonnenberger joerg at britannica.bec.de
Sat Apr 24 02:47:55 PDT 2004


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
> 





More information about the Kernel mailing list