Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I intend to write a program that will measure reaction time. I'm not sure yet about the programming language I'll use. The program will be used as part of a psychology experiment. Ideally, I'd like it to run under Windows.

But before I actually go to the effort of writing the program, I'd like to have some confidence that the resulting reaction-time data will be accurate to within a few milliseconds. An acquaintance has told me that it's not really possible under Windows to accurately time events, independent of background processes (antivirus scans, etc.). First of all, is that true? Second, if it's true, how do I get around this problem? Do I use Linux, or...?

share|improve this question
I've seen programs like this before. A psychologist I knew bought one off the shelf. But with a few weeks of programming experience, you should be able to write it yourself if you put in the time. – surfasb Sep 21 '11 at 2:31
The program I have in mind will have some special characteristics that are unique to the problem that is being investigated. It's unlikely that an off-the-shelf program will suit my needs. – Alex Chernavsky Sep 21 '11 at 13:35
up vote 2 down vote accepted

To guarantee accurate data, you need a realtime OS. Linux by default is no better than Windows, but Linux can be configured with a real-time capable kernel (IIRC).

For details on how to write such a program, I suggest you ask on

Now, in practice, you will get reasonably accurate results under Windows as well. Process scheduling will only affect the results very little. Most antivirus software runs in userspace, which means they are on equal terms with your application. Your best bet is to try and see.

share|improve this answer
Thanks for the tips. You wrote, "Your best bet is to try and see". The problem is that I have no independent way of verifying the accuracy of the results, save by comparing them to some theoretical values from the literature. I think what will do is install a real-time version of Linux on a spare machine that I have handy, and then try to write the program in some language that is available in Linux. Perhaps I'll also write the same program in Windows (my preferred environment) and see if the results are comparable. – Alex Chernavsky Sep 21 '11 at 13:39
At some point you just need to make a decision otherwise you will get to a point where you will be asking where in the keystroke registers as a press I would just say use any os and take averages of a few runs – Hugoagogo Jun 24 '12 at 22:32

Dedicated data acquisition hardware can make measurements accurate to whatever your budget allows, independent of the operating system and language. I'm most familiar with National Instruments hardware and software, but there are other vendors.

share|improve this answer

I think its not very problematic I used GFA-basic see:

my (most simple) program runs as follows:

Dim x, y, z As Integer
Dim ttt, tijd As Double

Print AT(5, 5); "wait"
Print "                    (press 'p' when screen goes black)"
Pause 50
Print AT(5, 5) ; "READY ??  "

Pause 40 + Rnd * 20

ttt = Timer
For y = 1 To 550
  Line 0, y, 1000, y
While InKey$ <> "p"
tijd = Timer - ttt

If tijd < .1
  Print "FALSE START",
  Print "Press 'p' just AFTER you have seen the screen blackened  !!"
  Print "press 'q'to try once again"
  Print AT(5, 5); tijd
  Print "press 'q'to try once again"

While InKey$ <> "q"
GoTo nogeens
share|improve this answer
If you want to update your answer, use the edit link below the post, don't post another answer. – Oliver Salzburg Jan 14 '14 at 15:07
This does not address OS overhead, and cannot guarantee results accurate to within a few ms. – ChrisInEdmonton Jan 14 '14 at 15:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .