Runnable Thread State when making blocking system calls

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Runnable Thread State when making blocking system calls

JSR166 Concurrency mailing list

I would like to know why the thread state is shown as Runnable when making a blocking system call such as readByte();  which in turn calls read() on a Linux system. 
Does a Runnable state consume cpu cycles while blocking on system call?


"pool-9-thread-1" - Thread t@49
   java.lang.Thread.State: RUNNABLE
        at java.io.FileInputStream.readBytes(Native Method)
        at java.io.FileInputStream.read(FileInputStream.java:255)
        at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
        at java.io.BufferedInputStream.read1(BufferedInputStream.java:286)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
        at java.io.FilterInputStream.read(FilterInputStream.java:107)
          ...
          ....
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)

   Locked ownable synchronizers:
        - None


_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: Runnable Thread State when making blocking system calls

JSR166 Concurrency mailing list

Hi George,

 

The Java Thread state does not track arbitrary blocking operations, only those related to monitors and sleep (and related j.u.c utilities). Blocking I/O is not covered.

 

If the thread is blocked on a system call it is blocked – it uses as much CPU as the system call logic dictates.

 

David

 

From: Concurrency-interest <[hidden email]> On Behalf Of George Monet via Concurrency-interest
Sent: Wednesday, December 19, 2018 8:38 AM
To: [hidden email]
Subject: [concurrency-interest] Runnable Thread State when making blocking system calls

 

 

I would like to know why the thread state is shown as Runnable when making a blocking system call such as readByte();  which in turn calls read() on a Linux system. 

Does a Runnable state consume cpu cycles while blocking on system call?

 

 

"pool-9-thread-1" - Thread t@49

   java.lang.Thread.State: RUNNABLE

        at java.io.FileInputStream.readBytes(Native Method)

        at java.io.FileInputStream.read(FileInputStream.java:255)

        at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)

        at java.io.BufferedInputStream.read1(BufferedInputStream.java:286)

        at java.io.BufferedInputStream.read(BufferedInputStream.java:345)

        at java.io.FilterInputStream.read(FilterInputStream.java:107)

          ...

          ....

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

        at java.lang.Thread.run(Thread.java:748)

 

   Locked ownable synchronizers:

        - None

 


_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest