patternMinor
How does a computer play a video while doing something else?
Viewed 0 times
whileelsedoingvideoplaycomputerdoeshowsomething
Problem
How is video playback done on a computer? It's obviously not relying purely on the CPU, since video playback continues when a user performs another activity, such as typing into a YouTube comment field. This task seems further complicated in the case of streaming video, where data presumably needs to be transferred from the network interface to the video/graphics controller.
EDIT: I should have made clear that I understand that the CPU switches among multiple processes and threads all of the time. My question was meant to be more specifically about video playback. Is the video processing done on the graphics chipset/card? Do those typically offer buffering? Or can it all be handled by a single-core CPU with time to spare for other tasks, or am I wrong to think that low-end CPUs can play back video without (not-network) delays?
EDIT: I should have made clear that I understand that the CPU switches among multiple processes and threads all of the time. My question was meant to be more specifically about video playback. Is the video processing done on the graphics chipset/card? Do those typically offer buffering? Or can it all be handled by a single-core CPU with time to spare for other tasks, or am I wrong to think that low-end CPUs can play back video without (not-network) delays?
Solution
This is implemented using several different techniques. Within the application (for example, the web browser), the program can execute different threads of execution. One thread can perform the video streaming/playback, while a different thread can handle the user typing into the comment field.
These threads, along with many other threads and processes, are in turn scheduled by the operating system (even if you only have the web browser open, the operating system has many background tasks running, such as the windowing manager, the print spooler, the USB device manager, etc). It is the job of the OS scheduler to determine which thread can actively run, on which processor core, and for how long. In a typical system, a thread can run for up to some threshold value, suppose 100 milliseconds, before the scheduler allows another task to run.
This task switching is fundamental to all modern operating systems (Windows, Linux, UNIX, etc), and is usually a significant portion of an undergraduate operating systems course.
These threads, along with many other threads and processes, are in turn scheduled by the operating system (even if you only have the web browser open, the operating system has many background tasks running, such as the windowing manager, the print spooler, the USB device manager, etc). It is the job of the OS scheduler to determine which thread can actively run, on which processor core, and for how long. In a typical system, a thread can run for up to some threshold value, suppose 100 milliseconds, before the scheduler allows another task to run.
This task switching is fundamental to all modern operating systems (Windows, Linux, UNIX, etc), and is usually a significant portion of an undergraduate operating systems course.
Context
StackExchange Computer Science Q#29673, answer score: 3
Revisions (0)
No revisions yet.