C came out several years before dos did. I am sure that shells have been written in much the same way for many years. Your question is way too broad.
To learn about shells and just system programming in general:
http://www.amazon.com/UNIX-Systems-Prog ... 0130424110
As far as the microprocessor stuff, again, your question is kind of generic.
http://www.amazon.com/Computer-Organiza ... 0130351199
The processor has some microcoded instructions that translates electric signals but it is far more complicated than that.
There are entire classes dedicated to the topics you are asking about.