to POSIX, or not to POSIX?

Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
Post Reply
User avatar
yemista
Member
Member
Posts: 299
Joined: Fri Dec 26, 2008 12:31 pm
Location: Boston
Contact:

to POSIX, or not to POSIX?

Post by yemista »

What are peoples opinions on this? On the one hand, designing everything yourself will really make you think about things and youll get a lot of good experience figuring out what works and what doesnt, but on the other, making something POSIX compliant will teach you a lot of things as well, and would be just as difficult. The problem is that if you are not POSIX compliant, it would be very hard to try to port things over, and being able to port existing programs is a big accomplishment in and of itself.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: to POSIX, or not to POSIX?

Post by Combuster »

Being able to port something over is also part of the design. Posix, or posix emulation will allow that, but a ported application might not yield the results your OS would be capable of.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
clange
Member
Member
Posts: 163
Joined: Sun Oct 05, 2008 5:00 am
Location: Copenhagen, Denmark
Contact:

Re: to POSIX, or not to POSIX?

Post by clange »

Hi

My advice would be to support POSIX (or just a subset at least). You should be able to implement it as a simple wrapper on top of your own API. Disclaimer: I have only done this myself for very simple stuff - I expect it to be much less simple in the future when I have to support more advanced functionality.

By providing a POSIX interface you will get access to a LOT of code. Even partial support will give you a lot.

clange
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Re: to POSIX, or not to POSIX?

Post by Brynet-Inc »

Some of the members here can be rather vocal about their personal beliefs, I for example am one of those people.

I personally would only utilize a system that offers a POSIX-compatible environment, utilizing existing software is very important to me.

Others, like Solar, believe that POSIX is flawed by design.. maybe it's not always perfect.. but it does offer some level of compatibility between systems, except perhaps for people using unconventional environments like Mac OS <= 9, AmigaOS or Windows without a 3rd party compatibility layer.

At the end of the day, it depends on your overall goals.. if you're going to be creating an environment that you want Unix users to be comfortable with, supporting POSIX is a good idea.
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
User avatar
gravaera
Member
Member
Posts: 737
Joined: Tue Jun 02, 2009 4:35 pm
Location: Supporting the cause: Use \tabs to indent code. NOT \x20 spaces.

Re: to POSIX, or not to POSIX?

Post by gravaera »

clange wrote:My advice would be to support POSIX (or just a subset at least). You should be able to implement it as a simple wrapper on top of your own API.
Exactly what I was intending to do. I'd like to have my own original idea, with the added benefit of having a wider userbase, which can only be achieved by implementing my ideas with a POSIX compliant layer for mapping.

Makes perfect sense, and to developers, there's no difference between my API and the ones they're accustomed to using. Everyone's happy.
17:56 < sortie> Paging is called paging because you need to draw it on pages in your notebook to succeed at it.
User avatar
yemista
Member
Member
Posts: 299
Joined: Fri Dec 26, 2008 12:31 pm
Location: Boston
Contact:

Re: to POSIX, or not to POSIX?

Post by yemista »

well what does it really take to run apps? I know its different for every app, but what if i wanted to run nasm? does it expect certain system calls to exist? I dont plan to ever have anyone use my os, but being able to run existing apps would just mean to me that i made something that works.
User avatar
gravaera
Member
Member
Posts: 737
Joined: Tue Jun 02, 2009 4:35 pm
Location: Supporting the cause: Use \tabs to indent code. NOT \x20 spaces.

Re: to POSIX, or not to POSIX?

Post by gravaera »

From my reading and research so far, what I can tell is that if you want to port apps from say, Linux, you need to have a theoretic filter layer between (your Kernel and API) and (the foreign platform App).

Either that or you use a Unix kernel, and modify it. Which severely cuts down on what you really learn from your OSDev experience. But porting will be hell of a lot easier.

You need to be able to map all of the extern linked API functions to a handler, which will then translate down to your native API code. From what I can theorize about this process, it involves a good bit of oerhead per API function call, and will eventually, seeing as apps will be calling the handler very often, produce quite the bottleneck of sorts. However you solve that is up to you, of course. But understand that doing this API wrapper theory will probably slow API calls by up to 40%+.

In your mind it looks sort of like this:

[ Foreign App with all of its 'extern' funcs, and the link data in the executable format headers.]
-----------Globally defined set of matching native funcs that redirect to your OS Libs---------
|
v
--------------------------------(Your kernel and APIs in memory)---------------------------

But while it looks simple enough, and, in theory, it actually is a simply to implement concept, it kind of takes a whole lot of reading about different executable formats, and different APIs, and Librares used by other OSs, and... #-o
17:56 < sortie> Paging is called paging because you need to draw it on pages in your notebook to succeed at it.
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: to POSIX, or not to POSIX?

Post by Brendan »

Hi,

I'd like to emphasize Combuster's comment - "a ported application might not yield the results your OS would be capable of.".

How would you beat an Olympic weightlifting champion? Would you challenge then to a weightlifting contest, or maybe challenge them to a game of chess?

How do you beat existing Unix clones? Do you build another POSIX system?

Think of it like this. You spend ages writing a brilliant OS that is better than other OSs for some things and worse than other OSs for other things. Then you add POSIX to it, then everyone ports a large amount of software to it. Nobody writes any software that takes advantage of features that make your OS better than other OSs, because it's a lot easier to just port something from somewhere else. Eventually you're left with an OS that looks and feels the same as all the other Unix clones, that could have been better than other OSs for some things but in practice is just worse than other OSs for other things; and because of this maybe everyone will ignore your OS and just use Linux/FreeBSD.

