For example, a process is listening on some port with block mode, so if the I/O is not ready, the process will be blocked.
while (true)
{
msg = recv(port, BLOCKING_FLAG); // blocks here
cout<<msg<<endl;
}
We also know that we can make a process sleep: sleep(1000)
.
My question is: if such a process is blocking, can I say that the process is suspended? Will the process be swapped out from CPU? Same questions on sleep
.