Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Can a program exist without an operating system?

  1. Feb 15, 2016 #1
    Consider the simplest possible program.
    1) Can it be created and maintained without an operating system?
    2a) If not, and if other programs exist in that system, is the first ready at all times to interact with the others - or at least some others?
    2b) If it is ready, does it need to be prompted into interacting or can it do it haphazardly?

    Note: Interaction is considered to have occurred even if only a blip occurs.

    Excuse the ignorance.
    If I am in the wrong forum or website altogether, please educate me civilly.

    Thank you.
  2. jcsd
  3. Feb 15, 2016 #2


    User Avatar
    Science Advisor

    Hey adeborts.

    To answer this you need to understand what an operating system is and typically does.

    The operating system usually provides a set of system services, basic programs (that use those services and add some extra functionality), and a software interface for developers to write programs with.

    Things like managing processes and tasks, file systems, networking, and dealing with device drivers are common elements. Nowadays, packages that allow GUI style programs and tasks are expected as well - but are not typically found in the older operating systems.

    Programs themselves have operating system as well as hardware specific data and code. While the code part can usually be run by the CPU without additional assistance, the ability to setup the hardware to run in a specific environment combined with loading data and calling operating system specific functions makes it difficult to run a program outside of the operating system.

    The way that this can be gotten around is to simulate the operating system with a virtual machine and in fact this is quite common to run old dos programs on windows and even run windows programs on a mac or within linux operating system environment.

    The operating system itself builds off basic hardware with a BIOS (Basic Input Output System) and the operating system (at its lowest level) communicates with a standard BIOS interface and runs its code to load itself into memory, communicate with hardware and do the rest.

    Programs interact with other programs across process boundaries. This is known as Inter-Process Control or IPC for short. I'll keep this simple by saying it applies to applications - not device drivers or kernel level programs.

    Not sure what you mean about interacting. The way programs work is that they execute an instruction at a time and if something needs to interrupt the flow of a program then either an interrupt is generated or some specific hardware other than the CPU handles it.

    An interrupt is a routine that interrupts the flow of instructions. Whenever a device is plugged in, a keystroke occurs, or something else with devices and low level operating system events, a little piece of code is run to deal with that.

    If an interrupt is not running then the computer just executes one instruction at a time in the order that it is in memory. It fetches the instruction, gets the rest of the information for that instruction, executes it and then repeats the process for all instructions.
  4. Feb 15, 2016 #3


    User Avatar

    The term "operating system" doesn't have any universally accepted definition. If you want a better answer than what's already been posted, you need to define your terms. The terms I am referring to are: OS, simplest, possible, program, (note the commas between those terms) maintenance, exist, system, ready, prompted and interact. And I mean in a technically acceptable and adequately specific manner. You can certainly look at DNA as "a program". Same thing with holes punched into a piece of paper (or words written in a book). So, given these (and a practically infinite number of other) examples. Can dna exist without "an operating system"? Obviously the answer is yes. So, can a book exist without anyone who can read it? Can dna exist without a cell to implement its instructions?
    I've always said that once you know the terminology of any discipline, you're 90% of the way to having a preliminary knowledge of it. In the days of the first chips, and electic circuits with memory, there was no (soft, nor firm) operating system. The voltages went in through the op-amps and you got output of some sort (a switch was toggled, a light lit, etc.). It isn't unusual for questions to be asked without context which require context to be answered. In a modern computer, the OS is a (group of) program(s). As long as some method exists to input instructions (code) into a device (system) capable of changing state, you have the ability to input "a program". But that is typically useless without one or (usually) more methods to recieve output (determine what the 'final' state configuration is).
    Programs don't "interact" unless they are instructed to (or unless they interact with the OS (or hardware) which in turn may interact with other programs). A typical (modern) computer "system" consists of one or more cpu's, volatile working memory, various other chips (graphics, audio, ports, interrupts, etc.) and one or more storage devices as well as connections to the internet. I don't really understand your question 2. Are you suggesting that there is some magic genie capable of randomly recognizing a string of zeros and ones as "a program" and then loading it so that the cpu (etc.) can run it? Some programs reside in working memory, but generally working memory is volatile (meaning power to it needs to be maintained), fast but volatile. These programs may be loaded into working memory from hardware or much more commonly from storage (one of the functions of the OS is to bootstrap itself (using hardware) and then load all of the other junk (often in a cascading fashion). Nothing is "instantaneous", logic switching requires clock cycles and voltage changes. So what you mean by "residing" in the system isn't clear to me. If you compare the speed of cpu register operations to the speed of accessing working memory and then to the much much much much much slower access of storage, then you will realize that one function of any modern OS is to manage the flow of information thru the system so that you don't perceive the delays and laggy behavior which would be quite annoying in a linear "wait until you need it, then load it" system. Obviously a modern OS is so complex that no one person can (imho) understand it all.
  5. Feb 16, 2016 #4


    User Avatar
    Science Advisor

    1) Yes. Example: A microcontroller inside a washing machine has no operating system
    2a) No. What the CPU is doing is at all times controlled by the startup program (all microprocessors/microcontrollers are hardwired to fetch an instruction ( or a pointer to an instruction) at a specified memory address after the CPU leaves the reset state).
    2b) No. See answer above for an explanation of what happens when the CPU starts executing.
  6. Feb 16, 2016 #5


    User Avatar

    Staff: Mentor

    Which is....?
    More than forty years ago, when I was an undergraduate, I programmed a Digital Equipment PDP-5 that had no operating system at all. After I turned the power on, I had to enter a program via binary toggle switches on the front panel. Usually this was a program that read another program via paper tape on a teletype terminal, and executed it.


    Or I could have entered a program that did something like add 5 + 3 and display the results (in binary notation) on the lights on the console.

    Or do you mean something a bit more modern? :biggrin:
  7. Feb 16, 2016 #6
    I think it sort of starts like these ...

    then , I think processors are like some sort of program counters doing some Boolean logic ...

    you can already call that a computer ??
  8. Feb 16, 2016 #7


    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    In answer to 1 you could write and maintain code on a piece of paper. You couldn't fully test it or run it, but it would still exist. Like a piece of music exists on a score. You don't need an orchestra for the music to exist.
  9. Feb 16, 2016 #8
    Yes because there is no computer without a processor.
    Today computers include more than just processors but studying about computers tends to get started with learning about basic low-level processors and their instructions.
    Before people had defined what an OS was, how had they done to store and retrieve information on and from what media ? jtbell already offers you an example as above, it should have been a great deal of work done until people could finally group and build up all complex tasks with respect to simple dull and large chunks of media into most common elements as specified in chiro's post.
    So an OS is simply a special software, which is mainly used to help enhance user-computer interactions, and without which would not change the definition of a computer at all.
  10. Feb 17, 2016 #9


    User Avatar

    Staff: Mentor

    If my recollection of 6502 microcomputer boards is correct, the rudimentary higher level functions that allowed the user to setup/debug/edit/run/etc code was termed the monitor.
  11. Feb 17, 2016 #10
    An operating system is itself a program.
    It''s purpose is to manage all of the hardware resources available and allocate them as required by other programs, (application software, or 'apps')
    It also provides substantial libraries of commonly used routines that these apps can call upon so these routines don't need to be re-written for every case.
    This is enormously useful for machines running multiple applications.
    However a simple machine that only ever performs a single task does not need this and the code for that task certainly can be implemented without an OS.
  12. Feb 17, 2016 #11


    User Avatar
    Gold Member

    DSP's are computers that have no operating system but run specific tasks (programs). Programming them requires the use of a computer that DOES have an operating system but once the program is created into a memory chip, the DSP will run it with no O.S.

    Like jtbell I started out with a mini-computer that had to be programmed through the front panel, every time it was turned on, to read in other programs such as editor, assembler, loader, etc.
  13. Feb 17, 2016 #12

    jim mcnamara

    User Avatar

    Staff: Mentor

    You forgot to mention - paper tape. My nemesis. PDP straight 8.

    I'm not sure the original question has the meaning we are all using. I think the OP wants to know if there is/was an all-in-one-program that did everything about booting I/O facilities, etc., link edit and so on as part of the base program code. I don't know for sure but it seems unlikely because how would the code get itself read into memory? without some I/O code help. Some prom-based systems later on did that. i.e., there was hardwired code in there at power up.

    Answers maybe:
    1. No
    2a. yes
    2b. not haphazardly, on purpose, by design. Or as some folks say: 'automagically'
  14. Feb 17, 2016 #13


    Staff: Mentor

    Based on the OP's question and a follow-on question from the OP that is now deleted (as it was completely unrelated to computer science), I'm going to declare that the question has been asked and answered, and am locking this thread.
    Last edited: Feb 17, 2016
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook