12 ms·
JVM Internals (2013)
- kjeetgill 8y agoWow! Amazing find. This is an amazingly well organized, detailed, useful resources. It might be worth adding (2013) or JDK7 to the title. Off the top of my head the details about the permgen don't apply anymore and I believe this predates G1.
- pjmlp 8y agoAnd in any case very specific to one JVM implementation, while there is a plethora of them around. https://en.wikipedia.org/wiki/List_of_Java_virtual_machines#Active https://en.wikipedia.org/wiki/List_of_Java_virtual_machines#... https://en.wikipedia.org/wiki/List_of_Java_virtual_machines#Active_2 https://en.wikipedia.org/wiki/List_of_Java_virtual_machines#...
- pvg 8y agoMost of it is generic enough to be applicable to anything that calls itself a JVM since it's required by spec. For instance, everything bytecodes, what a class file looks like, how dynamic linking works, etc.
- pjmlp 8y agoAnyone that has had to track down issues between Sun(Oracle) and IBM caused by GC or JIT differences, will have a different opinion. I surely have been there a few times.
- pvg 8y agoWhy would you have a different opinion? This post is almost entirely not about stuff like that. If anything, the other linked thing in this thread 'JVM Anatomy' and this post should meet somewhere and agree to swap titles.
- pjmlp 8y agoBecause those things are left unspecified and they matter specially under heavy load. A JEE server might scale differently depending under which JVM it is running. The GC algorithm chosen by the implementation might lead to higher pauses in another JVM. The beautiful auto-vectorized code in one JVM might run like molasses in another JVM. One JVM might lack tiered compilation, thus increasing the saw shape pauses when it comes to JIT a specific method. Finally, the spec doesn't state how threads are executed, so they can be implemented as green or red threads, and certainly the code won't run the same way.
- bitcharmer 8y agoIt's true, but in practice Oracle's Hotspot is used in overwhelming majority of deployments you will get to work on.
- pjmlp 8y agoNot when you work with corporations that love Websphere, embedded deployments or that little fork known as Android.
- jxub 8y agoI recently attended a talk with Simon Ritter from Azul Systems that is developing Zing VM, and this VM is apparently gaining adoption among financial companies thanks to improved startup time and novel GC algorithms. Anyone with first hand production experience?
- cmclaughlin 8y agoWe use it at my job for our main api which needs lots of memory. I’m on the devops side and I don’t get into it much past the deployment of the app, so from my side it’s more of a hassle than openjdk since we have to deal with licensing.
- yazr 8y agoYes. Used in production HFT system. Works as advertised. But you should try the new J8 GC algos before you try a whole new VM
- bitmapbrother 8y agoAndroid is not a fork of the JVM as it doesn't use the JVM. You seem to keep on parroting this fallacy.
- pjmlp 8y agoAndroid started by copying Apache Harmony, as means of Google trying to avoid to pay Sun their rightful licenses, as confirmed by Andy Rubin emails. Thanks to that, Sun lost what might have rescued from insolvency. Which Google, while thinking that they finally got rid of Sun did not bothered to try to save. After the lawsuit and IBM's move to sponsor OpenJDK, Google was forced to migrate to OpenJDK. Yet Android does not use 100% of OpenJDK, rather they are adding little pieces of it in each Android version. Thus Android uses a forked version of OpenJDK, with everything that Google doesn't care removed from it. The fact that they use ART is an implementation detail, some Java certified JVMs for embeded deployment also have tooling to convert to their optimized implementation instead of using .class files. Rest assured, I am quite good parroting.
- hyperpape 8y agoI'm well aware that my knowledge of the JVM is almost exclusively about the Hotspot lineage, and a bit about Zing, which shares a lot of DNA, and I'd like to know more about the alternatives, but either I'm looking in the wrong places, or there's simply much less accessible information out there. My thought is that it would be better to spread information about the alternate implementations rather than exclusively complain about the misidentification.
- pjmlp 8y agoSorry for being pedantic, I just think mixing JVM with Hotspot is a bit like thinking GCC dictates what C is all about. Both are actually quite common misconceptions.
- rzzzt 8y agoPermgen evolved into the metaspace: https://dzone.com/articles/java-8-permgen-metaspace https://dzone.com/articles/java-8-permgen-metaspace
- jxub 8y agoAnd here's an Oracle blog post about it: https://blogs.oracle.com/poonam/entry/about_g1_garbage_collector_permanent https://blogs.oracle.com/poonam/entry/about_g1_garbage_colle...
- akerro 8y agoI also recommend this JVM anatomy https://shipilev.net/jvm-anatomy-park/ https://shipilev.net/jvm-anatomy-park/
- pvg 8y agoPreviouslies: https://hn.algolia.com/?query=jvm%20internals&sort=byPopularity&prefix&page=0&dateRange=all&type=story https://hn.algolia.com/?query=jvm%20internals&sort=byPopular... There's nothing really wrong with this popular write-up and its many ripoffs and copycats over the years, other than the (in hindsight) poorly chosen title. Most of this stuff is an overview of what's in the JVM spec. If you are searching around for some thing or another about the actual internal implementation details of the Oracle JVM, this article and its many clones make the search term 'JVM internals' nigh-useless.
- rootlocus 8y agoI also enjoyed the book "The Java Virtual Machine Specification" [1] which is available on Safari Online. [1] https://www.amazon.com/Java-Virtual-Machine-Specification-Addison-Wesley-ebook/dp/B00K3NR6M4 https://www.amazon.com/Java-Virtual-Machine-Specification-Ad...
- gunnarmorling 8y agoThe spec for the JVM (as the one for the Java language) is also freely available here: https://docs.oracle.com/javase/specs/index.html https://docs.oracle.com/javase/specs/index.html
- mr_overalls 8y agoCan anyone compare the JVM's technical merits with Microsoft's CLR? I always hear that the JVM compared to advanced alien technology, with its millions of engineer-hours, but not so much glowing praise about the CLR. With Oracle remaining evil and Microsoft making waves in open source these days, I wonder how likely it is, for example, that a Big Data ecosystem like Hadoop/Spark/etc. could evolve around C# and .NET.
- Scarbutt 8y agoC# and .NET still have a long way to go to be considered mature enough for serious big projects in linux, linux being the key here.
- GordonS 8y agoErm, C# has been available via Mono for 14 years!
- severino 8y ago> Oracle remaining evil and Microsoft making waves in open source these days That's just PR. But real projects need sound technical motivations for making such a move.
- maxxxxx 8y ago"With Oracle remaining evil and Microsoft making waves in open source these days," I work with .NET and generally like it but .NET is still far, far away from the openness of Java. MS has open sourced a lot of stuff but it's still controlled by them. I also have my doubts for how long MS will sustain the move to open source. They have a long history of abandoning stuff like this after a few years and going back to business as usual.
- jacksmith21006 8y agoThis is the type of post I love the most. Great find and wish we got more things like this.
- jokoon 8y agoThis reminded of the "layers of crap" John Carmack was talking about once. Java is an impressive tech, but I still fail to understand why it is so popular. It comes from a proprietary tech, it requires additional software to run, you cannot disable its garbage collector, browsers don't like it, I don't think it's very popular in the manufacture embedded controllers, and if enforces object oriented structure inside its JVM. Oh and Torvalds hates it too. Not to mention the gargantuan bloat that are JEE and system like maven or ant. It feels really different and foreign compared to the simplicity of unix many devs are used to. Even microsoft decided to rewrite minecraft to C++. I saw a private server had such big freezes, just to handle 3 or 4 players.
- Spooky23 8y agoThere are companies and governments paying massive premiums for things like Unisys and Wang mainframes, which are mostly VMs running on a Xeon chip in a box that you can’t open. They are doing this because it’s expensive or impossible to move the code for a variety of reasons. I’m familiar with Java systems that have been replatformed a dozen times without incident and on the cheap.
- le-mark 8y agoSo your claim is wang and unisys systems are still being built and sold? Do you have further detail on this? Very interesting indeed.
- sulam 8y agoI don’t know if they’re still being built, but parent didn’t make that statement. You can be paying for something even if there aren’t more of them coming off a factory line.
- twoodfin 8y agoOh yes! https://assets.unisys.com/Documents/Global/ProductInformationSheets/PI_170236_ClearPathForwardLibra8480_8490.pdf https://assets.unisys.com/Documents/Global/ProductInformatio...
- javajosh 8y agoAs a serious Java nerd now programming python, I'd love to see something like this for python!
- hyperpape 8y agoI think pgbovine has done some things, but I don’t have a link. I also read a lot of shorter Python internals posts when I was learning Python. Maybe look at Raymond Hettinger?
- simen 8y agoYou could begin with 500 lines or less: http://www.aosabook.org/en/500L/a-python-interpreter-written-in-python.html http://www.aosabook.org/en/500L/a-python-interpreter-written... It implements a naive, simplified Python VM in Python. Of course, that is only a very high-level overview. By necessity it handwaves a ton by just relying on the underlying Python (like GC). For a more in-depth look, you can check out PyPy's dev docs (http://doc.pypy.org/en/latest/ http://doc.pypy.org/en/latest/). PyPy is an alternative to CPython, so it does many things very differently (some in a way that have never been done in prog lang implementation before), but the docs do make comparisons to CPython.
- SegFaultCDumped 8y agoCan we make hardware that runs JVM bytecode? It's a neat idea.
- joshumax 8y agoCertain ARM-based SoCs used to be able to do this using a feature called Jazelle[1], but it had an array of problems that caused an early obsolescence. 1: https://en.wikipedia.org/wiki/Jazelle https://en.wikipedia.org/wiki/Jazelle
- monocasa 8y agohttps://en.wikipedia.org/wiki/PicoJava https://en.wikipedia.org/wiki/PicoJava
- valarauca1 8y agoYour Intel based CPU’s Management Engine does so it can run that NSA spyware the Internet tells me [1]. Also embedded java, (kind of the JVM without floats, or GC) is common on base band processors for cellphones and satellites. The full modern JVM10 spec has way to much magic to do in hardware. Some of the opcodes do things hardware can’t easily emulate. [1] https://news.ycombinator.com/item?id=11913379 https://news.ycombinator.com/item?id=11913379