M
From time to time we have discussions on this list concerning how PCs running general purpose operating systems respond under various load conditions. The most recent was conducted under the subject "PC: Labview+servo control". The usual concern expressed is that the operating system will cause the program timing to become erratic if the system is under any significant load. The program timing is a function of the operating system scheduler, and so is limited by the operating system capabilities.
Usually, these discussions proceed from annecdotal observations. I thought it would be useful to have a set of actual measurements made under controlled conditions. The systems I have available for conducting tests have a Linux OS, so these conclusions apply to Linux only. The same testing method could be applied to a computer with MS-Windows though.
My conclusions are that (for the conditions that I tested under):
1) Although the operating system used (Linux) is not a real time OS, it was under most conditions able to provide timing which is repeatable within a millisecond 99.9% of the time. This is true down to a 1 millisecond (1kHz) rate.
2) CPU load, disk activity, and network activity have no measureable effect on the ability of the operating system to schedule the test program at the requested interval. The results for tests where the PC is heavily loaded (to 100%) with any of these are virtually the same as for the no load condition.
3) Keyboard and mouse activity do appear to have some measureable effect. with delays of up to 10 milliseconds in one half of one percent of samples. These effects are probably not significant for most applications however.
These results are unexpected and counter-intuitive. I would have expected *no* effect from the keyboard or mouse, and at least some degrading of performance when under heavy CPU, network or disk load. The overall system under all conditions is also much more repeatable than I would have predicted.
Any comments on the above would be appreciated.
If anyone is interested in repeating these tests under different conditions, I can provide the test programs that I used. The actual measurement program is a small 'C' program I wrote for this test that I can provide source for. The "load" programs are very small "bash" scripts I wrote that can be used as is, (or easily re-written if necessary).
I don't have a computer with MS-Windows that is available for running these tests. A set of test results showing the equivalent figures for MS-Windows would doubtless be of interest to a great many people doing applications on that platform. If someone does have a suitable system available and would like to volunteer to repeat these tests, let me know and we can discuss how to conduct the tests.
What follows below is a brief summary of how the tests were conducted, and the results. If anyone is interested in more details, please let me know and I will elaborate. I still have the full set of test data.
=== Method =The basic experiment consisted of running a small program which would read the PC clock, record the current time, sleep for a specified period of time, and then wake up and repeat the process. This would be the "measurement" process. Various additional "load" processes were also run at the same time to simulate computing loads which may cause scheduing deviations.
The tests were 1) "no load" - the computer is idle, 2) "CPU" - the CPU is loaded to 100%, 3) "network" - large files are continously copied from another computer to the ethernet port, 4) "disk" - data was repeatly written to disk, 5) "mouse" - the mouse was continously moved manually, 6) "keyboard" - the keyboard was typed into at a rate of 1 to 2 keystrokes per second.
Each test was repeated at sampling (scheduling) intervals of 1, 5, 10, 25, and 50 milliseconds. The mouse and keyboard tests were exceptions to this, as the loads were being applied manually, and I didn't have the patience to sit through a full test sequence. For these two I tested only at 1 and 5 milliseconds.
The measurement program would take 60,000 samples each time, write the results to disk and then exit. This resulted in a total of 1.44 million readings. Reproducing these in their entirely here would result in a rather large e-mail, so I will just summarise the results below.
=== Test Results Summary =The test results may be summarised as follows. For the "no load", "CPU", "network", and "disk" tests, 99.86 to 99.99% fell exactly on the nominal interval. 99.88% to 99.99% of samples fell within +/- 1 millisecond of the nominal intervals. The worst case results were several delays of 3 msec.
For the mouse and keyboard tests, there was a bit more dispersion. For the mouse tests 97.86% fell on the nominal, while 99.48% fell within +/- 1 millisecond of the nominal intervals. The worst case results were a single delay of 9 msec. All except three measurements fell with 4 msec.
For the keyboard tests, 99.41% fell on the nominal, while 99.62% fell within +/- 1 millisecond of the nominal intervals. The worst case results were a 3 samples which were delayed by 10 msec.
=== Test Equipment =Computer: x86-64 PC with AMD Athlon 64 3200+, 1GB RAM. Operation System: 2.6.12-12mdk, 64bit version.
Disk: 80GB SATA.
Usually, these discussions proceed from annecdotal observations. I thought it would be useful to have a set of actual measurements made under controlled conditions. The systems I have available for conducting tests have a Linux OS, so these conclusions apply to Linux only. The same testing method could be applied to a computer with MS-Windows though.
My conclusions are that (for the conditions that I tested under):
1) Although the operating system used (Linux) is not a real time OS, it was under most conditions able to provide timing which is repeatable within a millisecond 99.9% of the time. This is true down to a 1 millisecond (1kHz) rate.
2) CPU load, disk activity, and network activity have no measureable effect on the ability of the operating system to schedule the test program at the requested interval. The results for tests where the PC is heavily loaded (to 100%) with any of these are virtually the same as for the no load condition.
3) Keyboard and mouse activity do appear to have some measureable effect. with delays of up to 10 milliseconds in one half of one percent of samples. These effects are probably not significant for most applications however.
These results are unexpected and counter-intuitive. I would have expected *no* effect from the keyboard or mouse, and at least some degrading of performance when under heavy CPU, network or disk load. The overall system under all conditions is also much more repeatable than I would have predicted.
Any comments on the above would be appreciated.
If anyone is interested in repeating these tests under different conditions, I can provide the test programs that I used. The actual measurement program is a small 'C' program I wrote for this test that I can provide source for. The "load" programs are very small "bash" scripts I wrote that can be used as is, (or easily re-written if necessary).
I don't have a computer with MS-Windows that is available for running these tests. A set of test results showing the equivalent figures for MS-Windows would doubtless be of interest to a great many people doing applications on that platform. If someone does have a suitable system available and would like to volunteer to repeat these tests, let me know and we can discuss how to conduct the tests.
What follows below is a brief summary of how the tests were conducted, and the results. If anyone is interested in more details, please let me know and I will elaborate. I still have the full set of test data.
=== Method =The basic experiment consisted of running a small program which would read the PC clock, record the current time, sleep for a specified period of time, and then wake up and repeat the process. This would be the "measurement" process. Various additional "load" processes were also run at the same time to simulate computing loads which may cause scheduing deviations.
The tests were 1) "no load" - the computer is idle, 2) "CPU" - the CPU is loaded to 100%, 3) "network" - large files are continously copied from another computer to the ethernet port, 4) "disk" - data was repeatly written to disk, 5) "mouse" - the mouse was continously moved manually, 6) "keyboard" - the keyboard was typed into at a rate of 1 to 2 keystrokes per second.
Each test was repeated at sampling (scheduling) intervals of 1, 5, 10, 25, and 50 milliseconds. The mouse and keyboard tests were exceptions to this, as the loads were being applied manually, and I didn't have the patience to sit through a full test sequence. For these two I tested only at 1 and 5 milliseconds.
The measurement program would take 60,000 samples each time, write the results to disk and then exit. This resulted in a total of 1.44 million readings. Reproducing these in their entirely here would result in a rather large e-mail, so I will just summarise the results below.
=== Test Results Summary =The test results may be summarised as follows. For the "no load", "CPU", "network", and "disk" tests, 99.86 to 99.99% fell exactly on the nominal interval. 99.88% to 99.99% of samples fell within +/- 1 millisecond of the nominal intervals. The worst case results were several delays of 3 msec.
For the mouse and keyboard tests, there was a bit more dispersion. For the mouse tests 97.86% fell on the nominal, while 99.48% fell within +/- 1 millisecond of the nominal intervals. The worst case results were a single delay of 9 msec. All except three measurements fell with 4 msec.
For the keyboard tests, 99.41% fell on the nominal, while 99.62% fell within +/- 1 millisecond of the nominal intervals. The worst case results were a 3 samples which were delayed by 10 msec.
=== Test Equipment =Computer: x86-64 PC with AMD Athlon 64 3200+, 1GB RAM. Operation System: 2.6.12-12mdk, 64bit version.
Disk: 80GB SATA.