While researching efficient methods of storing large numbers of images on my server, I came across this post detailing the process of returning an image from a mysql server. The process described is common, except that it is inspected at a much lower level, complete with mode switching between kernel and user on a linux server:
Your systems network buffer fills with a new packet containing a new request from the network card. The system delivers the packet to your Apache, switching from kernel mode into user mode.
Apache processes the packet, handing it internally to its mod_php for processing. The mod_php parses the request, constructing a SQL query for the image blob, and pushes the SQL query into a kernel buffer, switching from user mode into kernel mode.
Check out the full post at http://mysqldump.azundris.com/archives/36-Serving-Images-From-A-Database.html