6 ms·
Reminds me of: People said you can’t write a financial trading system in a garbage collected language. Turns out you can as long as you don’t garbage collect du
by GoodDreams 4y ago
Reminds me of: People said you can’t write a financial trading system in a garbage collected language. Turns out you can as long as you don’t garbage collect during the trading day by carefully managing allocations and manually running GC each day before trading starts.
Or the old story of the junior engineer who finds a memory leak in a missile’s guidance system and the senior engineer says the memory leak is fine as long as you don’t run out of memory before the missile completes its mission.
- ballenf 4y agoOr to put it in other terms, you want to consume memory at a rate lower than propellant.
- elil17 4y agoWell, for ballistic missiles a large portion of the flight will be the mid-course phase (which is typically unpowered) and the terminal phase may use control surfaces for maneuvering. For cruise missiles that's a good rule of thumb.
- Someone 4y agoNot typically, always. “Ballistic” in “ballistic missile” means “moving under the force of gravity only”
- elil17 4y agoMight you not use some fuel for countermeasures during the midcourse phase?
- tomatotomato37 4y agoYeah, a ballistic missile's bus still does a lot of horizontal maneuvering during the mid-course phase to actually get on target; the main boost phase is mainly just for getting it pointed in the general direction and proving verticality
- marcosdumay 4y agoI imagine RAM weight is not a relevant parameter on the rocket equation.
- aliqot 4y agoThere's a reason why lots of HFT firms have massive amounts of RAM. It's easier to get the code out first, and handle leaks with a reboot later.
- rbanffy 4y agoAnd RAM is quite cheap these days compared to the money the hardware is supposed to make.
- zokier 4y agoFor many processes where the lifecycle is limited, freeing memory can be waste of time; most notably freeing memory just before exiting is complete waste.
- 0xbadcafebee 4y agoDepending on your OS. And if you want to profile or move code around, it's better to free it asap.
- dig1 4y ago> People said you can’t write a financial trading system in a garbage collected language People have been writing HFT systems in GC languages (Java, OCaml) for a while, and as you mentioned, you need to know when to pause/unpause/prevent collection in the critical section. This [1] is an excerpt from a talk with Dave Lauer [1], who has done it in Java - it took his system ~40 μs from receiving data to producing market order, and he explains in great detail what amount of work the system had to do. And this was >10 years ago. [1] https://youtu.be/1ah7XokvcwA?t=785 https://youtu.be/1ah7XokvcwA?t=785
- gbasin 4y agosub 10 in Java was very doable 10 years ago, fwiw. even better than collecting once a day is doing everything off-heap — C-style java :D
- worewood 4y ago> you need to know when to pause/unpause/prevent collection in the critical section. That's his point. It's like saying humans can walk over a lake, as long as it's dry season and the lake is now 10 inches deep. You can use garbage collected languages as long as you don't collect. (!?!?!) I'm even more hardline. IMO everything time or life-critical should have static memory allocation, period.
- tjoff 4y ago> Turns out you can as long as you don’t garbage collect during the trading day by carefully managing allocations and manually running GC each day before trading starts. The surprising thing here is that it is considered worth it with those limitations. My hope/guess is that because of the GC hype there wasn't any good alternatives. With the alternatives gaining maturity now I'd hope that that decision wouldn't be made today (when starting from a clean slate).
- rbanffy 4y ago> it is considered worth it with those limitations. These people make decisions based on Excel spreadsheets that are not properly documented. I wouldn't trust their judgement, despite the fact they managed not to crash the global financial system too frequently.
- lucozade 4y ago> The surprising thing here is that it is considered worth it with those limitations. It shouldn't be that surprising. Languages like Java and C# are perfectly sensible languages for writing the vast majority of a lot of trading systems. So it's eminently reasonable to use them, or equivalent, and deal with the bits that are GC-phobic as special cases. I've worked with/on trading systems written is mainstream languages including C++, Java, C# and Python, as well as less mainstream such as APL and Smalltalk. I can safely say that there are way more critical concerns than whether or not it uses a GC.
- bitwize 4y agoWe have Rust now, and some safe memory usage patterns for C++. GC just increases your energy bill and helps heat up the planet.
- rwmj 4y ago[Citation needed] Rust encourages reference counting, a particularly inefficient form of GC which actually turns reads into writes(!), and it cannot move objects to compact memory except when it can prove that every object has only a single reference.
- linkdink 4y agoIs that really an old story? There's usually no memory allocation after initial startup in safety- and mission-critical systems. Rolling over past the max value of an integer data type is a thing though, and they do reboot for that.
- tobyjsullivan 4y agoThe parent probably meant it more as an urban legend rather than some sort of documented event.
- deleted 4y ago[deleted]
- Kiro 4y agoNo, it's a real story. See sibling replies.
- deleted 4y ago[deleted]
- tester756 4y ago"junior"? :P https://devblogs.microsoft.com/oldnewthing/20180228-00/?p=98125 https://devblogs.microsoft.com/oldnewthing/20180228-00/?p=98... _________ From: k...@rational.com (Kent Mitchell) Subject: Re: Does memory leak? Date: 1995/03/31 Norman H. Cohen (nco...@watson.ibm.com) wrote: : The only programs I know of with deliberate memory leaks are those whose : executions are short enough, and whose target machines have enough : virtual memory space, that running out of memory is not a concern. : (This class of programs includes many student programming exercises and : some simple applets and utilities; it includes few if any embedded or : safety-critical programs.) This sparked an interesting memory for me. I was once working with a customer who was producing on-board software for a missile. In my analysis of the code, I pointed out that they had a number of problems with storage leaks. Imagine my surprise when the customers chief software engineer said "Of course it leaks". He went on to point out that they had calculated the amount of memory the application would leak in the total possible flight time for the missile and then doubled that number. They added this much additional memory to the hardware to "support" the leaks. Since the missile will explode when it hits its target or at the end of its flight, the ultimate in garbage collection is performed without programmer intervention. -- Kent Mitchell | One possible reason that things aren't Technical Consultant | going according to plan is ..... Rational Software Corporation | that there never was a plan!
- hinkley 4y agoThis is why we need a Software Engineering license. When the point of the product is to kill someone, you can't just stochastically measure shit like this. If the device is ever out of control before it ceases operations, you're looking at Geneva Convention level offenses. Even software designed to save lives can't get away with this sort of thing.
- tester756 4y agoI do wonder what happens if the missile runs out of memory It just drops?
- 4y ago
- gumby 4y agoReminds me of a sales call to a military contractor. They were interested in an Open Source OS because of the licensing costs. The embedded OS they were using had a license that said you could run as many instances as you liked on a "single device". Their problem was that when they operated their device it was indeed a single device, but later became many more. If they paid for the extra licenses they didn't need it would be ripping off the government; if they failed to pay for the extra license at some point they would be in breach of their contract with the government as all these unlicensed devices were released. It rapidly became obvious that their application was a MIRV and that they weren't really going to change but had asked us to talk with them as part of their process of negotiating a deal with their current supplier. It's hard to imagine really worrying about your license agreements if there actually were a global thermonuclear war.
- nocoiner 4y agoThat is an amazing story.
- personjerry 4y agoThat reminds me of a short sci-fi story I read about an alien invasion, in which humans were losing horribly until we learned about their legal system and sued them into submission