Does a process waiting on a network response take cpu/ram resources?

176 Views Asked by At

For example, a Ruby script that sends an HTTP GET request. Whilst waiting/receiving the response, is that process using CPU or RAM resources?

If the response takes 500ms, does that mean thats 500ms CPU/RAM is taken and cannot be used? Or does the process go into a kind of "sleep" state until the request is received, freeing up resources in the mean time?

1

There are 1 best solutions below

0
On

It doesn't consume your CPU but it will not free the memory that is already allocated. It will just wait (sleep) till the data is available.