[Brush] Ali Bixuan face questions: next to test your Java programming skills - problem solution 22-24

22.Parallel GC, CMS GC, ZGC, Azul Pauseless GC main difference is? The rationale behind also simply described under?

Reference: https://snailclimb.gitee.io/javaguide/#/docs/java/jvm/JVM%E5%9E%83%E5%9C%BE%E5%9B%9E%E6%94%B6?id= 41-serial-% e6% 94% b6% e9% 9b% 86% e5% 99% a8

GC type Brief Description The rationale behind
Serial The simplest collector, single-threaded, stop the world Simple and efficient, the use of the new generation of replication algorithm, using old's mark - Collation Algorithm.
Parallel GC Multi-threaded version of the collector Concurrent collection, multithreading
CMS GC CMS (Concurrent Mark Sweep) is a collector for the shortest recovery time objectives pause collector. It is consistent with the focus on user experience in using the application. "Mark - sweep" algorithm, concurrent collection, low pause
G1 collector G1 (Garbage-First) is a server for a garbage collector, mainly for the same time with multiple processors and large memory capacity of the machine. High probability to meet the requirements of GC pause times, further comprising a high throughput performance characteristics. G1 collector in the background maintains a priority list, according to each collection time allowed, the maximum value of the preference Region recovery (which is the origin of its name is Garbage-First). This memory space is divided using Region and prioritized region recovery methods, to ensure that the collector GF limited time collection efficiency can be as high as possible (the memory dismembered).
ZGC ZGC: scalable, low-latency garbage collector Mark a ZGC logically divided (labeled), of Relocate (migration), the Remap (remapping) in three stages, see https://www.jianshu.com/p/4e4fd0dd5d25

23. Please write a program be allowed to appear at runtime to trigger five times ygc, then three times fgc, then three times ygc, then once fgc, please give the code as well as startup parameters.

The main difference Coroutine and Java threading mechanism 24. Go is? If the Java language to achieve transparent Coroutine, do you think the main difficulty is?

Java threading mechanism is mainly based on Native Thread, Go the Coroutine is a process in their own management "Thread", so in highly concurrent scenarios, Coroutine can effectively reduce the thread context switching native heavier, thus improving concurrent processing capability.

But Coroutine achieve a lot of versions of Java are not very transparent, very many restrictions, resulting in difficult to spend Java, Java is more difficult, there are a lot of similar synchronized, all kinds of locks, BIO and other causes Native Thread directly block live place, how to make these places Coroutine transparent environment also does not block native thread, is the key issue, everyone interested can focus the next Openjdk the Project Loom, as well as Ali's AJDK Coroutine Wisp.

Guess you like

Origin www.cnblogs.com/zhazhaacmer/p/12262156.html