Author Topic: PC running software without OS  (Read 4474 times)

0 Members and 2 Guests are viewing this topic.

Offline CirclotronTopic starter

  • Super Contributor
  • ***
  • Posts: 3307
  • Country: au
PC running software without OS
« on: March 08, 2018, 01:54:37 am »
Does anyone know of any PC software that would boot into itself without a separate operating system? Would probably have to be machine-specific but the idea is to get the absolute maximum performance from the hardware without the overhead of an OS limiting what you can do, slowing things down and generally getting in the way. Possibly similar to late '70s arcade game machines but on a larger scale.
 

Offline Ampera

  • Super Contributor
  • ***
  • Posts: 2578
  • Country: us
    • Ampera's Forums
Re: PC running software without OS
« Reply #1 on: March 08, 2018, 02:14:13 am »
Of course this exists, and for most intents and purposes, this is effectively how many programs ran on MS-DOS, with DOS just being effectively TSR (Terminated, but Staying (memory) Resident). There were also PC booter programs, the most notable ones to come to mind being PC-MAN and I believe Paratrooper, but there are reasons why it's not done today.

1. Nobody knows how to anymore. It's a GREAT level of complication to get something like this working, and while there are people who indeed still do this to some degree, they rarely start from scratch.

2. You can't multitask without other programs to multitask with. Modern workloads rely on being able to switch between programs. If you can't do that, it's useless to many people.

3. It's pointless. The overhead modern operating systems put in place, combined with things like many modern high performance applications being resigned to the GPU, and the fact that CPUs aren't harping over every instruction anymore, it just doesn't make sense to put so much extra effort into what may even end up not being a performance gain at all, due to the MASSIVE number of memory management and task management optimizations in modern kernels like Linux, Unix, and NT. It's just not worth it.

Besides this, this is how many microcontrollers run, especially when you use something like C or ASM. The code is just plopped onto the CPU, and ran like that, as an OS is normally a bit overkill for the task at hand.
I forget who I am sometimes, but then I remember that it's probably not worth remembering.
EEVBlog IRC Admin - Join us on irc.austnet.org #eevblog
 

Offline j_hallows

  • Newbie
  • Posts: 8
