3 ms·
"a realtime system must have a deterministic time to complete a task". Incorrect, a realtime system must only have execution times below a certain threshold. m
by fleitz 15y ago
"a realtime system must have a deterministic time to complete a task".
Incorrect, a realtime system must only have execution times below a certain threshold. malloc/free is just as non-deterministic as GC allocated memory (in practical systems). If you put effort into it you can make malloc/free do really stupid things too. If I wrote a program that allocated and freed the right size strings the program would eventually crash.
With any sort of modern CPU it would be almost impossible to produce non-trivial programs with deterministic execution times. I'd hazard a guess that there are very few 'realtime' programs that couldn't be written using the JVM. If you can do HFT on the JVM it's realtime enough.
To make systems with deterministic execution times you'd have to start looking at extremely limited processors that lack RAM (or have really exotic ram that doesn't refresh), as well as removing other resources that are essential to building software the modern way.
All this proves is that for this particular problem the JVM is probably unsuitable for a realtime system. The fortunate thing is that I don't think any real time program actually needs to allocate strings in this manner.
In all seriousness most of the reason that the JVM is not used on realtime systems is because there aren't very many cheap CPUs capable of executing java byte code that are certified for operation in the harsh environments that a lot of realtime systems operate in. My friend builds realtime systems and he codes in C because that's the only compiler available for the CPU.
He'd start using Netduino in a heartbeat if it could survive being next to an electric generator inside the Hoover dam.
- wglb 15y agoSlightly off topic, but do you have particular information about JVM being used in HFT environment?
- fleitz 15y agohttp://martinfowler.com/articles/lmax.html?t=1319912579 http://martinfowler.com/articles/lmax.html?t=1319912579 This is actually a trading platform but if you can run the exchange on the JVM you could certainly write a client for it on the JVM. Also: http://www.quantfinancejobs.com/jobs/java.asp http://www.quantfinancejobs.com/jobs/java.asp
- wglb 15y agoI had seen that, but Martin Fowler is not whom I would have thought of as deeply familiar with low latency and JVM performance under stress. I will be looking into that platform, but I see one caution flag: LMAX is a new retail financial trading platform. As a result it has to process many trades with low latency. the key word being "retail". I am wondering if retail's version of low latency is in seconds or tens of seconds.
- chollida1 15y ago> I am wondering if retail's version of low latency is in seconds or tens of seconds. I think you're off by an order of magnitude or two. Our fund doesn't really worry too much about execution speed and we'd only tolerate low 100 millisecond latency. 10's of milliseconds is what we'd prefer. Many firms want to be lower still.
- wglb 15y agoThanks for the note. Couple of questions. 1) Do you consider yourself retail? I would have not considered a hedge fund retail. 2) Can you say if you are colocating your servers? 3) Can you say if you are using JVM in a latency-critical application? I am working on a benchmark, building a fake exchange framework as a platform to test relative performance of various languages, where various includes Lisp, C, Java and possibly others.
- chollida1 15y ago> 1) Do you consider yourself retail? I would have not considered a hedge fund retail. Yes fair point. That terminology isn't really well defined. You are correct that typical retail means individuals and institutional means large funds (read professionals). Banks will often count hedgies as retail clients which is where the terminology gets blurry. But if you mean non professional individuals then your point a bout latency is probably correct. > 2) Can you say if you are colocating your servers? We don't typically, but we don't live far from the exchanges. We also aren't super low latency. I honestly think that super low latency is a loosing proposition as there is usually only one person who can jump on an arbitrage opportunity. Having said that we do have one server executing algos that is collocated. > 3) Can you say if you are using JVM in a latency-critical application? I can and we aren't though, it's not because of the jvm itself.