- Is it possible to write a program that can run on my computer without an operating system? What would I need to write that program, compiler-wise? Will a regular .exe run? (I don’t mean in DOS, but, say I went into the autoexec.bat and disabled the Windows startup.) - MC
Yes, it is possible. But impractical.
You would have to write the operating system as part of your program. You would have to be an expert on every single piece of hardware in your system, on a very low level. You really should be an expert on operating system design. And if you ever added or changed a piece of hardware, you’d have to rewrite the program … unless, of course, you decided to write a system that supported every piece of hardware you could ever buy (and how would you test it?).
You could in theory write it in any language, but you would probably have to do it all on another computer, because text editors and compilers cont’ include their own operating systems.
Old games (mid 1980’s, like King’s Quest) used to be available as bootable programs, kind of like what you’re talking about. It definitely can be done, but why bother? There are plenty of good, reliable operating systems to be had (you’re not locked into windows), and they do all the hard work for you.
You might want to design and build your own hardware as well since many of the problems originate there (including the firmware).
To quote the great Neal Stephenson, from In the Beginning Was the Command Line:
If you just want to get away from Windoze, Linux Mandrake 7.0 is pretty nifty.
I have a demo disk of some graphics authoring techniques that will run without an OS being loaded. You don’t even need an OS installed on your computer at all. Just insert the floppy into your Amiga’s 880K floppy drive and
…well, OK, so you don’t use an Amiga. You also weren’t that interested in graphics authoring techniques, right? Anyway, the principle should be the same.
Some 70% of embedded computers (cell phones,GPS,Automobiles etc.) operate without a commercial OS. Often this is done for reliability, performance, and size constraints. Just imagine your ABS system running Windoze ::shudder::
I like the Stephenson quote. I would note, that, in practice, engineers spend very large amounts of time arguing about what software level should provide common code for a given task, and what kind of services the common code should provide. You always get the trade off of commonality vs. control vs. expendiency - “but the KOOLTHING library doesn’t do it the way I need to … it DOES do what I need. If you implement your own mechanism, can you provide MY requirements, too, then? … can we get the KOOLTHING guys to implement the API we need? … not before their next release in December … OK, how about if I provide you wrapper functionality that extends KOOLTHING, and delegates the basic services …”.
To answer the OP some more, if you wish to contemplate the task as a pedagogical exercise on a PC class machine, you should start by reading up on how the BIOS operates, how to configure a boot record, and learn how to write interrupt handlers. If you don’t have at least passing familiarity with assembly level coding for x86 architectures, this is a prerequisite.
You would have to write “MC/OS” on some other environment like Windows or Linux to at least get to the point where you could produce a functional boot disk for your OS, and enough primitive utilities to work in that environment. In practice, if your reason for this exercise was to produce a special purpose bootable environment, like some of those game disks mentioned earlier, you would continue to develop your application in the Windows or Linux environment, and not have to provide your own programming tools.
Things like this are often referred to as “authoring” environments these days - you are working on one system to “author” an application for another system which does not provide programming tools. Sophisticated ones will completely emulate the target environment for debugging purposes. For instance, this is how you write applications for a Palm Pilot - you aren’t going to edit and debug code on the handheld device. You can get their SDK if you like, and find out how to do it.
If all programs require an OS, then, seeing as how OS’s are programs, that would be a catch-22, wouldn’t it? If you were to write a program that did not use any other OS, that would basically make it an OS itself.
Not really, TheRyan. Think of it this way. An OS is a buffer in between the hardware and software. It makes the software easier to add options too, saves a vast amout of “reinventing the wheel,” and the makes compilers vastly easier to write.
Imbeded software dosen’t use this buffer, it’s programed to work directly with the hardware.
I may not be explaining this well. Lets try anology.
I can walk or take the car to work. If I walk, I can go over rougher terrian, and take a straighter path. I also won’t have to worry about my legs bursting into flame if I trip. But it will take much longer, and plotting and navagating my route will be harder.
My car is an OS. Or it would be, if I had a car. But I really can’t claim that my legs are a car just cause they get me to work.
If I wanted to be REALLY immature, I would make lots of disparaging comments on different OS’s, by comparing them to assorted crappy cars. I could even use clever anolgies to cast indirect insults at various OS users. But I won’t, so I expect everyone else to do the same.
“Oh, no! A few of my bees are dead!”
I’ve used the Watson compiler, along with the Pharlap TNT Dos extender. That’s 10 years ago, but those tools should still work.
I think that a better comparison would be between wearing boots and going barefoot. Yes, you can go barefoot, but eventually your feet will become calloused and boot-like. An operating system is a program wchich is capable of taking instructions from another program, and sending instructions directly to the hardware. Imbeded software does the latter, and unless it’s a batch file, or very fussy about where it gets its data, it can do the former.
You’re right, that is a better anology. It works both ways, too. Someone else can use the same boots that I do, and though they might not fit quite right, they’ll get the job done, usually, and every new person who shows up won’t have to train their feet themselves.
And, I get different kinds of boots for my soft, unhardened feet, but once they’ve been hardend, it’s a lot harder.
You think the car thing was bad. My ethernet annology almost got me kicked out of a class once.
“Why dosn’t the movie just cover him with cat vomit?”