What makes an operating system "Unix-like"?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
physecfed
Member
Member
Posts: 45
Joined: Sun Feb 28, 2016 5:33 pm
Location: Merced, California
Contact:

What makes an operating system "Unix-like"?

Post by physecfed »

First off, apologies if this leans more towards the OS Design & Theory forum; I hemmed and hawed over this for a few minutes but figured it'd be better posted here as it feels like it is much more macroscopic of a question.

I've heard many operating systems being referred to as "Unix-like" in that they descend from the original Bell source at least to an extent ("genetic UNIX") or that they take inspiration from the internal workings of Unix systems ("functional UNIX"); however, I'm at the planning phase of things where I'm trying to structure my (third) attempt at an operating system, so I would like a clear definition on what makes a Unix-like operating system able to carry that title. The Wikipedia article on the subject is of no help, simply stating:
Wikipedia wrote:There is no standard for defining the term, and some difference of opinion is possible as to the degree to which a given operating system or application is "Unix-like".
I'm no stranger to the notion of the POSIX/Single UNIX Specification standards, but this feels like a technicality more than a rule; having an operating system otherwise independent that simply adheres by means of POSIX compatibility feels like calling a cow that quacks a duck. It also doesn't seem like it depends on the kernel classification; GNU Hurd and MINIX are microkernels, whereas Linux, also "Unix-like", is monolithic in nature.

So, in a broader sense, what are the key, cornerstone philosophies that my OS/kernel should adhere to in order to properly be considered an operating system of the Unix tradition? Again, I'm at the planning stage of my new project, so there isn't anything yet in the way of an actual implementation, but this also means I have almost-infinite leeway with how I devise things.
User avatar
SpyderTL
Member
Member
Posts: 1074
Joined: Sun Sep 19, 2010 10:05 pm

Re: What makes an operating system "Unix-like"?

Post by SpyderTL »

I'm no Linux expert, but I'd say that if it boots up with the standard "Doing something....[OK]" stream of trace log messages, you get a login prompt, and a bash-like shell, and it has a single file system tree that contains all system resources, that qualifies it as Linux-like for me.
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
apamment
Member
Member
Posts: 28
Joined: Thu Aug 20, 2015 9:02 pm
Contact:

Re: What makes an operating system "Unix-like"?

Post by apamment »

I don't think there is a rule. If it's "like" unix then it's "unix-like" as opposed to like something else. I guess you would want to support the usual features that one would expect on a unix system. Not necessarily all of them, because its "unix-like" not "unix-exactly-the-same"

It's just words anyway, one persons idea of unix-like might not be the same as anothers, so better to focus on your goals rather than trying to define your OS before it exists.
physecfed
Member
Member
Posts: 45
Joined: Sun Feb 28, 2016 5:33 pm
Location: Merced, California
Contact:

Re: What makes an operating system "Unix-like"?

Post by physecfed »

apamment wrote:I don't think there is a rule. If it's "like" unix then it's "unix-like" as opposed to like something else. I guess you would want to support the usual features that one would expect on a unix system. Not necessarily all of them, because its "unix-like" not "unix-exactly-the-same"

It's just words anyway, one persons idea of unix-like might not be the same as anothers, so better to focus on your goals rather than trying to define your OS before it exists.
That's fair. I'm not trying to clean-room a Unix implementation, rather I'm trying to build an operating system that learns lessons and maintains much of the pragmatism of Unix. Out of curiosity, what are some of those usual features?

I suppose this is the unique challenge of developing the plan for an operating system; that aspect gets a few degrees easier once the ball has at least started rolling.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: What makes an operating system "Unix-like"?

Post by Solar »

What makes an OS Unix-like?

First off, have a look at an average Unix's /usr/include/unistd.h:

open() read() write() creat() lseek() close() pipe() sleep() fork() join() chdir() dup2() execve() nice() getpid() getuid() gethostname() ...

These all come with a certain mindset. Most, if not all, resources in the system being accessible as files. Open files identified as integer fd's. A user, having an ID, belonging to a group, having an ID. Files, and directories, belonging to a user and a group. Files having access rights in the user - group - other scheme. A process having an ID and belonging to a user, with a standard input and a standard output stream, which can be "piped" to or from another process.

Then there's the file system layout. /etc for configuration. /usr for applications. /tmp for temporary files. /home/<user> for user data. Files beginning with dots being "invisible".

That's all just to "get an idea". If you realize you want to do a Unix-like OS, I would strongly suggest looking at the POSIX papers, the FHS (Filesystem Hierarchy Standard), and stuff like that. Because, in the end, "Unix-like" means that people will expect your OS to be source-compatible to all the classics.

Upside? You will have more or less immediate access to a huge software library.

