It is not. A program that runs without an OS just doesn't need the OS provided services but instead manages everything itself.
A perfectly valid program might be:
just a simple google would help:
the low-level software that supports a computer's basic functions, such as scheduling tasks and controlling peripherals.
this poor author of the post. >.> and then to think critisism gets a downvote :'D.. must be some angry kids mob who found where on memory mbr is put from some youtube1337hack0r..
The accepted answer was correct:
"You place your binary code to a place where processor looks for after rebooting "
That was a good anwer to the question.
the rest is just filler nonsense.
There has to be some distinction between the subset of all possible programs that qualify as "operating systems", otherwise why have two terms?
On my dad's old Apple ][+ 48k, I used the same REPL to get the CATALOG of what was on the floppy disk and to program in BASIC. What's the line between OS and a REPL?
A program, by definition, is a running system which executes specific instruction sets, whether this is from a low-level, no-OS setup, such as an NES, or a MacOS program which makes extensive use of Core Image, Core Animation, Core Audio, et cetera.
These are both programs. But only one of them actually runs in an OS.
What is art?
Handling resources isn't the definition of an OS.
Also asking "what is art?" is not the same as asking "what is an operating system?"
Art covers just about all human activity, the definition is extremely wide. I wouldn't say an OS has a definition that wide.
I learned to program on an SDS Sigma 5.  The machine booted by reading the first card in the reader and executing the instructions punched on that card.
The card could be a boot loader to start the BTM (Batch Timesharing Monitor) operating system from disk. Or the card could be a little program all of its own.
A particularly useful one-card program was a card deck printer. You would put it at the front of the deck and boot the machine. This card had a simple loop to read the next card into memory, then print that line on the printer, and repeat until the card reader was empty. (One of my first optimization adventures was modifying the code to be double-buffered: read the next card into memory while the previous card is printing. Twice as fast!)
That card certainly handled resources, but no one called it an OS. It didn't manage and provide services to other programs, it was just a one card program.
Another popular one card program was the bird chirp card. It pulsed the front panel speaker to make it sound like birds were chirping. We didn't think of that as an operating system either. :-)
Well, it certainly is part of the definition of a useful OS. A car doesn't have to be able to turn right. It is still a car, just not a useful one.
User program does not start operating system program.
I think it boils down to the concept that an OS should serve as a middle layer of abstraction between a program and hardware, and provide some sort of meaningful way to make that stream of communication more simple and useable for humans.
The Gameboy Advance in particular is pretty fun and simple, I recommend it.
When the CPU boots up, there is a special temporary mapping for $0000-$0100 to the firmware. The firmware largely just validates the ROM header and displays the Nintendo logo. But my favorite part is this: it executes all the way to $0100. There is no jump to $0100 - the last two bytes are an instruction that simply removes the firmware mapping. Now the IP lands on $0100 and everything is mapped as expected.
This simple mechanism made it notoriously difficult to extract the Gameboy BIOS. I recall reading that one way it was eventually extracted was via fault injection: by messing with the clock very precisely, you could get the processor to 'skip' the instruction that unmapped the firmware, thus allowing you to dump it.
Of course, another way you could read the firmware is by "simply" decapping the processor and taking shots of it with a powerful microscope, and then optically extracting the 'bits.' I think this was also done, but as a person with little understanding of the actual details of how a decapping is done it seems like an incredibly expensive, error prone operation.
There have been efforts to provide the capability of running a program without an OS before, but any such effort is going to need to provide the system calls and standard libraries used by the program, and the infrastructure to support it (device drivers, management, etc.). That that point it becomes a mini-OS.
An example is Erlang on Xen. Xen is more often run with a guest OS running inside it, and then the program runs within that guest os. The http://erlangonxen.org/ folks made Ling (https://github.com/cloudozer/ling), software that enables an Erlang BEAM VM to be run directly on Xen, and thereby run a single Erlang program on Ling.
And a minimal hello world at: https://unix.stackexchange.com/questions/122717/how-to-creat...
There's a sequel in 0x5 that explains how to add a basic form of multiprocessing support.
Embedded systems are one of the most extremely relevant uses of this today.
However, historically, I think my first case of programming without an OS would be ASM development for the Sega Genesis?
Another addition is that I saw a comment ‘a program that runs an OS, is an OS.’
This is absolutely not true. An Operating System is a multi-faceted, complex piece of software, usually with the capacity to run other pieces of software within it, as well as usually offering high-level API’s to improve ease-of-use for developers to access common functionality, such as playing sound, or displaying images.
A ROM for the NES, while a program, is certainly not an OS, and to be very clear, the NES does not have an OS, like I believe the PS4 and XB1 have.
It contains a certain number of hardware features that can be accessed and manipulated by low-level software functions.
My take is that it's most likely just being asked for the theoretical details, and few people would practically benefit, but does anyone think this would be practically useful?
Presumably you'd potentially cut overhead from anything you didn't explicitly want happening on the host, but as soon as I start to think about most of the uses typically have, the advantages quickly sink below the disadvantages of having to actually manage everything. It's reminiscent of that person who set out to build a toaster from scratch.
Most embedded software projects I worked on did not have an operating system. You'd just have C or C++ program and some ASM to initialize everything.
I would expect really small IoT devices would be the same. With your average single chip device I wouldn't bother trying to get an operating system on there.
I have only just started to use a Raspberry Pi and it does have an operating system - the advantages there are you can pull in IP networking and run services and do much more complex things than on the bare metal.
In such an arrangement every millisecond of latency counts.
It appears that bash `printf` wraps coreutils printf "with ARGUMENTs converted to proper type first," according to the manual. I guess that's how the "%509s" specifier is able to work without any args.
So how does bash `printf` actually determine the proper arg types? Is coreutils printf implemented with hooks that let wrappers fetch the proper arg types without generating an output string? Or does bash `printf` implement its own separate parser for the format specifier?
Actually, coreutils printf follows POSIX/SUS which states that "Any extra b, c, or s conversion specifiers shall be evaluated as if a null string argument were supplied". So that trick will work for many printf(1) implementations (including both bash and coreutils).
Bash printf(1) doesn't have any hooks or wrappers, but it does parse the format string to determine how to convert arguments before calling libc vsnprintf(3). If you are interested in the details, check out how %d/%i is handled in bash and coreutils.
1. http://pubs.opengroup.org/onlinepubs/9699919799/utilities/pr... (item 9 under Extended Description)
Why didn't libc include a printf function that expands a format specifier with a pointer to a byte array (and/or possibly an array of c strings)? That way there would at least be a standard way of handling arbitrary input and erroring out with less risk of buffer overflows and stuff.
I know it’s possible to not use libc or similar, but os is aware of such a program.
Having said that, there are places you can put running code that get scheduled but don't appear in an obvious way: inside other processes, as device drivers, as code on peripherals (GPU etc), or on the notorious management engine. Variations of these methods are used by viruses and exploits: the core of any exploit is getting code to run inside some other program that did not originally contain it.
The final place is to put it "outside" the operating system as a hypervisor, then run the "normal" operating system as a seamless virtual machine inside the hypervisor.
Malware often has something akin to this as a goal, but as far as I know it usually works by hiding itself from the user rather than the kernel.
You'll get better results for more general questions from a reddit forum.
I've always though if a forum like this had a little age indicator (or experience indicator, or something like 'this person is smart') it would be a lot more useful.
You can also read them saying they wanted to take CS when they graduated from school so you can glean from that they are probably in high school.
Or I just flat out ask them (or accuse them).
that's 90% of HN too though.
i'd be careful following such advices. for example this person isn't aware you really need to build a cross toolchain for your OS to compile to your target. on 64-bit there's some more things to take into account about compilers (red-zone?). even if you go all assembly your assembler will probably be an optimising one and shoot you in the back on more than one occasion! Thats just the tool-chain surface issues (deeper ones ignored... like file formats..? binary is fun, but good luck scaling that up to a complex project... bios can't load you up that high in memory and limited amounts...)
Next you get to things omitted which on baremetal would cause problems, like no mention of power management and such topics. or even assumptions that your code is loaded at 0x0000:0x7c00 while it could be loaded at that address but via a different CS value, completely screwing you over if you don't flush it immediately on your mbr...
Take an example of opengl tutorials. people tell you to write your first polygon because they just managed to do so. They forget to mention to throttle the loop, so you burn out your VGA card rendering 10000000000fps of 1 triangle.... good job!
this tutorials are kind of like that. fun to put into qemu which is sort of 'safe' learning and get acquainted but really doesn't do what it says on the box.
I'm not against these type of tutorials, i like that more people become interested in this, but really take some time and state the scope of the offered information properly. like this is a bit of clickbait / misinformation which is a shame
Maybe there could/should be a 'broad' SE site alongside every 'normal' one? The 'too broad' questions include most of the interesting ones to read. The ones that are 'intellectually interesting'. It's a shame. I love how you can ask anything on HN without being shut down like that. It's so unfriendly, hurtful even. (At worst on here, no-one answers - no harm done.) Why they can't just let 'too broad' questions go for a day or two to see what responses come in, and delete the page if it sux, I don't know. The mods get points for closing things, I guess. Often they don't understand the question, it seems.
 e.g. https://mathoverflow.net/questions/43690/whats-a-mathematici...
