Thin wrapper over OS threads Ø One-to-one mapping with OS threads Ø Thread pools Virtual Threads Virtual Threads: Ø Lightweight user threads Ø Highly scalable Ø No need for pooling
thread cannot be unmounted from the carrier thread. Ø It happens when: Ø Virtual thread is executing a synchronized code-block/ method or Ø Virtual thread is executing a native call Ø In case of ‘synchronized’ Ø Problem if you’re doing long-running/ blocking operations inside synchronized Ø Use ReentrantLock Ø In future, this may not pin the virtual thread
to the JVM Ø Many commands are available Ø JFR Ø Garbage collection Ø JVM Ø Must be used on the same machine where the JVM is running Ø Usage: Ø New: Thread dump in JSON format jcmd <process id/main class> <command> [options] jcmd <process id/main class> Thread.dump_to_file –format=json <file>
built into the Java Runtime. Ø It gathers detailed low-level information about how a JVM or a Java application is behaving. Ø It maintains low overhead (< 1%). Ø Data is continuously recorded, optionally written to disk. Ø It records data about JVM events. Ø Types of events: Ø Duration events Ø Instant events Ø Sample events Ø Custom events
JVM applications Ø Gives a lot of info including CPU usage, Memory usage, Threads and MBeans Ø You can also run jcmd commands from JMC Ø Views: Ø MBean Server: Info from JMX (Java Management Extension) Ø JDK Flight Recorder Ø Plug-ins
about Java applications Ø Connects with local and remote applications. Ø Provides info about CPU usage, Memory usage, Threads, Classes etc. Ø In terms of features quite similar to JMC
and provide lots of info with low overhead Ø jcmd is quite useful for creating/managing recordings and for other diagnostics Ø JMC and VisualVM are feature rich and provide visual interface Ø Virtual thread support Ø 4 new events in JFR Ø Thread dump in JSON format via jcmd Ø JFR and jcmd are available as part of JDK. JMC and VisualVM are available externally.