Downside? You'll be just another Unix.
Every good solution is obvious once you've found it.
User avatar
iansjack
Member
Member
Posts: 4706
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: What makes an operating system "Unix-like"?

Post by iansjack »

I'd say that the first question to ask is why you want your operating system to be Unix-like. Once you understand the answer to that you will likely have answered your original question.
onlyonemac
Member
Member
Posts: 1146
Joined: Sat Mar 01, 2014 2:59 pm

Re: What makes an operating system "Unix-like"?

Post by onlyonemac »

The [url="https://en.wikipedia.org/wiki/Unix_philosophy"]UNIX philosophy[/url] may offer some insight here:
The Unix philosophy emphasizes building simple, short, clear, modular, and extensible code that can be easily maintained and repurposed by developers other than its creators.
In practice, this boils down to the "everything is a file" and "UNIX filesystem" (whereby everything falls under the same file and directory tree) concepts, and users of a "UNIX-like" system will probably also expect to have common UNIX utilities such as bash, cat, grep, and so on available.

Essentially, a "UNIX-like" system is a system that follows the same principles as UNIX.
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.

Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing
physecfed
Member
Member
Posts: 45
Joined: Sun Feb 28, 2016 5:33 pm
Location: Merced, California
Contact:

Re: What makes an operating system "Unix-like"?

Post by physecfed »

Solar wrote:What makes an OS Unix-like?

First off, have a look at an average Unix's /usr/include/unistd.h:

open() read() write() creat() lseek() close() pipe() sleep() fork() join() chdir() dup2() execve() nice() getpid() getuid() gethostname() ...

These all come with a certain mindset. Most, if not all, resources in the system being accessible as files. Open files identified as integer fd's. A user, having an ID, belonging to a group, having an ID. Files, and directories, belonging to a user and a group. Files having access rights in the user - group - other scheme. A process having an ID and belonging to a user, with a standard input and a standard output stream, which can be "piped" to or from another process.

Then there's the file system layout. /etc for configuration. /usr for applications. /tmp for temporary files. /home/<user> for user data. Files beginning with dots being "invisible".

That's all just to "get an idea". If you realize you want to do a Unix-like OS, I would strongly suggest looking at the POSIX papers, the FHS (Filesystem Hierarchy Standard), and stuff like that. Because, in the end, "Unix-like" means that people will expect your OS to be source-compatible to all the classics.

Upside? You will have more or less immediate access to a huge software library.

Downside? You'll be just another Unix.
I almost immediately decided to look at my Mac's implementation of unistd and it'll take awhile to mentally parse.

I suppose I've always liked Unix's interfaces (the API, file system, etc.). There's also the aspect of Unix being extensively well-documented, although I suppose one might find similar documentation for Windows if one was that inclined.

The software library is a slight plus, although I'm certainly not wanting to build a Unix variety to be able to rapid-track through the dev process (not trying to develop a "Linux for hipsters"). I might base the file system more off SunOS's filesystem(7) as I'm wanting to keep this closer to what "old UNIX" was (think Open/Solaris rather than the current illumos/OpenIndiana family derivatives, which build much more off the GNU/Linux system).
iansjack wrote:I'd say that the first question to ask is why you want your operating system to be Unix-like. Once you understand the answer to that you will likely have answered your original question.
I suppose a big reason for this is as an academic/self-teaching exercise, and that explains why I'm being much more careful about planning and pre-dev work this time around. Effectively, to summarize in one sentence, I'm trying to develop something that has the potential to be greater than the average Unix derivative but still learns the lessons from Unix.

Also, as a slightly tongue-in-cheek reason, I've never quite understood Linux's features and use as much as I have wanted to, so maybe rolling my own Unix is my subconscious telling me to be more terminal-friendly :P
onlyonemac
Member
Member
Posts: 1146
Joined: Sat Mar 01, 2014 2:59 pm

Re: What makes an operating system "Unix-like"?

Post by onlyonemac »

physecfed wrote:Also, as a slightly tongue-in-cheek reason, I've never quite understood Linux's features and use as much as I have wanted to, so maybe rolling my own Unix is my subconscious telling me to be more terminal-friendly :P
While I don't want to discourage you, I suggest that you have at least a solid understanding of one UNIX system (Linux, FreeBSD, OS X, Minix, etc. - although I recommend Linux as it's the easiest to "pick apart" to explore and it's widely documented) and at least a casual understanding of another UNIX system before trying to make your own UNIX operating system.
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.

Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing
physecfed
Member
Member
Posts: 45
Joined: Sun Feb 28, 2016 5:33 pm
Location: Merced, California
Contact:

Re: What makes an operating system "Unix-like"?

Post by physecfed »

