I remember from "Linux kernel development" book that for Linux scheduler threads and process are the same (tasks) and when interrupt arrives or thread waits for something to happen scheduler pics another task to execute. I was completely unaware of thread and process context switch until I saw this question. The answer explains in good details costs of each switch, however the idea of having two type of switches is fuzzy for me.
Both types involve handing control over to the operating system
How can virtual memory space remain the same during thread switch if both switches involve handing control over to the operating system? If it remains the same and thread switch is cheaper than process switch then kernel scheduler should somehow prefer tasks which are in same process, right? Does Linux do something like this?