Well, bizarrely the close notice on that says "This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet." Which seems absurd. (Although sure, the question doesn't help people, the answers do though.)
But the too-broad questions aren't usually very interesting. Most of them are just pure crap. If you have enough SO karma, try https://stackoverflow.com/review/close/?filter-closereason=t... — what I see just now is someone who wants help with his java/spring thing and isn't very detailed about it, someone who's "been trying to learn how delegation" works, someone who "would like to know how can i mock diffrent user request behavior pattern" and those aren't unusual. The intellectually interesting questions are unusual in the "too broad" morass.
If people are to moderate SO, the rules have to be simple and quick to apply. Of course people don't have to do that, but I fear that without moderation, the interesting questions would get no answers because they would be completely flooded by questions like those three. So the open-ended, intellectially interesting questions lose either way.
So the answer is, There Is No Alternative? There's no possible way things could be different in that respect?
This summer I waited on a lot of six- and even twelve-minute batch jobs, and I spent some of those on the SO moderation queue (I'm one of the 3000-karma users, not an elected moderator). It didn't take much more than six minutes to learn that picking the interesting questions out of the flood of manure is a terrible chore.
It would be nice if the intellectually interesting questions could be left alive. But I don't think it's humanly achievable. People will post their job interview quizzes and first-year CS exercises and say, oh, mentally stimulating and please do leave open.
I don't think you could've done a better job than linking that moderation queue of "toobroad" to make your point. It was a never-ending channel of straight shit. Ranging from "here's a copy and paste of all my unformatted code that won't work, whatever that means" to "how do i use python on windows".
Everything looks easy to someone that has no stake in the solution. We get so used to being end-users that we take everything for granted, as if our experience is the natural ordering of the universe, rather than the result of all the work that goes on behind the scenes.
Read enough posts from HNers condemning Stack Overflow and you'd think they believe Reddit/HN's "new" queue is the ultimate browsing experience.
FWIW, it's not moderators closing a question (I rarely see that). You "only" need 3000 points to vote to close a question. Users with a gold badge on a tag the question has can single-handendly close a question.
Users get no incentive for closing questions.
Also, those 3000 points also give you the possibility to vote for reopening a question. And there's a queue where users can see questions that are being voted on for reopening.
I agree I'd like such a site. I don't think any Stack Exchanged based site will ever be such a site. I think TPTB believe it's nearly impossible to run such a site and not have it turn into crap because of the large number of people asking bad questions of the "How do I make a website like facebook" or "How do I make a game like GTA5"
I have over 10k points there, so this is said (mostly) in jest. There is a lot of crap being pumped into SO all the time. This kind of defensive closing of an interesting but off-topicy question is the only real tool people have over there. If they had let this question go unclosed, it could encourage other less-interesting open-ended questions and before you know it we'd be seeing "best kind of Pizza topping for programmers?" questions.
Also interesting how this disconnect is still going on after so many years, mostly unaddressed - despite the many essays Jeff Atwood writes about true purpose of SO, people still want to use it differently.
And those questions can in most cases be answered by the docs anyway. The times I've used SO is when the problem can't be answered by the docs, my own experience or that of the team, but then I've received either no answer or a series of non-answers (that should have been comments instead, but a lot of people can't comment).
I also see quite a bit of overt reputation farming there. Like vague questions that receive an improbably precise answer that immediately gets selected. Like "how do u process payments?" (the orthography is usually bad) immediately followed by very specific instructions from a very specific payment processor not mentioned in the question, probably taken straight from its documentation. And I rarely see "closed as too broad" on those, probably because of the quick turn-around.
so never then?
But I said the same thing about creating a bare metal example one day hehe
It's probably not wrong of the stackoverflow users to have closed the question according to established rules, I just don't think this is necessarily the right way to run the site.
BIOSes offer system calls that tend to be backward compatible, so it's an OS of sorts.
(I don't disagree with you -- UEFI provides BootServices which arguably are more numerous than the number of syscalls on most operating systems. Just that "system" being in the name isn't really the best argument. :P)
It's quite the same as DOS being 'disk operating system' - it was able to drive the floppy and provide a file system.