onlyonemac wrote:
physecfed wrote:Also, as a slightly tongue-in-cheek reason, I've never quite understood Linux's features and use as much as I have wanted to, so maybe rolling my own Unix is my subconscious telling me to be more terminal-friendly :P
While I don't want to discourage you, I suggest that you have at least a solid understanding of one UNIX system (Linux, FreeBSD, OS X, Minix, etc. - although I recommend Linux as it's the easiest to "pick apart" to explore and it's widely documented) and at least a casual understanding of another UNIX system before trying to make your own UNIX operating system.
That's fine; I was more intending that as a slight humorous aside; I have a good conceptual understanding, at least in general (not the nitty-gritty) of Linux and OS X (OS X as it's my main "daily" computer). During my high-school years the terminal was a relentless source of frustration; I'd always have it throwing errors due to missed commands, syntax, dependencies or what-not. That kind of put a little bit of fear of Unix systems into me for a long time, although I've been gotten much better the past couple of years by just forcing myself into it.

That being said, I do understand what you're saying as far as having a grip; I've ordered a bunch of research material (including Lions' Commentary, because it's required reading) and might even be able to find an ancient XENIX machine to play with.
User avatar
iansjack
Member
Member
Posts: 4706
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: What makes an operating system "Unix-like"?

Post by iansjack »

I think you are confusing Unix and text-based OSs (terminals). Almost all OSs provide some sort of interactive command-line facility; this in no way defines Unix. Conversely, there is no need to use a terminal to use Unix - many Mac owners never see a command line.
physecfed
Member
Member
Posts: 45
Joined: Sun Feb 28, 2016 5:33 pm
Location: Merced, California
Contact:

Re: What makes an operating system "Unix-like"?

Post by physecfed »

iansjack wrote:I think you are confusing Unix and text-based OSs (terminals). Almost all OSs provide some sort of interactive command-line facility; this in no way defines Unix. Conversely, there is no need to use a terminal to use Unix - many Mac owners never see a command line.
Nah, not confusing the two - but seeing as graphical package managers for Linux are just starting to gain traction, the established way of doing things is still the terminal, so terminal proficiency is key for the Linux side of things. Mac and Windows are less reliant, but there are non-obvious uses.

I know that there isn't equating between the two (i.e. Unix isn't "that OS family with the blinky cursor command-thing"), but the reliance on the command-line for many operations in Linux was a major obstacle to me learning it well when I was younger (I had much more of a temper and much less computer knowledge then). Again, the statement about being terminal-friendly was intended to be humorous whereas everyone seems to be taking it at face value.
RharryR
Posts: 17
Joined: Thu Feb 11, 2016 1:15 am
Location: Milingimbi Island, Australia

Re: What makes an operating system "Unix-like"?

Post by RharryR »

Same filesystem layout, commands, can execute ELF executables, and many other little things that are similar between Unix-Like operating-systems/kernels.

First off, the filesystem is usually layed out like this:

/bin
/boot
/dev
/etc
/home
/lib
/mnt
/opt
/proc
/root
/run
/sbin
/srv
/sys
/tmp
/usr
/var

You will find that all Unix-Like operating-systems have a root directory exactly like this.

Another feature found in all Unix-Like operating-systems is commands, here's a list of the common commands you'll find:

ls
cd
touch
mkdir
cat
vi
grep
egrep
echo
history
kill
printf

These commands are realy the basics for moving around a Unix-Like system.

Another similarity is the C Library. All Unix-Like systems have the same API.
You'll find that all Unix-Like systems have the same includes and functions.

Anyway, thats just a really quick insight on Unix/POSIX.

Of course, the right word to use for "Unix-Like" systems is "Posix Compliant". Posix is a standard that defines what features a system needs to be Unix-Like.

You can check out Posix here: http://pubs.opengroup.org/onlinepubs/9699919799/

Have fun :)
User avatar
Roman
Member
Member
Posts: 568
Joined: Thu Mar 27, 2014 3:57 am
Location: Moscow, Russia
Contact:

Re: What makes an operating system "Unix-like"?

Post by Roman »

The Single UNIX Specification, AFAIK, doesn't dictate the binary format. OS X, for example, doesn't use ELF, but is UNIX-compliant.
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay
RharryR
Posts: 17
Joined: Thu Feb 11, 2016 1:15 am
Location: Milingimbi Island, Australia

Re: What makes an operating system "Unix-like"?

Post by RharryR »

Roman wrote:The Single UNIX Specification, AFAIK, doesn't dictate the binary format. OS X, for example, doesn't use ELF, but is UNIX-compliant.
Really! Thanks for letting me know. I thought ELF was found in all Unix-Like operating systems :)
Post Reply