1

A colleague of mine is getting a quote from a software developer that involves serial communication, and in their quote, the developer makes the the following statement:

...Windows 7 operating system, which uses a non-real-time serial communication setup.

Is it true that Windows 7 does not support real-time serial communication? To clarify on what it is meant by "real-time," the project deals with robot automation and any delays in communication (such as from buffering) could cause damage to the product, or stop the production line. I can not find any evidence to either support or deny this claim. I don't believe it to be true though, and I think it probably has more to do with them using VB.Net for development.

Drew Chapin
  • 7,779
  • 5
  • 58
  • 84
  • Note to the moderators: I struggled with whether to ask this question on [SO] or [programmers.se], but ultimately decided to post it on [SO] because I felt it would get a better response. – Drew Chapin Oct 14 '13 at 12:48
  • It depends on what you think 'real-time' means. All IO is buffered by the underlying hardware/OS, to some extent. – dbasnett Oct 14 '13 at 12:59
  • @dbasnett, I'll modify the question to make it more clear, but the project deals with automation/robot-control. – Drew Chapin Oct 14 '13 at 13:15
  • isn't it limited to 115.200 baud by design, so not really useful for real time stuff by default...beat me if I'm wrong ;) – David Sdot Oct 14 '13 at 13:22
  • Windows isn't a real-time operating system, because its pre-emptive multitasking means that its response to incoming events may be delayed or interrupted. This is only apparent at small timescales so it may or may not be a problem for specific applications. It's also possible to minimise the impact of this - applications for music production etc manage to work well nowadays. I think the techniques though are specialised and beyond the reach of the average VB developer. I'd take this as a CYA by the developer . – peterG Oct 14 '13 at 13:39
  • I'd like to add that I won't trust in a OS like windows or linux or whatever to control a prduction line. Only for visual feedback/data writing/etc. , the rest is handled by PLC and/or "real" real-time systems like ADwin or such. – David Sdot Oct 14 '13 at 13:49
  • @DavidSdot, I probably should have mentioned that the PC is not directly controlling the robot. The PC is for a Vision system which provides data to the robot controller. But I was trying to limit the question just "Windows 7" and "Real-Time Communication" without revealing anything else about the setup as much as I could. – Drew Chapin Oct 14 '13 at 14:37

3 Answers3

2

The 'real-time' term used here does not actually refer to anything in the serial communications bus.

However, it does have to do with the fact that the windows multitasking scheduler is not designed to allow for realtime tasks which have hard deadlines.

See this question for some info Why is Windows not considered suitable for real time systems/high performance servers?

Lets pretend you have a particle accelerator hooked up to your computer and you have to ensure that every 10 microseconds the magnet train switches to power the next set of cells but windows decides that it's time to apply some Windows Update patches. Your photon stream wouldn't get redirected properly and could cause damage to the system.

Community
  • 1
  • 1
nvuono
  • 3,323
  • 26
  • 27
  • 1
    Also see [What does “Windows is not a real-time operating system” mean?](http://superuser.com/questions/406819/what-does-windows-is-not-a-real-time-operating-system-mean) – Justin Oct 14 '13 at 13:39
2

It is a fairly nonsensical statement, Windows itself is not a real-time operating system. It cannot provide hard guarantees that user mode code is going to respond quick enough. Other than thread scheduling delays, a simple mishap like getting the pages of the process swapped to the paging file is enough to cause arbitrary delays in getting it running again. An attribute of any demand-paged virtual memory operating system. So of course a "serial communications setup" cannot be either, assuming you are not contemplating writing ring 0 kernel code. Nobody does.

It is not a practical problem, the only point of using a serial port is to talk to the controller for the robot. Which provides the real-time guarantee.

You could only get in trouble when you command the robot to make an unrestricted move and use an external sensor to get it to stop. Not uncommon when you need to find an object whose location you don't know. A decent controller knows how to do that, avoid implementing it in your Windows code. Solid overtravel protection built into the robot itself that triggers an e-stop is necessary anyway, you can't trust that sensor either.

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
2

No, Windows 7 (and in fact all of the mainstream Windows releases) are not Real-time operating systems. To clarify what is meant by a real-time operating system:

A real-time operating system (RTOS) is an operating system (OS) intended to serve real-time application requests. It must be able to process data as it comes in, typically without buffering delays. Processing time requirements (including any OS delay) are measured in tenths of seconds or shorter.

A key characteristic of an RTOS is the level of its consistency concerning the amount of time it takes to accept and complete an application's task; the variability is jitter.[1] A hard real-time operating system has less jitter than a soft real-time operating system. The chief design goal is not high throughput, but rather a guarantee of a soft or hard performance category. An RTOS that can usually or generally meet a deadline is a soft real-time OS, but if it can meet a deadline deterministically it is a hard real-time OS. [2]

An RTOS has an advanced algorithm for scheduling. Scheduler flexibility enables a wider, computer-system orchestration of process priorities, but a real-time OS is more frequently dedicated to a narrow set of applications. Key factors in a real-time OS are minimal interrupt latency and minimal thread switching latency; a real-time OS is valued more for how quickly or how predictably it can respond than for the amount of work it can perform in a given period of time.[3]

Note that most of the time real-time operating systems are less efficient (i.e. have lower throughput), which is why none of the mainstream operating systems are real-time (e.g. real-time editions of Linux use completely different kernels) - its only worth it in cases where timing at a very precise level is absolutely critical.

Windows CE is a real-time operating system Real-Time Systems with Microsoft Windows CE 2.1

Justin
  • 84,773
  • 49
  • 224
  • 367
  • Would you agree that timing would be improved if a language such as C or C++ were used instead of .Net? – Drew Chapin Oct 14 '13 at 14:33
  • @druciferre No, it still wouldn't make it real-time. Thats a property of the operating system, not the language. – Justin Oct 14 '13 at 14:36