Author Topic: I need to read keyboard response times to within 1mS, which version of Linux?  (Read 2594 times)

0 Members and 1 Guest are viewing this topic.

Offline shaunmac

  • Jr. Member
  • **
  • Posts: 1
  • Karma: 0
  • I've just joined!
    • View Profile
    • Awards
Hi Folks,
I am new to this site and Linux, so please excuse my ignorance!

Could anyone advise me on which version of Linux would be best for writing software to measure reaction times of key presses from a PC keyboard? There are several version of Linux out there and I don't know which one to use for the best.

The program will most likely be written using C++ for Linux and will produce visual cues, to which the subject must respond with a keypress. The response times would ideally be accurate to within 1 milisecond.

I will also need to be able to read/write to the parallel & serial ports with similar speed.

In the past, I've written programs using VB for Windows but reaction time accuracy isn't great due to Windows processes interrupting program flow! I've tried multi-core processors & minimising memory resident programs but whilst this all helps, I know this isn't the answer.

It's time to move on...

Any help would be very much appreciated,
Thanks!

Offline Mark Greaves (PCNetSpec)

  • Administrator
  • Hero Member
  • *****
  • Posts: 18268
  • Karma: 477
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
    • Awards
First I need to explain that I am no expert in low latency but from what I can find on the interweb, most of the 'Music' production distros such as Ubuntu Studio offer the installation of low latency realtime kernels for tighter I/O response times... though you may have to add a PPA repository.

See here:
http://distrowatch.com/?newsid=06039

I'm not offering this as a definitive answer to your question, more as a "something for you to look into".

WARNING: You are logged into reality as 'root'
logging in as 'insane' is the only safe option.
pcnetspec.co.uk

Offline Mad Penguin

  • Administrator
  • Hero Member
  • *****
  • Posts: 1420
  • Karma: 10018
  • Gender: Male
    • View Profile
    • Linux in the UK
    • Awards
For your purposes, pretty much any distro will do as they all use the same kernel, which is the bit that's likely to impact on your response times. I doubt very much whether you will experience problems with regards to timing as Linux and Windows are two very different systems. In Windows for example, one of the major causes of latency is the user interface, which is essentially a part of the operating system. Under Linux, the user interface is an entirely different process and can be turned off if it's causing you performance problems. (or you can use alternative / potentially better performing user interfaces .. or indeed you could write your own!)

If you do find you have issues, there are two kernels you could try, the standard kernel (which itself has a choice of 'schedulers') and the real-time kernel, which is going to be about as close to 'wire speed' as you're going to get from a PC. On ubuntu for example, all that's required to grab the real-time scheduler (on Ubuntu) is;

Quote
apt-get install linux-rt

But again, you shouldn't need this. For some technical background, try;

Quote
http://www.ibm.com/developerworks/linux/library/l-scheduler/


 


SimplePortal 2.3.3 © 2008-2010, SimplePortal