January 15th, 2013, 10:38 PM
Context Switching In Operating System
Process A with its address space and stack is currently being executed by the CPU and there is a system call to jump to a higher priority process B; the CPU needs to remember the current state of the process A so that it can suspend its operation, begin executing the new process B and when done, return to its previously executing process A.
Now ,, let us suppose Process A is an audio file and Process B is some other file say a word file ,,
When there is a system call to jump to Process B ,,the process A is suspended !
Then how our audio file keeps playing even of suspending the process ???
January 15th, 2013, 11:08 PM
Buffering. Process A has buffered the audio output so unless process B deadlocks the system for a while there'll be enough time for A to continue where it left off before the buffer empties.
 Fun fact: my work laptop is just barely capable of letting me work and the hard drive is probably on its last legs, so when I listen to YouTube and try something strenuous it can lock up for a second or two until it finishes. During that time the audio buffer will completely flush and I'll get hiccups.
Last edited by requinix; January 16th, 2013 at 08:26 PM.