[Click] NotifierQueue on multi-threaded Click problem.

Beyers Cronje bcronje at gmail.com
Fri Sep 7 13:29:31 EDT 2007


Hi Joonwoo,

I think the enq() and deq() has problem.
> As you said, one enq() and one deq() can be run concurrently.
> But operation of the code, '_tail = next' of enq() and '_head =
> next_i(_head)' is not atomic (I mean the equalizer)
> because of _tail and _head is INT.
> Therefore the code 'if (next != _head) {' of push() and 'if (_head !=
> _tail)' of pull() cannot be worked correctly.
> So I think these are should be atomic.


Note I'm fairly new to multithreading so excuse any ignorance on my part.

Correct me if I'm wrong here, but isn't the worst that could happen:

 (1) pull() might see an empty queue in the case where push() adds a packet
to an empty queue at the same time. Not really a problem as pull will get
this packet the next time it's scheduled.
(2) enq()  might incorrectly drop a packet in the event of a full queue and
pull() is run at the same time. This will only drop 1 packet in the event of
a 'full' queue.

Or am I missing something?

Beyers


More information about the click mailing list