I would like to have a small \"application loader\" program that receives other binary application files over TCP from an external server and runs them.
I could do
Much easier than doing it is C would just to set up a tmpfs file system. You'd have all the advantages of the interface of a harddisk, from your program / server / whatever you could just do an exec. These types of virtual filesystems are quite efficient nowadays, there would be really just one copy of the executable in the page cache.
As Andy points out, for such scheme to be efficient you'd have to ensure that you don't use buffered writes to the file but that you "write" (in a broader sense) directly in place.
ftruncatemmap to obtain the addr of a bufferrecv call to write the data in placemunmap the fileexec with the filerm the file. can be done even when the executable is still running