I've been getting a bit interested in low level programming in the last couple of weeks. I wonder what happens to the data stored in proc registers, when the OS "decides" to switch to another task. Where is it stored?
"Where" heavily depends on underlying hardware architecture, but usually it's in main memory (RAM). For example Intel architecture has "protected mode" (available on 268+ processors) that offers hardware-level tools to handle multi-tasking; for example the task state segment (which is a main memory segment) that holds CPU registers, among other data for this task.