Everyone knows that if you buy a computer you should install an operating system. 20 years ago, it was DOS, today it is windows. My questions are : how the computer knows how to install them if it has no compiler yet (a computer knows only mashine language, zero and one)? is there a compiler in these programs? and if so, how do i do the same to my programs i have written in c language? how do i write a program in c language that would be on CD, and when i insert the CD into the computer without an operating system it will prints "hello world"? in what language did they write these operating system?
You should have something at the place where computer (BIOS) start i.e. at the address 0 to load the loader which will load the OS (Your program.)
you answered my question about operating system, but i did not understand it. please explain more. i know c language, and i have microsoft visual c++ if it helps.
The computer usually does not know or care what os you are running. All it knows is to test the bios and then following the bios test called POST it will check and see what device you have set to boot first and try that device. Each device capable of booting has information in the bootsector of the device which tells it where to get information for the MFT or Master File Table and read the first sector in the MFT. From there the software takes over and does what it is supposed to do (sometimes) and boots according to it's program.. here is a great example of an open source operating system. http://www.freedos.org/