multithreading - When a process or thread gets blocked, does it wait forever for a notification or just sleep for a while? -


i stumbled question when reading “jvms typically implement blocking suspending blocked thread , rescheduling later” http://www.ibm.com/developerworks/java/library/j-jtp04186/?s_tact=105agx52&s_cmp=cn-a-j

when process or thread gets blocked when doing io operations (read, write) or getting access exclusive resource (lock, synchronized), when re-execute? waiting until getting notification somewhere or quit turn , run again after while?

has specified platform? os or jvm?

that devolve underlying os must provide threading support vm - has way java app can co-exist harmoniously other proceses , threads typically loaded on os - browsers, sidebars, anitvirus, video/audio players, torrent clients, os internal threads etc. etc.

the code of blocked thread gets no cpu cycles @ all. thread in state unused-for-now stack allocation , struct/class pointer in container in kernel, waiting else change state. if remains blocked or extended time, stack may swapped out on busy system.

so yes, waiting until getting notification somewhere.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -