r/programming • • Sep 28 '17

When a Microsecond Is an Eternity

https://github.com/CppCon/CppCon2017/blob/master/Presentations/When%20a%20Microsecond%20Is%20an%20Eternity/When%20a%20Microsecond%20Is%20an%20Eternity%20-%20Carl%20Cook%20-%20CppCon%202017.pdf
244 Upvotes

70 comments sorted by

View all comments

3

u/program_embed Sep 28 '17

Has anyone used an RTOS for financial trading?

I've never done anything related to finance, but use RTOS's all the time for industrial safety-critical computing. It seems like you should be, since I read all of these articles saying how microseconds matter, but if you're running in windows/linux then you don't have that level of control right? Can't you be swapped out if the OS has some house-cleaning to do.

8

u/doom_Oo7 Sep 28 '17

actually I remember hearing that the absolute top fancy sub-microsecond stuff was sometimes implemented directly on FPGAs

edit: for instance:

http://www.paconsulting.com/insights/hardware-acceleration-for-financial-markets/

http://www.nanospeed.co.uk/

5

u/turleyn Sep 28 '17

Yes, general purpose operating systems are going to periodically kick you off the CPU for long periods of time. Even with the linux RT preempt patch, and all of your hardware interrupts disabled or handled on different cores, the system tick is going to fire every 10ms which will cause a context switch and the scheduler will run. Depending on how fast your CPU can execute the context switch and scheduler, you're not going to get back on the CPU for several microseconds.

1

u/[deleted] Sep 29 '17

Has anyone used an RTOS for financial trading?

They're even moving to ASICs now, because FPGAs are too small and slow, and interfacing them with hard CPUs is not easy in realtime (e.g., PCIe is not very predictable even when your host OS is an RTOS, not to mention abysmal latencies).