No, the kernel doesn't use the standard C library.
Note that the standard C library (usually glibc is the one used with Linux) is "translating" C calls to kernel syscalls. Lots of things are completely done in userland, but it is built upon the kernel. So it wouldn't be that easy to use a C library that, in binary form, could be used both on the kernel as in userland. Also, the objective of their libraries are usually quite different.
And now, the second part. Each program loads the C library itself, even if pretty much every Linux program in the system is linking to the same standard C library.
You can call grep libc /proc/self/smaps
a few times and see how libc is mapped on a different address each time (as a result of ASLR). This is in contrast to Windows, where a few libraries like kernel32.dll (the KnownDLL) are mapped on every process, at the same location, even if not explicitly loaded.
On Linux, the program (well, ld) will need to take the steps for loading libc just like every other dynamic library. Although it's true that the libc is one of the most optimized pieces of code, so that both its loading and general running is quick. Often, at a very low-level (have a look at Ulrich Drepper articles) that wouldn't be worth for normal programs.
If that's the reason the programs written in C consume less memory than other program
So no. The memory space will not consume less memory. The libc will still show the memory usage for the libc on the process.
as the standard C library is already loaded and as a result are faster also (less page faults)
It's true however that the code will already be loaded in memory, so it won't need to fetch it from disk (it is done per page, but the section of code your program needs was probably requested by a different one before).
In fact, Linux will aggressively cache the files in memory. If you have enough memory, once you load a program from disk, it will be cached in memory and it won't load again that code from the (slow) disk. Thus, you could achieve the same effect by loading them from disk in advance / having loaded them before.
compared to program written in other languages when run on a Linux machine?
It's unlikely that you might find them faster due to this small difference. More likely, I would think on the following reasons:
- Well-written C code being more efficient
- It is more low-level, this also reflects on how is C programming
- Compilers able to generate more efficient code
- libc is very highly optimized Actually, some functions are implemented in assembler.
- Most other languages are actually built upon libc, not calling the kernel themselves
It's also possible that the other languages are not really that slower. You would need to specify a pair of such programs, in order to compare them equally, and then determine if really the C version if faster, and where the difference actually lies.