Thread blockage
Why do thread block in Input/output?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sam HobbsPosted Dec 28, 2011, 8:36 PM
IO takes time. For disk drives, the computer has to wait for the data to betransfered from the disk controller to computer memory. That does not take much time but it takes more time for the disk drive to wait for the hard drive platters to spin around to the data. If the hard drive needs to seek, then it takes much more time for the drive to move the readwrite heads to the location on the hard drive platters where the data is. The computer can do many things very quickly and a disk drive is very, very slow in comparison. The computer can go as fast as a jet plane compared to a car on the ground. A jet plane has to wait for the paseengers in cars to get to the airport. Threads in computers are sometimes like that.
Chintan RathodPosted Dec 28, 2011, 1:19 PM
A thread is a thread of execution in a program. The Java Virtual Machine allows an application to have multiple threads of execution running concurrently.
Every thread has a priority. Threads with higher priority are executed in preference to threads with lower priority.So, while any higher priority thread is running and it requires any input from the user or need to generate an output to the screen. At that time what happen, until input is not given from the user, thread is not capable to go ahead because of the inputted data. Same in output also, until processor finishes operation of the output, it will no go on further process.
So, as the priority of the thread, it is feasible to put that thread in block state, because it is doing nothing at that time, and utilize other threads which are running concurrently.
Thank you.