Re: PC running software without OS
« Reply #2 on: March 08, 2018, 02:41:24 am »
When you say PC, I assume X86 architecture.  You want some sort of romable code. Check out Paradigm C++ (http://www.paradigmtools.com/). There were other tools and I believe GCC can compile romable code.

 

Offline IanB

  • Super Contributor
  • ***
  • Posts: 12302
  • Country: us
Re: PC running software without OS
« Reply #3 on: March 08, 2018, 02:50:22 am »
Does anyone know of any PC software that would boot into itself without a separate operating system? Would probably have to be machine-specific but the idea is to get the absolute maximum performance from the hardware without the overhead of an OS limiting what you can do, slowing things down and generally getting in the way. Possibly similar to late '70s arcade game machines but on a larger scale.

The simplest answer to your question is any flavour of DOS. Find some version of DOS, free or commercial, boot into it, and you own the machine. Any program you run under DOS has unrestricted access to the hardware with no impediments.

If you really want to go hardcore, find the source code for a public/open source version of DOS or other similar program like CP/M, modify it and build your own thing that boots up directly from disk.

Unfortunately, you will have a really hard time getting the maximum performance out of the hardware if you do this since you won't have all the special optimized drivers for the graphics card and disk drives.
 

Offline CirclotronTopic starter

  • Super Contributor
  • ***
  • Posts: 3307
  • Country: au
Re: PC running software without OS
« Reply #4 on: March 08, 2018, 03:00:25 am »
I was just thinking of the whole pc behaving like a super duty microcontroller. I haven’t got an application, just a thought experiment. I didn’t think that DOS quite worked that way. I thought the program often told DOS to execute this or that interrupt or write to the disk or whatever and DOS handled all the dirty work. The program just did high level stuff and DOS translated it to the nitty gritty of what sector to read or what pixel to write.
 

Offline IanB

  • Super Contributor
  • ***
  • Posts: 12302
  • Country: us
Re: PC running software without OS
« Reply #5 on: March 08, 2018, 03:59:17 am »
I was just thinking of the whole pc behaving like a super duty microcontroller. I haven’t got an application, just a thought experiment. I didn’t think that DOS quite worked that way. I thought the program often told DOS to execute this or that interrupt or write to the disk or whatever and DOS handled all the dirty work. The program just did high level stuff and DOS translated it to the nitty gritty of what sector to read or what pixel to write.

No, it's not that way at all. DOS is able to load your program into memory and start it running. Then while your program is running DOS provides service calls that you can use for convenience if you wish. However, you don't have to use the DOS service calls (or even the BIOS calls) if you don't want to. Other than the BIOS, DOS provides no hardware abstraction layer. Your program runs in real mode (not protected mode) and all of the hardware is accessible at the register level. Your program can do what it likes.

Of course normal, well-behaved DOS programs obey the rules and work cooperatively with the system. But they really don't have to.

The lack of restrictions is how programs like DESQview were able to do really clever stuff.
 

Online hendorog

  • Super Contributor
  • ***
  • Posts: 1627
  • Country: nz
Re: PC running software without OS
« Reply #6 on: March 08, 2018, 04:02:00 am »
There was a version of Java which could run on the bare metal. But I think it got killed by Oracle.

The concept has some merit, particularly in the VM space, where one (Server) application runs on one VM. The OS adds little or no value, and is just another thing that has to be deployed and configured.
 
A VM presents standard hardware to the guest so the driver problem is not as difficult as it would be with real hardware.
 

Offline daybyter

  • Frequent Contributor
  • **
  • Posts: 397
  • Country: de
Re: PC running software without OS
« Reply #7 on: March 08, 2018, 04:04:08 am »
Back in the 8088 days, there were bootable games.
Today you might find similar concepts in the fpga area. In fact I'm working on a bootloader at the moment. It is great fun on the one hand, but slow progress on the other.
 

Offline CatalinaWOW

  • Super Contributor
  • ***
  • Posts: 5419
  • Country: us
Re: PC running software without OS
« Reply #8 on: March 08, 2018, 04:07:39 am »
The only tighter you can get than DOS is to eliminate the unused functions.  Perhaps file io.  Or serial ports or whatever.  The difference wouldn't be worth the effort, but if you were really motivated I believe that source code for DOS clones is available.
 

Offline IanB

  • Super Contributor
  • ***
  • Posts: 12302
  • Country: us
Re: PC running software without OS
« Reply #9 on: March 08, 2018, 04:07:53 am »
A further thought about the microcontroller concept. Get hold of an old PC from simpler times, something with serial and parallel ports, an ISA bus, and some suitable I/O cards, then install DOS and a C compiler from the same era, and yes, you can treat it like a giant microcontroller with a native development environment. You can write programs that address the hardware natively and do low level I/O. You can directly program and use hardware interrupts to help.
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: PC running software without OS
« Reply #10 on: March 08, 2018, 04:10:01 am »
Bootable games were somewhat common in the PC/XT days, and far more common on slightly earlier 8-bit computers but the problem with anything like that is it has to be tailored to the exact hardware it's running on.

Classic arcade games are a different sort of thing entirely, they used dedicated hardware rather than a general purpose computer. The program code and graphic objects are stored in ROM addressed by the CPU and video hardware.
 

Offline CirclotronTopic starter

  • Super Contributor
  • ***
  • Posts: 3307
  • Country: au
Re: PC running software without OS
« Reply #11 on: March 08, 2018, 06:12:42 am »
Is there nowadays a 32 bit DOS that in particular uses a flat memory space?
 

Offline @rt

  • Super Contributor
  • ***
  • Posts: 1069
Re: PC running software without OS
« Reply #12 on: March 08, 2018, 08:55:49 am »
I’d have imagined that every Windows installer has to first boot a program that isn’t an OS,
albeit low res graphics and maybe beeps for sound, but it occurs to me that every PC clone has some compatible mode that can run an OS installer.
 

Offline Ampera

  • Super Contributor
  • ***
  • Posts: 2578
  • Country: us
    • Ampera's Forums
Re: PC running software without OS
« Reply #13 on: March 08, 2018, 09:31:29 am »
I’d have imagined that every Windows installer has to first boot a program that isn’t an OS,
albeit low res graphics and maybe beeps for sound, but it occurs to me that every PC clone has some compatible mode that can run an OS installer.

Until, I believe, Vista, Windows Setup started up in what I think was a special DOS environment that loaded drivers and prepared to launch the NT Kernel. This is still an operating system as it still provides base disk functionality as well as the ability to load drivers, although the question "what is an operating system", may be blurred here. Nowadays, an OS called Windows PE (Preinstallation Environment) which is effectively a stripped down NT kernel, similar to how some POSIX operating systems run installers. It loads drivers, deals with drives, and installs Windows, after which it reboots into the full installed NT Kernel.
I forget who I am sometimes, but then I remember that it's probably not worth remembering.
EEVBlog IRC Admin - Join us on irc.austnet.org #eevblog
 

Offline Ash

  • Regular Contributor
  • *
  • Posts: 161
  • Country: au
Re: PC running software without OS
« Reply #14 on: March 08, 2018, 09:56:35 am »
Hi,

There are a number of "bare metal" systems for different programming languages. Most of them are designed at the moment to target a virtual machine, but conceptually you would just need to implement your own driver level code for other hardware.

The idea being that when you want to run a workload that does only one thing, you don't need a full operating system to do traditional things like separating applications, memory management, etc. I'm thinking things like web servers, caches, micro-services. A lot of this is currently done in containerised environments like docker as well. Just another approach I guess.

Here are two that I know of:

https://www.gocosmos.org/ - Cosmos - C# operating system
http://www.includeos.org/ - a C++ "#include <os>"

Ash.
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19875
  • Country: gb
  • 0999
Re: PC running software without OS
« Reply #15 on: March 08, 2018, 10:40:59 am »
Is there nowadays a 32 bit DOS that in particular uses a flat memory space?
Yes.

DOS + a DOS extender. The main program is run in 32-bit protective mode, switching back to 16-bit mode, when a DOS call is made. This does involve some overhead, but is negligible for things such as disk access, as the hard drive is the biggest bottleneck. This was very popular for later DOS games.

FreeDOS-32. A 32-bit protective mode DOS. It appears to be incomplete and no longer developed though.
http://freedos-32.sourceforge.net/
 

Offline capt bullshot

  • Super Contributor
  • ***
  • Posts: 3033
  • Country: de
    • Mostly useless stuff, but nice to have: wunderkis.de
Re: PC running software without OS
« Reply #16 on: March 08, 2018, 10:46:33 am »
In former times I did such things on a 486 based hardware:
For ease of use, the machine booted into MS-DOS (just to not to have to cope with all the BIOS / low level initialization stuff)), then ran a single program (using the Watcom 32bit extender) that never returned and never made any calls to the underlying MS-DOS / BIOS.
Safety devices hinder evolution
 

