Page 1 of 1

to POSIX, or not to POSIX?

Posted: Tue Jun 23, 2009 5:20 pm
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.

Re: to POSIX, or not to POSIX?

Posted: Tue Jun 23, 2009 5:29 pm
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.

Re: to POSIX, or not to POSIX?

Posted: Tue Jun 23, 2009 5:36 pm
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

Re: to POSIX, or not to POSIX?

Posted: Tue Jun 23, 2009 5:41 pm
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.

Re: to POSIX, or not to POSIX?

Posted: Tue Jun 23, 2009 6:10 pm
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.

Re: to POSIX, or not to POSIX?

Posted: Tue Jun 23, 2009 6:16 pm
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.

Re: to POSIX, or not to POSIX?

Posted: Tue Jun 23, 2009 6:29 pm
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

Re: to POSIX, or not to POSIX?

Posted: Tue Jun 23, 2009 7:03 pm
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

Re: to POSIX, or not to POSIX?

Posted: Tue Jun 23, 2009 7:36 pm
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.

Re: to POSIX, or not to POSIX?

Posted: Tue Jun 23, 2009 7:55 pm
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.

Re: to POSIX, or not to POSIX?

Posted: Fri Jun 26, 2009 6:32 pm
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.

Re: to POSIX, or not to POSIX?

Posted: Sat Jun 27, 2009 4:44 pm
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.