In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article shows you how to use jstack with the top command to solve the problem of CPU soaring and program deadlock. The content is concise and easy to understand, which will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
Jstack:Java stack trace tool
The jstack (Stack Trace for Java) command is used to generate a thread snapshot of the current moment of the virtual machine (commonly referred to as the threaddump or javacore file). A thread snapshot is a collection of method stacks that each thread is executing in the current virtual machine. The main purpose of generating a thread snapshot is to locate the causes of thread pauses for a long time. For example, deadlocks between threads, deadloops, and long waits caused by requests for external resources are all common causes of thread pause. When a thread pauses, look at the call stack of each thread through jstack, and you can know what the unresponsive thread is doing in the background or waiting for what resources. The official document address of jstack is: https://docs.oracle.com/javase/8/docs/technotes/tools/unix/jstack.html.
Jstack command format: jstack [option] vmid
The main option options for jstack are as follows:
-F: forces the output thread stack when a normally output request is not responded.
-l: displays additional information about locks in addition to the stack.
-m: in addition to printing the java thread stack, it also outputs the native method thread stack.
Java thread state transition
Thread status description of the official website: https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/tooldescr034.html, as shown below
NEW: a thread has been created but the start method has not been called
RUNABLE: thread is executing in JVM and may be waiting for CPU time slice rotation
TIMED_WAITING: the thread waits for the specified time, usually in the sleep method, wait method, join, etc., and is waiting for time.
WAITING: threads wait indefinitely. Generally, methods such as wait,join do not specify a time.
BLOCKED: the thread is blocked waiting for the monitor lock to be acquired
TERMINATED: thread exit
About the transformation of each state of the thread, I found a picture from the Internet, which was drawn in great detail.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.