Offline TerraHertz

  • Super Contributor
  • ***
  • Posts: 3958
  • Country: au
  • Why shouldn't we question everything?
    • It's not really a Blog
Re: PC running software without OS
« Reply #17 on: March 08, 2018, 11:04:11 am »
The problem is, good luck getting info on how to configure and drive the hardware in a recent PC. The available driver code is all designed to run in a Windows environment, or Linux. With DOS you're going to be stuck with old PCs.
Collecting old scopes, logic analyzers, and unfinished projects. http://everist.org
 

Offline Ampera

  • Super Contributor
  • ***
  • Posts: 2578
  • Country: us
    • Ampera's Forums
Re: PC running software without OS
« Reply #18 on: March 08, 2018, 11:06:43 am »
The problem is, good luck getting info on how to configure and drive the hardware in a recent PC. The available driver code is all designed to run in a Windows environment, or Linux. With DOS you're going to be stuck with old PCs.

Getting things like video is never going to be 100%, but things like USB, hard drive access, and even video to a large degree is all possible using a bunch of BIOS calls.
I forget who I am sometimes, but then I remember that it's probably not worth remembering.
EEVBlog IRC Admin - Join us on irc.austnet.org #eevblog
 

Offline senso

  • Frequent Contributor
  • **
  • Posts: 951
  • Country: pt
    • My AVR tutorials
