Linux ps state SL +

Source: Internet
Author: User

Below is a piece of Java code,

Public Class Z

{
Public static void main (string [] ARGs)
{
New Z ();
}
Private Z ()
{
Z a1 = this;
Z a2 = this;
Synchronized (A1)

{

Try

{
A2.wait ();
System. Out. println ("done waiting ");
}
Catch (interruptedexception E)
{
System. Out. println ("interruptedexception ");
}
Catch (exception E)
{
System. Out. println ("exception ");
}
Finally
{
System. Out. println ("finally ");
}
}
System. Out. println ("all done ");
}

}


Compile and run

Java Z

Without any output, the program will not end.


PS looked at the status and found that the status is SL +,

In Linux, the status is as follows:

D. uninterruptible sleep (usually Io) cannot be interrupted)
R is running or a process in the queue
S is in sleep state
T stop or be tracked
Z botnets
W enters the memory switch (it is invalid from kernel 2.6)
X Dead Process

<High priority
N Low priority
L some pages are locked into memory
S contains sub-Processes
+ Process group in the background
L multi-thread, clone thread


Based on the above information, we know that it is in sleep state, multithreading, and background process.

We know that in Java,

Wait (): puts the thread in the waiting state. The thread releases the lock. And stored in the thread pool.
Y (): it is usually used to wake up the first thread in the thread pool.
Yyall (): wake up all the waiting threads in the thread pool.

So when wait is running, this thread waits for other threads to sleep, so it is in sleep state.

Reprinted please indicate the source:

Original article: http://blog.csdn.net/hongchangfirst/article/details/8650628

Author: hongchangfirst



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.