Now consider an alternative way. What if you deliberately made it impossible to port POSIX software to your OS? In this case you'd start with no software for your OS at all, but you'd write some applications yourself that do take advantage of the features that make your OS better than other OSs (and avoid things where your OS is worse than other OSs). Then you'd use these applications to show everyone how great your OS can be, and slowly you'd gain volunteers, and eventually (with lots of luck) you'd end up with an OS that isn't just another boring Unix clone that is actually better than other OSs for some things; and maybe your OS will become a massive success for a specific niche market (and could grow from there).

What I'm suggesting is to design your OS without caring about POSIX at all - focus on providing features that could make your OS better than other OSs for some things; and write some applications that use these features to showcase your OS. After you've done this, then decide if you want POSIX or not.


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
User avatar
JackScott
Member
Member
Posts: 1031
Joined: Thu Dec 21, 2006 3:03 am
Location: Hobart, Australia
Contact:

Re: to POSIX, or not to POSIX?

Post by JackScott »

An example to help along Brendan's argument: SkyOS. Brilliant custom API, let down by the fact people just ported POSIX app after POSIX app to it.
User avatar
gravaera
Member
Member
Posts: 737
Joined: Tue Jun 02, 2009 4:35 pm
Location: Supporting the cause: Use \tabs to indent code. NOT \x20 spaces.

Re: to POSIX, or not to POSIX?

Post by gravaera »

^^^

And then you'd have to deal with M$ bullying to suppress you, and your own newness to the market, manfaturers' reluctance to do a full shift form what's proven to bring in the $$, and the eternal layman's question:

"Well, okay. That's nice. But why not just use Windows?"

And that thing you said about beating the Champion Weightlifter, or something...was really off. You didn't 'beat' the weightlifter: you just showed him what he, and everyone else who knows about him already knows: that he specializes in weightlifting, but not chess, and that you're just better at chess than he is. You didn't really beat him since it's not in his home turf.

How do you beat Microsoft in its home market? You bring out something that repairs the weaknesses Windows presents, and also allows a seamless shift for developers from the Windows way to the YOUR-OS way.

Initially, the only way to do this is to be able to run windows-native apps. People want to be able to walk around and say: "Linux is awesome. It's more stable than windows, PLUS it runs all windows' programs, and I can run COD, Halo, WoW and everything on it like it was meant to be played there."

Because that's what the consumer wants to hear. Every consumer is always hearing that: "Windows is crap. Windows is full of holes. Windows this, and Windows that. Virus this, and Microsoft that."

Now they may not really understand why, but there are tons of script kiddies, and 'hacker' wannabes (crackers...ugh) who think that emulating anything having to do remotely with the *nix culture makes them 'cool'. Anything having to do with Bill Gates is 'evil', and they think that randomly saying that "Windows is $h!t. I use Linux." makes them seem like individuals. That's your market right there. Them and their insecure friends who will follow mindlessly as long as the product really is good.

I mean: this is basic consumer analysis. Marketing is simple.

So presenting your product like like the solution, and making sure it REALLY IS, is the ultimate solution. If my OS can run windows executables hassle free, and do games as effortlessly as a handheld game console, and browse the internet securely enough...I win.

But how do I do the final deed? And stop Microsoft's ultimate weapon, which is their unbeatable advantage of having distribution contracts with PC vendors? Hhahha. Basic marketing: Give out your OS for free, and only charge the vendors a royalty fee per install. Tada!

Then have a proprietary line of products, like a suit of programs (think Adobe), and keep pushing the idea that your OS is 'free'.

You win. Game over. Make no money from the sale of the OS itself, except in royalties (like...make it US$25 per machine sold that ships with your OS) fo the vendors, and from the sale of powerful media manipulation software.
17:56 < sortie> Paging is called paging because you need to draw it on pages in your notebook to succeed at it.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: to POSIX, or not to POSIX?

Post by JamesM »

yemista wrote:well what does it really take to run apps? I know its different for every app, but what if i wanted to run nasm? does it expect certain system calls to exist? I dont plan to ever have anyone use my os, but being able to run existing apps would just mean to me that i made something that works.
Nasm pretty much requires:

open
close
read
write
lseek
sbrk (or whatever your libc uses for malloc()).

Not to mention the standard libc functions.
User avatar
Love4Boobies
Member
Member
Posts: 2111
Joined: Fri Mar 07, 2008 5:36 pm
Location: Bucharest, Romania

Re: to POSIX, or not to POSIX?

Post by Love4Boobies »

holypanl wrote:And that thing you said about beating the Champion Weightlifter, or something...was really off. You didn't 'beat' the weightlifter: you just showed him what he, and everyone else who knows about him already knows: that he specializes in weightlifting, but not chess, and that you're just better at chess than he is. You didn't really beat him since it's not in his home turf.
I'm not sure you got what Brendan was saying. Perhaps you should re-read his post as you've just proven his point (which was "make your OS better at something and you will find fans in that area - you don't necessarily have to attempt to beat one that's good at something in its own turf unless that is what you want"). I won't read the rest of your post since it is misguided.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
Post Reply