Q:

Why is linux boot sequence in sh and not in c

I have an embedded device which runs linux.
I'm trying to speed up the boot sequence. Would rewriting large parts of the boot sequence in C speed up a lot?
for example I have a lot of scripts which test for this or that, then mount this or that. This is /etc/rcS.d/S03sysfs
#!/bin/sh

if [ -e /proc ] && ! [ -e /proc/mounts ]; then
  mount -t proc proc /proc
fi

if [ -e /sys ] && grep -q sysfs /proc/filesystems; then
  mount sysfs /sys -t sysfs
fi

exit 0

My guess is that if it was in C, it would be much faster right?
My questions :  
Why isn't it already in C?
Would there be a speed gain to write this in C?

A:

It would be somewhat faster in C, but the language choice isn't what affects performance the most. It is usually more effective to perform various tasks in parallel, rather than waiting for each to complete sequentially as simpler init systems do. For example, sshd and httpd could be started at the same time, since neither requires the other to be already running.

There is no single "Linux boot sequence". Each distribution has its own; there isn't even a single thing they all have in common. It can be in C, Perl, Haskell, anything; the only requirement is that an executable named /init be present in the initramfs, or /sbin/init in the root filesystem.
The /etc/rc?.d scheme is simply an extension of the Unix boot process of 20 years ago, maybe even 30 years. The earliest Unix systems were rebooted fairly rarely, so they would have a simple script, /etc/rc or similar, that would be launched by init and start various daemons sequentially.
Even today SysV init is being used to start all such scripts, although the exact method may vary. Originally, a system would start all scripts in /etc/rc?.d in order; currently Debian uses Makefile-style dependencies.
Some distributions – Ubuntu, Chrome OS, Fedora up to v14 – have switched to Upstart, which is written in C and is "event-based", allowing daemons to be started in parallel. Another init system, systemd, appears to be rising quickly in popularity – it is used by default in Fedora and OpenSuSE. It is also written in C. (Both systems still read textual configuration files to decide which daemons are to be started.)

Those distributions which still stick with SysVinit usually do it for "simplicity"; the most commonly heard [citation needed] arguments appear to be about shell scripts being easier to maintain than equivalent C code (although said shell scripts consist of 90% copypasta), as well as a mortal fear of introducing additional library dependencies [subjective]. You can see for yourself in this, this, this and this discussion threads on the Debian mailing list from May 2012.
(Disclaimer: I'm a systemd user myself.)

A:

Why isn't it already in C?

For cross-platform compatibility and because it allows to use sh files to describe the boot process. Maintaining boot scripts in C would be a PITA.

Would there be a speed gain to write this in C?

Not much. While some parts would be faster, the overall speed gain would be marginal. Most of the boot process is strictly sequential, specially the steps in init 1 and 2. From init 3 and upward, the boot processes could be paralellized using something like Runit, which would get you big speed gains. 

