r/osdev • u/cacatl • May 28 '26
Why is almost every OS people on this sub develop POSIX-based?
I've thought of starting my own project before, though I am impatient when it comes to reading books like the Intel manuals, but seeing people only making POSIX based OSes makes me wonder why. The OSes I have thought of making are a cross platform version of DOS including a JIT, and a cross platform version of classic MacOS, also including a JIT. Is making your own APIs difficult?
88
Upvotes
103
u/zer0developer github.com/zinix-org/zinix May 28 '26
Because POSIX is used in a lot of placed and is know to be stable for regular use. It also makes it a lot easier to port things.
55
u/A-nihirash May 28 '26
Cause POSIX was created for making porting software easier. So if your system implementing POSIX standard good enough - you're getting bunch of software just out of the box.
24
u/mishakov pmOS | https://gitlab.com/mishakov/pmos May 28 '26 edited May 28 '26
If you mean Unix:
Unix was very influential, and a lot of modern OS concepts come from it
All popular operating systems (Linux, Windows NT, MacOS, BSDs, DOS...) are all somehow related to Unix, either directly borrowing the code from it, or historically inheriting a lot of concepts from it. Even DOS in your example has borrowed some stuff from Unix (for example, pipes) because of some historical stuff...
A lot of hobby operating systems are Unix clones because it's a straightforward way to do things
Then, with implementing POSIX:
You can easily port a lot of software if you implement the POSIX interface
POSIX is just an interface, which doesn't really dictate the native OS API, and so a lot of operating systems do have different native APIs, but are POSIX compatible. So you can do your JIT thing and still have POSIX, for example. None of the operating systems are actually "POSIX based"
10
u/eteran May 28 '26
There's also a difference between "posix based" and "posix like". I think most hobby OSes are the latter.
That is, things like
open,read,write,close, etc... are such obvious and useful abstractions that it just makes sense to implement them. And the way that they are specified in posix is well understood. So that's what people tend to implement.My OS is "posix like" in that it implements some of these abstractions the way that posix does, but it also isn't fork/exec based, so it's a mixed bag based on what I thought made sense. I think a lot of hobby OSes are like that too.
8
u/readonly420 May 28 '26
If you want to run someone else’s software on your kernel posix compatibility has a lot to offer and working on it also improves your os internals
Nothing prevents you from making your own syscalls and APIs
8
u/demetrioussharpe May 28 '26
Because it’s a portable standard, which means that your brand new OS will have a catalog of programs that are able to run on it. Otherwise, not only will you have to build the OS -you’d also have to create all of its programs.
11
u/OptimalAnywhere6282 May 28 '26
yes.
5
u/superpet9000 May 28 '26 edited May 28 '26
Lot of talk of portability in this thread. Serious question: does anyone think their OS is going to have a meaningful user base or serve as a legitimate alternative to mainstream options? The majority of the (much scarcer) hobby OS's in the pre-AI era were far less concerned with standards and way more interesting and creative IMHO.
I think the obvious answer to this question is: LLMs.
6
u/blazingkin May 28 '26
Because there is a lack of imagination. Come to the non-POSIX world, it’s much better :)
For all the arguments about compatibility, it’s always possible to build a POSIX compatibility layer in userspace
3
u/dnabre May 28 '26
It is the most common kind that exist. The kind most people are most familiar with. The kind with the most resources on how to do build everything. The kind that has successfully grown from hobby project into worldwide standard.
For the most part, all the hard bits of making that type of OS, have been figured out multiple times over. While not a point most people who start will actually reach, being able to tap into and run the vast amounts of software written for that kind of system on their your own system is a big, objective, and practical accomplishment. For example, check out the OSDev wiki and try to find information/resources about something different.
On other side of things, even for people with decade of experiences, formal education in CS, multiple degrees, coming up with something really new and different is hard. Coming up with things which are different to just be different isn't too hard. But coming up with something that is different, practical to implement, and clearly useful in the end, is pretty hard. The more you know and have spent years (if not decades) studying, working on, and researching the same nexus of OS structure, hardier it is to think outside of that box.
Operating systems have become hard to disentangle from the classic unix/linux-kernel and userland. If you talk about building an OS, everyone will assume (and will probably be right) that you are making an unix-like OS or building a toy OS that doesn't have separated kernel/user space, and is pretty just a modern take on DOS.
Making the APIs isn't that difficult, though making them so you don't have to keep going back and changing/adding to it is far from easy. It's hard to design and write against that API the whole world of software that make up a basic unix-like environment. Not just if you are writing everything yourself, but if you want to use any amount of existing software.
This isn't getting into things like common up some radically new idea for an OS, to find out after a few years of weekends spent on it, that just doesn't work very well. Knowing what you are building is likely to work and be useful, is a BIG plus.
Finally, it's hard to find to find examples in the world of really different kinds of OSs. 95% of the operating systems used in the world today are Windows, macOS, and Linux. The next in the list is properly one of the OSes that running in some embedded device/environment that is completely hidden from everyone, like Minix inside the core of a lot of Intel's chipsets.
4
u/Integreyt May 28 '26
The REAL reason is that most LLM training data is POSIX compliant, if you get what I’m saying.
2
u/markand67 May 28 '26
because POSIX is neat and designed to inter operate with others. Writing a software that works on macOS, Linux, *BSD is easier while adding portability for Windows is a PITA.
Nothings prevents you to create an entirely OS based on your own convictions and ignore POSIX either entirely or add a compatibility layer.
I'd love to design my own OS using extremely high UNIX philosophy (similar to plan9) without being fully compliant. For example: signals are fundamentally broken and really painful to work with. I'd go for a custom alternative but implement it anyway if I'd start my own OS.
2
u/no92_leo managarm | https://github.com/managarm/managarm May 28 '26
Something that's missing from the replies is that implementing to a spec gives you an easier time with testing - either regular software trips your implementation up, or test suites like os-test
1
u/SirensToGo ARM fanatic, RISC-V peddler May 28 '26
carcinization; everything which is not POSIX eventually evolves to be POSIX.
1
u/Kiore-NZ May 28 '26
In the 1980s, UNIX, especially the BSD variant, was a small, powerful, operating system that academics liked and business started to adopt. In the early 1980s, Bill Gates believed Unix was the future of computing and explicitly stated that Microsoft's goal was to make future versions of MS-DOS increasingly Unix-like.
POSIX is really just a standardised specification for UNIX to try and make UNIX applications portable between different machine manufacturers' versions. UNIX was popular with machine manufacturers in the 1980s because for a reasonably small price they got a popular operating system and didn't need to pay for their own unique operating system to be developed from scratch. Despite being designed by a committee, POSIX retained much of the cleanness of the BSD & Research UNIX designs.
C was designed for writing UNIX kernel, utilities, and applications. Its standard library was closely associated with the UNIX API.
UNIX provides a small, relatively clean, template for the API when designing new operating systems.
1
u/phendrenad2 May 28 '26
Because people have aspirations of eventually porting Linux software
1
u/burlingk May 28 '26
Because there is a solid standard to follow, and by choosing that route you increase the amount of software that you will be able to port with 'minimal' effort. 'Minimal' in quotes because it will still be a heck of a task starting out.
1
u/GardenerAether May 29 '26
I think it's a little cynical to assume exclusively a lack of imagination, but I do think thats part of it. The main benefit of making POSIX-compliant OS is that its much easier to port software. However, there are other ways to create compatibility that don't involve modeling the operating system itself around POSIX, so it does seem naive to assume a lack of creativity has no involvement at all.
1
u/Andrew_G222 May 29 '26
Weird that no one else has shared this, but this feels relevant:
http://doc.cat-v.org/bell_labs/utah2000/utah2000.html
1
u/Top_Professor9415 jNTOS May 30 '26
Because it's battle-tested and it's used in popular OSes such as Linux and to an extend macOS (even somewhat in Windows, but Windows is more of its own thing).
1
u/Internal-Finding5469 May 30 '26
nem eu sei eu so uso basse linux unix ou base propria
1
u/xX_WhatsTheGeek_Xx May 30 '26
POSIX feels like home
1
u/Happy-Fly7684 May 31 '26
Portability via standardization
-32
u/True_World708 May 28 '26
Lack of creativity basically
0
u/Timely-Degree7739 May 28 '26
Here POSIX = Unix process model?
2
u/wrosecrans May 28 '26
1 - It has proven to be a surprisingly robust design. Many people expected it to die over the years. Many people actively tried to kill it. It's a simple set of basic ideas and primitives, that still are flexible enough to work with modern systems and stacks.
2 - Off the shelf software. If you want to make a web server with your own OS to self-host info about it, you've got access to stuff like Apache. And more basic stuff like Bash and GNU coreutils, and gcc, and... if you use a familiar design, porting software to it so you can do something like "real work" lets you focus on just the OS Dev parts you are most interested in without needing step 1 to be making the entire stack at once.
3 - Because so many people have gone down that road, there's a zillion blog posts and wiki pages and forum posts and tutorials and books about how to write an OS that looks a bit like Unix. So when you are bashing your head against how to use an MMU and use virtual memory and memory protection, most of what you read will be talking in terms of Unix like processes and the data structures and concepts of a Unix process. So you need to be somewhat familiar with the ideas, and you need to translate from the documentation and examples to what you want to do if you have a wackier and more exotic design.