News for hackers. Stuff that matters.
Re:Rust and the Future of Systems Programming [video] by pron on Wednesday November 16, 2016 @01:42PM (#12969996)
> even high-powered hardware can take a "major" hit from a GC pause when your application is extremely latency sensitive.

That's true, but high-powered, abundant-RAM realtime applications can use approaches that are cheaper than Rust's. See, e.g., the interesting work currently being done updating realtime Java[1]. The idea is that memory is composed of a few kinds of lifetimes: eternal, scoped and GCed-heap. Scoped memory is basically nested arenas, and GCed heap contains objects that are used by non-realtime portions of the app (which, even in realtime systems, may comprise the majority of code, especially when the system runs on large servers).

An approach like Rust's, however, is crucial when the application is RAM and/or energy constrained.

[1]: https://www.aicas.com/cms/en/rtsj

Re:Rust and the Future of Systems Programming [video] by hinkley on Wednesday November 16, 2016 @01:51PM (#12970081)
If I had infinite free time, I'd love to explore the problem space of implementing interpreters for GC-based languages on top of Rust. It's quite hard to get the concurrency right, and indeed we see a number of major languages that gave up on even trying.
Re:Rust and the Future of Systems Programming [video] by pron on Wednesday November 16, 2016 @02:01PM (#12970208)
What for? If you have the extra RAM and power for a GC, you don't need Rust for safety. HotSpot's next-gen (JIT) compiler is written in Java and is absolutely amazing.
Re:Rust and the Future of Systems Programming [video] by deathanatos on Wednesday November 16, 2016 @02:19PM (#12970429)
> If you have the extra RAM and power for a GC, you don't need Rust for safety.

It isn't just about memory; Rust's safety guarantees in combination with RAII also mean that other resources such as mutex locks, open files, etc. also get closed in a deterministic fashion. (I'd argue that this is quite important for locks, but I've ran into hard-to-debug bugs b/c files weren't being closed out until a GC got to them.)

The way I've always viewed it is that RAII is general to all resources; GC only solves memory.

(I'm assuming the comment you're responding to is discussing getting a concurrent GC to work quite right, which isn't fully relevant w/ my reply; but I do think there is more to Rust's safety than just the memory management, which is what I got from your reply. I'd also argue that memory, in particular, is not abundant, both on mobile devices, but also out in the cloud, where it translates directly into cost both from more expensive VM instances, and from me needing to continually tweak the GC's params.)

Re:Rust and the Future of Systems Programming [video] by pron on Wednesday November 16, 2016 @02:30PM (#12970552)
I was referring to hinkley's idea for using Rust to write GCed VMs. As to other safety features, those are easily added to cheaper GCed languages. Memory is the hard bit, and if you can afford a GC, it is usually cheaper to just use one. As to RAM being costly, I think RAM is one of the few things that is getting very cheap relative to other resources, and GCs require less and less tuning; working hard to avoid a GC when you can afford one seems to me like the mother of all premature optimizations. But I see no point in debating the issue too much. Every company would make its own consideration about which approach is cheaper.

In any event, there are certainly very important use cases that simply cannot afford the power and RAM overhead required by a GC (again -- latency is not an issue; if you have the resources, there are cheap ways of getting extremely low latencies without doing away with a GC) and those use cases would benefit tremendously from a safe language.

Re:Rust and the Future of Systems Programming [video] by hinkley on Wednesday November 16, 2016 @07:04PM (#12972892)
I was in fact thinking of getting concurrent GC to work right. [edit] but also concurrency in general. Global Interpreter Locks when even my laptop has 8 cores?

I also agree that the free memory lunch is going to be over for a while. Java in particular is going to lose out in the container space. I don't think it's an accident that they've suddenly begun taking memory footprint very seriously. They have to.

Re:Rust and the Future of Systems Programming [video] by hinkley on Wednesday November 16, 2016 @07:08PM (#12972912)
What other programming languages do you know of that have an 'absolutely amazing' GC implementation? Wouldn't you like that answer to be 'lots'?

The Java team has worked a lot longer and a lot harder on this problem than pretty much everyone else, and even they hit a wall at 1GB. One that took a dreadfully long time to overcome (so long in fact, that it contributed to me being an ex Java developer)

Re:Rust and the Future of Systems Programming [video] by pron on Thursday November 17, 2016 @01:22AM (#12974872)
Java has quite a few very good GCs, some in OpenJDK, some by Oracle, and one by Azul. Quite a few of them don't have a 1GB wall. They will become even better when Java finally gets value types and the GC won't have to work hard to do stuff it doesn't have to (this is why Go has decent GC performance even though its GC isn't very sophisticated). In any event, I don't see how Rust can make the work any easier. Coming up with that algorithm is 98% of the job.

Lots of languages do have good GC because they run on the JVM. OTOH, we don't know how hard it is to write similar kinds of applications in Rust. Good things take a while to get right -- Java has taken a while, and Rust has, too. It will be a while yet until Java has a GC that everyone likes, and it will be a while yet until Rust is fully fleshed out and its strengths and weaknesses understood. My personal opinion is that the two approaches are complementary, each being superior in a different domain.

Re:Rust and the Future of Systems Programming [video] by pron on Thursday November 17, 2016 @04:01AM (#12975695)
s/Oracle/IBM
Re:Rust and the Future of Systems Programming [video] by takeda on Wednesday November 16, 2016 @02:22PM (#12970454)
Lack of extra RAM and power to run GC is not the problem. The problem is that GC makes code behavior not predictable.
Re:Rust and the Future of Systems Programming [video] by pron on Wednesday November 16, 2016 @02:32PM (#12970571)
That's not true in general. I've used realtime Java in a safety critical hard realtime application (running on a large server), with strong deadline guarantees (we're talking microsecond range). If you have the power and RAM to spare, the predictability issue is more cheaply solved with the approach I mentioned above (by cheaply I mean in terms of development costs; it is more costly than "plain" GC in terms of effort, but still cheaper than the Rust approach).

The only real cost of GC these days is RAM (and power).

Re:Rust and the Future of Systems Programming [video] by nickpsecurity on Wednesday November 16, 2016 @04:46PM (#12971874)
Which VM did you use for that out of curiosity?
Re:Rust and the Future of Systems Programming [video] by pron on Thursday November 17, 2016 @01:24AM (#12974884)
Sun's Java Real-Time System. It is no longer supported, AFAIK, and I don't know which RT JVM the project has switched to because I'm no longer there (my guess would be IBM's).
Re:Rust and the Future of Systems Programming [video] by nickpsecurity on Wednesday November 16, 2016 @04:45PM (#12971870)
Real-time GC's exist. Look up Aonix's Java stuff for what embedded or predictable apps do. Or JamaicaVM below. For enterprise, Azul has some amazing GC tech plus Java CPU's (Vega's).

http://www.ptc.com/developer-tools/perc

https://www.aicas.com/cms/en/JamaicaVM

Re:Rust and the Future of Systems Programming [video] by Matthias247 on Wednesday November 16, 2016 @04:49PM (#12971906)
However that's not something that is automatically solved by manual memory management. Using malloc/free on a desktop OS does also not provide a predictable runtime behavior, although unexpected pauses might be smaller than with most GCs.

The safest bet for predictable memory management and latency is the approach that is used by lots of embedded and realtime software: Don't allocate at all. Or at least don't do it in critical phases.

Re:Rust and the Future of Systems Programming [video] by dbaupp on Wednesday November 16, 2016 @05:43PM (#12972297)
I think this is the point that is obscured when discussing "manual memory management" vs "GC" languages and just focusing on the behaviour/life-cycle of an individual allocation: the former generally provide tools and features that make easier/more natural to avoid allocations, whereas the latter makes the assumption that allocation is usually OK (which is, of course, a perfectly acceptable trade-off for the domains those languages target).
Re:Rust and the Future of Systems Programming [video] by naasking on Wednesday November 16, 2016 @02:32PM (#12970574)
That's not true, some GC algorithms make code behaviour unpredictable. Real-time tracing GCs exist. Reference counting is GC too, but it too is unpredictable.
Re:Rust and the Future of Systems Programming [video] by geodel on Wednesday November 16, 2016 @02:57PM (#12970870)
Will that next-gen JIT be enabled by default for Java 9 or 10?
Re:Rust and the Future of Systems Programming [video] by hyperpape on Wednesday November 16, 2016 @03:40PM (#12971276)
Not by default in 9, but you will be able to run it with a stock version of Hotspot.