As I understand it, running processes (and drivers etc) get put into a wait queue when they need to wait for a resource that may not be available yet. I know this can be done by manually invoking the kernel and putting yourself into the wait queue until the resource becomes available.

So my question is: Are any processes ever put into the wait queue without the code explicitly entering itself into it? And, if so, how does the kernel determine that the process actually needs to be put into the wait queue or wants to wait on a resource instead of continuing execution without it etc?

Mainly asking in relation to linux, but if something similar is done in some other kernel/operating system I would be equally interested in knowing how.