# Ofdm reception affected by python threading?

**URL:** <https://www.ruby-forum.com/t/ofdm-reception-affected-by-python-threading/189010>\
**Category:** GNU Radio\
**Created:** [May 21, 2010, 11:18pm UTC](https://www.ruby-forum.com/t/ofdm-reception-affected-by-python-threading/189010 "2010-05-21T23:18:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Veljko\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/a3d4f5/32.png) [@Veljko\_P](https://www.ruby-forum.com/u/Veljko_P)\
**Post date:** [May 21, 2010, 11:18pm UTC](https://www.ruby-forum.com/t/ofdm-reception-affected-by-python-threading/189010/1 "2010-05-21T23:18:19Z")

</div>

Hi,

I’m using two USRP2 with XCVR2450s, a week old gnuradio git master and  
Ubuntu 9.10.

A few months ago while using the OFDM code I observed that I tend to  
receive (or send?) packets in groups, although I was sending them  
individually.

Now, I finally isolated the problem. I added a few simple print lines:

“Message inserted in HAVE\_HEADER” - whenever a message is enqueued in  
STATE\_HAVE\_SYNC of ofdm\_frame\_sink.cc

and

“Message picked up from the queue” - in queue\_watcher\_thread in  
ofdm.py, every time the message is fetched from the queue.

The output that I expected was:

Message inserted in HAVE\_HEADER  
Message picked up from the queue  
Message inserted in HAVE\_HEADER  
Message picked up from the queue  
…

However, I’m getting rather inconsistent output (this is a sample,  
check the attachment for the first few seconds of the output):

Message inserted in HAVE\_HEADER  
Message inserted in HAVE\_HEADER  
Message inserted in HAVE\_HEADER  
Message inserted in HAVE\_HEADER  
Message picked up from the queue  
Message picked up from the queue  
Message picked up from the queue  
Message picked up from the queue  
Message inserted in HAVE\_HEADER  
Message inserted in HAVE\_HEADER  
Message inserted in HAVE\_HEADER  
Message inserted in HAVE\_HEADER  
Message inserted in HAVE\_HEADER  
Message picked up from the queue  
Message picked up from the queue  
Message picked up from the queue  
Message picked up from the queue  
Message picked up from the queue

So, it is definitely the receiver that has problems. It looks as if  
“msg = self.rcvd\_pktq.delete\_head()” in queue\_watcher\_thread in  
ofdm.py is not checked frequently enough. Could it be that Python does  
not switch threads fast enough? Note, I do have real time scheduling  
enabled.  
Any ideas on how to get around this?

Thanks,

Veljko

---

<div class="post-metadata">

**Author:** ![Veljko\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/a3d4f5/32.png) [@Veljko\_P](https://www.ruby-forum.com/u/Veljko_P)\
**Post date:** [May 25, 2010, 8:29am UTC](https://www.ruby-forum.com/t/ofdm-reception-affected-by-python-threading/189010/2 "2010-05-25T08:29:21Z")

</div>

On Fri, May 21, 2010 at 02:15:15PM -0700, Veljko P. wrote:

> Message inserted in HAVE\_HEADER  
> Message inserted in HAVE\_HEADER  
> Message picked up from the queue  
> Any ideas on how to get around this?  
> Is your machine out of CPU cycles?  
> If it’s not fast enough, it won’t keep up.

Eric

---

<div class="post-metadata">

**Author:** ![Veljko\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/a3d4f5/32.png) [@Veljko\_P](https://www.ruby-forum.com/u/Veljko_P)\
**Post date:** [May 29, 2010, 1:13am UTC](https://www.ruby-forum.com/t/ofdm-reception-affected-by-python-threading/189010/3 "2010-05-29T01:13:31Z")

</div>

Hi Eric,

Thanks for the tip. I tried it out on a faster machine, and I observed  
no such problems. The first machine that produces this problem has a  
single core 2.8GHz CPU and the second one, which works fine, has a  
dual core Intel Atom D510, both machines have 2GB of RAM each. I  
should note that the faster machine also has a better GIgEthernet  
card. Interestingly, I do not observe any other signs of CPU  
throttling, such as dropped packets when I see the problem.

Cheers,

Veljko

2010/5/24 Eric B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![Veljko\_P](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/a3d4f5/32.png) [@Veljko\_P](https://www.ruby-forum.com/u/Veljko_P)\
**Post date:** [May 29, 2010, 2:17am UTC](https://www.ruby-forum.com/t/ofdm-reception-affected-by-python-threading/189010/4 "2010-05-29T02:17:55Z")

</div>

On Fri, May 28, 2010 at 04:10:12PM -0700, Veljko P. wrote:

> Cheers,  
> Veljko

The message sink is usually configured to drop packets if the queue  
length  
exceeds a threshold. This sheds load.

Eric