Re: PC running software without OS
« Reply #19 on: March 08, 2018, 11:48:54 am »
What kind of usage do you expect to get out of such a system?

Also, what kind of hardware are you running?

Windows or linux never got in my path for max performance out of my hardware, I'm running ancient parts considered to the current gen, but my Haswell i7 laptops can chew throw anything that I throw at them...

Running a bare metal "OS", would let me print on a console and not really do any real world work.

Are you intending to develop software to make such a thing usable?
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22307
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: PC running software without OS
« Reply #20 on: March 08, 2018, 12:32:13 pm »
You only need DOS to do disk things.  It's a Disk Operating System, obviously enough. ;D

If you don't need a file system, you can write your program or bootstrap into sector 0 of the disk, and go from there.  You are still using another operating system, the BIOS, in this case.  Typically int, uh... 13h for disk access (read sector and such)?  The BIOS reads the boot sector into RAM at 0070:0000h, checks for validity, then jumps into it.  From there, you need to read more sectors (if 512 bytes is not enough) into whatever memory you like.

If you want bare bare metal, you have to put your program on a ROM on an expansion card, and have it mapped to a suitable location (usually 8k at C8000h or so; there's a map of usable locations).  The CPU still starts in the system BIOS, but it jumps into your ROM during initialization, and everything is yours at that point, no disks needed.

If you well and truly want everything to yourself, you must replace the system ROM, which might not always be doable (though it's almost always EPROM or Flash in a socket, which is nice).  In that case, the CPU resets to F000:FFF0h or something like that, and the rest is yours.  Just don't forget to initialize the DMA and PIT, or the RAM will be very forgetful.  And set the graphics registers to something sensible (or jump into the video BIOS to do it for you), and the PIC and so on... ;D

Classic IBM PC hardware is quite well documented, but proprietary devices are not.  For them, you need drivers, which you either need some way to access, or a compatible OS to run them in.  In the classic days, this is precisely what they did -- the driver was included on-chip, initialized during boot.  That's how the BIOS knows about an installed hard drive card, for instance, and how to use it.  Since the 90s, software drivers for interfacing to the OS have been necessary, and you will have a harder and harder time using those on a "bare" system without constructing something very much equivalent to an OS in the first place.

Also, practically anything since the early to mid 90s will be 32 bit protected mode (or more), including device buffers mapped to upper (32 bit) memory blocks.  Also, PnP is a thing, including enumerating all the buses and bridges, northbridge and southbridge controllers, even just the RAM...

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline Dr. Photon

  • Contributor
  • Posts: 14
  • Country: us
Re: PC running software without OS
« Reply #21 on: March 08, 2018, 04:42:07 pm »
I thought that the old memory testing application MemTest86 ran as close to bare metal (didn't start from DOS) as it could?
 

Offline picitup

  • Regular Contributor
  • *
  • Posts: 240
  • Country: gb
Re: PC running software without OS
« Reply #22 on: March 08, 2018, 04:58:51 pm »
Ahh...  Int 21 under dos and pip under CP/M.  Yes it's true, I'm old  :scared:
If you know what you're doing, then you're not learning anything.
 

Offline Ampera

  • Super Contributor
  • ***
  • Posts: 2578
  • Country: us
    • Ampera's Forums
Re: PC running software without OS
« Reply #23 on: March 08, 2018, 05:49:13 pm »
Ahh...  Int 21 under dos and pip under CP/M.  Yes it's true, I'm old  :scared:


I'm young and still program using it.
I forget who I am sometimes, but then I remember that it's probably not worth remembering.
EEVBlog IRC Admin - Join us on irc.austnet.org #eevblog
 

Online mdijkens

  • Regular Contributor
  • *
  • Posts: 146
  • Country: nl
Re: PC running software without OS
« Reply #24 on: March 08, 2018, 09:24:33 pm »
I think for absolute maximum performance, modern PC's do NEED an OS !
Of course the OS adds overhead, but it also makes optimal use of all the advanced cpu/gpu and chipset features.

In the early days I've written low level assembler on the 8086 and 80286 architecture. It made sense for very specific software
But nowadays I doubt you get half the performance compared to an optimized and well tuned Windows or Linux OS
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf