6

How a computer can be used when there is no operating system?

What tools or knowledge do I need to do it?

Do I have to give all the commands in binary to use computer hardware resources like a monitor?

  • 3
  • 3
    Try to program a microcontroller (e.g., any Arduino board). – SK-logic Jul 15 '14 at 8:32
  • 1
    Study several free software operating systems (Linux, Hurd, ...) so look inside their source code. See also osdev.org and read the Operating System wikipage. – Basile Starynkevitch Jul 15 '14 at 10:24
  • 3
    An operating system is basically just a library/application like any other application. An OS is not necessary to control computer hardware but it makes life sooooooo much easier for developers. PIC Microchips are just CPUs that hobbyists (and quite a few companies) use for electronic applications. For most of the chips, you can at best, find libraries out there which implement OS-like functionality. But typically, almost everyone just programs them using very low level C. No need for an OS. – Dunk Jul 15 '14 at 14:25
  • @Dunk: I very much like your first sentence. Some people make it sound like operating systems are magical creatures that escape comprehending by mere mortals. They are not. My favorite definition of operating system is by Dan Ingalls in the Design Principles Behind Smalltalk: "An operating system is a collection of things that don't fit into a language. There shouldn't be one." – Jörg W Mittag Jul 15 '14 at 23:35
8

In case of no operating system you have to program the processor directly using a language it understands. This doesn't mean the CPU only, but others as well, like graphics card processors, sound card processors, etc. Each processor has some kind of basic language it can understand called an instruction set. Instruction sets vary between processor models and consist of memory addressing, flow control, logic and arithmetic instructions. Higher level operations are made up from these basic instructions. The code written using instruction sets is called a machine code.

From there you get to assembly languages, which are again specific for a given processor architecture and usually map strongly to processor instructions. These make writing the code easier for humans and are already considered programming languages, albeit low-level. Assembly code gets translated to machine using an assembler.

So these two are what you need to know to start programming computers directly. Learn the instruction set and assembly language of the specific processors at hand and how to build meaningful operations using these basic instructions. You can build some complex stuff using an assembly alone, including graphics programs, e.g. see http://www.floodyberry.com/asm_toys/.

From there it starts to get wrapped up in layers, all of which provide abstractions and APIs over the lower level: higher level languages, drivers, kernels, OSs and frameworks all the way up to client applications. All of this higher level code translates to machine code in the end, using compilers and interpreters, so that the processor can understand what to do.

| improve this answer | |
  • 1
    You kind of mention it, but most people would use C over assembly language. If a company makes CPU-like chips then it becomes imperative that they provide a C compiler that supports their chip in order to get people to buy the chip. – Dunk Jul 15 '14 at 14:31
  • Pardon me, but I don't understand what an OS has to do with a programming language. I've programmed embedded systems in C with and without an operating system. Same with assembly language. So, is it possible to program a processor directly with an OS? (We are presently doing this on our embedded system). – Thomas Matthews Jul 15 '14 at 23:52
  • @famousgarkin, (assuming there is not a os or any bios) you mean that if i have a exe file that print hello world on screen then i would have to start computer, give processor a binary command(according to its instruction set) to jump to the specific memory location where the exe file is stored on the hard drive and load it to main memory, execute it and then use the video graphics to print the output on the screen , and finally i would see "hello world". – abhishek Jul 16 '14 at 8:52
1

It is possible to write code without any OS, put it on hard drive, optical drive or USB drive, at specific address and run it. It's also possible to run such code from the network (network boot option).

Also it is possible to run code like an extension BIOS, well, in fact CPU juts jumps to user code and neither BIOS nor OS works but user code does.

Here are examples of some Russian security PCI boards, which run its own program before any OS can take a control. The boards, shortly, serve for indentfication and authentication users and run graphical interfaces, can operate with file systems, etc.

enter image description here

enter image description here enter image description here

| improve this answer | |
  • 1
    thanx for mentioning network booting – abhishek Jul 16 '14 at 8:57
1

Computers don't need operating systems, regardless of language. (Computers run on native code whether an operating system exists or not.)

In embedded systems, there are two fundamental models: 1) Work completes in an interrupt and the remaining time is in a background loop. 2) Work completes in the background loop and interrupts are used for quick activities (such as incrementing timers and I/O).

There are cases where a processor executes code in its {read-only} memory, then shuts down.

Remember that Desktop PCs are not the only computers. Microwave ovens, dishwashers and TV remotes all have computers in them; as well as modern cars. Some platforms are too small to consider an operating system (like a microwave oven or dishwasher), while larger ones have Real-Time Operating Systems (RTOS) like printers and automobiles.

As far as tools go, you need a build system that can take a language and compile it to the processor of the target system. You need to somehow get that executable into the platform. A "remote" debugger would also be helpful. These are the basic tools. You can find them in a single IDE or your can get different pieces from different vendors. In general, your tools depend on the target processor. If your target platform is a PIC controller, then an IDE that builds programs for a Pentium processor is of no use to you.

Commands to the debugger or monitor in binary are ancient school. Most "monitors" take commands through a terminal port and often include a "help" sections for when you forget the command list or syntax. In modern times, binary is primarily used for setting and clearing bits in hardware registers or fields in tightly packed protocols. Binary is not friendly and not efficient. So in times of needing to produce code efficiently, binary has been pushed aside.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.