[dorkbotpdx-blabber] mac process priority, is "real time" possible

Paul Stoffregen paul at pjrc.com
Tue Jul 7 09:49:32 EDT 2009


After trying on several laptops last night and much fiddling and an idea 
/ perl script Ward came up with, it looks like my USB code *might* not 
be completely filling up all the packets (the reason is unknown).  That 
would not fully utilize all the USB bandwidth, and also trigger a lot of 
additional work on the host controller driver side, which would make the 
results more dependent on the operating system's scheduling.  (on my 
mac, nice -10 made a small improvement)

Speed wise, on my mac laptop, I'm getting between 920 to 1000 
kbytes/sec.  On my linux desktop machine, the speed is consistently 1090 
kbytes/sec.  Some linux laptops had speeds in the range of 680 to 980 
kbytes/sec.  That 680 was on a slower machine running lots of other 
stuff.  Haven't tried on windows at all yet.

In theory, it should be possible to transfer 1216 kbytes/sec (19 packets 
of 64 bytes in every 1ms frame).  My code should take 6.1 us overhead to 
process each packet, plus 0.25 us per byte.  USB's speed is 0.67 us per 
byte and 8.67 us overhead per packet.  The hardware double buffers 
packets.  So in theory, it should be possible to get 1216 kbytes/sec.

In practice, I'm clearly not doing something quite right.


-Paul



Tim Hatch wrote:
> Paul Stoffregen wrote:
>   
>> Does anyone know a way to run a process from the mac Terminal with
>> real-time (or very high) process scheduling priority?
>>     
>
> My gut instinct is that it's probably usb stack differences and not
> scheduling, but you change priorities on OS X same as on Linux.  Might
> be worth trying on *bsd as well for another datapoint.
>
> $ sudo nice -n -10 sh -c 'cat /dev/cu.usb* > temp.txt'
>
> How low are the transfer speeds you're seeing?
>
> Tim
> _______________________________________________
> dorkbotpdx-blabber mailing list
> dorkbotpdx-blabber at dorkbot.org
> http://music.columbia.edu/mailman/listinfo/dorkbotpdx-blabber
>
>
>   



More information about the dorkbotpdx-blabber mailing list