Page 1 of 1

EE/IOP priority

Posted: Sat Jun 11, 2005 8:01 pm
by urchin
I've written a simple program (launched using ps2client and ps2link) that opens a socket and sends data to my laptop using ps2ip(s) over ethernet (yes, I've already been warned about the possibility of bugs in ps2ip :)

It is a simple send/recv loop, but takes about 40 seconds to transfer 300K of data. If I add 'printf(".")' into the loop, the same transfer takes about 1 second!...

The helpful guys on IRC pointed out that this could be because the EE is hogging the bus and not allowing the IOP to do its job. How do I yield within the loop to give the IOP a chance?... I tried "SleepThread" in the loop, but the transfer still took around 40 seconds.

Could the problem be that I am using blocking IO? (I'm not using select yet)

Posted: Sun Jun 12, 2005 12:37 am
by urchin
I added select to my code before each call to send and recv, but it seems the EE is still hogging. Any ideas how to make it yield? The loop is running in the main thread, I'm a bit new to all this to know if this is right or not...

Posted: Sun Jun 12, 2005 12:44 am
by mrbrown
I don't see how the EE could starve network comms, which are IOP-specific. Especially since the EE kernel is cooperative, so if your main thread is active then no other threads should take over unless they have a lower priority.

I would guess it's some interference from ps2link on the IOP side. That seems even more likely since you said printf() sped it up, and printf() goes through ps2link.

Posted: Sun Jun 12, 2005 3:54 am
by urchin
Cheers for the info. I did try the same loop in an IRX too, and got the same slow results (I tried this yesterday before I discovered the printf side effect) so that seems to make sense.

I've been having a nosey through the ps2link source, but I'm not clued up enough yet to work out where the problem is (if indeed it is in there)

Posted: Sun Jun 12, 2005 4:12 am
by urchin
Another curiosity is that the printf side effect only works when there is a send and a recv in the loop.

If I remove the recv so the PS2 is only sending, the speed is slow. If I remove the printf and the PS2 sends and recvs, the speed is again slow :)

Posted: Fri Jun 17, 2005 8:10 am
by J.F.
You might consider posting the code. It's probably something really simple that you're too close to see. You're reading what you MEANT to write instead of what you actually wrote. :D