3

This question already has an answer here:

I watched a short intro to Unix from the 70s (https://www.youtube.com/watch?v=7FjX7r5icV8 3D animation starts at 1:56), at the end the general tripartite architecture of Unix was displayed as a 3D animation. Because I have seen already diagrams of the ovarall Linux architecture, I became confused.

Both diagrams, Unix and Linux, share the Kernel, but then Unix is wrapped by the Shell and the Shell by the Utilities. Linux instead is only wrapped by the Userspace, and the Shell does not wrap anything but is just one of many processes within the Userspace.

How do Unix and Linux differ on a very basic level, what do they have in common ? Why is Unix tripartite and Linux two-layered ? Is a Shell a complete different concept within Unix than in Linux ?

unix and linux architectural difference

marked as duplicate by jasonwryan, slm Feb 24 '15 at 1:00

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • This is too broad, but you got my upvote for colourful picture. – jimmij Feb 23 '15 at 23:38
  • I have searched for possible duplicates first, but I tried to start this question because I wanted to focus on the general architecture and not a historical or in depth analysis, and also on a few terms: kernel,shell,utilities, userspace. – Abdul Al Hazred Feb 24 '15 at 0:37
  • From the kernel book off of sourceforge: kernelbook.sourceforge.net/pdf/ch-intro.pdf. – slm Feb 24 '15 at 0:56
2

Because the distinction remains a little vague to me, this may not be a very clear answer. I'll just try to expose my point of view, more than actual, technical facts.

First of all, it is probably relevant to note that Linux is a UNIX-like system. This means that while most concepts and implementations have been inspired, sometimes taken, from UNIX, there was originally no common code base between the two systems. Actually, Linux was mostly inspired from MINIX, another UNIX-like system, the licensing of which Linus Torvalds found too restrictive.

Why is Unix tripartite and Linux two-layered ? Is a Shell a complete different concept within Unix than in Linux ?

To me, both are two-layered. The shell does not have any kind of privileged relationship with the kernel, nor should it. The first, privileged layer, is the kernel, where everything is possible. The second, unprivileged layer, is userland, in which various programs run, including the shell, and standard utilities such as ls. All these programs may communicate with the kernel through the UNIX or Linux set of system calls (these lists are probably not exhaustive).

In my opinion, this is the only layer distinction which really needs to be mentioned when it comes to either UNIX or Linux. Now, while the kernel sees no difference between a shell and another program, the user certainly does in the way he interacts with each. If a difference has to be made between the shell and other programs, then this difference definitely comes from the user, but remains unknown to the system.

This is much more striking in your video than it would be for users of today's systems. Have a look at their terminals: this is amazingly minimal, and we would probably never think of using such things nowadays (even though, I'll admit I'd love to). The thing is: back then, the shell was the first (and only) thing you got when your system had booted and you had logged in. This was the thing you had to go through if you wanted to run any other program. This is probably where the difference is: while the shell is no different from any other program in the kernel's eye, it is a gateway to other programs for the user, and this gateway was much more visible in the 70s, in "core UNIX's" prime.

Of course, this distinction is a lot less significant nowadays, probably because of two things:

  1. Terminal emulation. You can actually get several shells at the same time, and switch between them. This means that you have something before the shell that gives you control over it.
  2. Graphical interfaces. You can now start processes from GUIs, window managers, desktop environments, ... without ever seeing a terminal. We even have graphical programs designed to wrap around shell instances and make them more pleasant to use.

Now, I'm not very good at diagrams, but I guess I would put it this way:

Kernel interaction

Where I would say that:

  • Dashed lines represent user interaction.
  • Dotted lines represent shell-to-process interaction (spawning processes, manipulating I/O flows between them, ...).
  • Plain lines represent system interaction.

If you remove everything but the elements involving system interaction, you end up with two things: the kernel, and user programs. There are two layers, connected by system calls.

Now if, as a user, you see the shell not just as another program, but as a gateway to others, you add user interaction and shell-to-process interaction. Here comes the third layer, yet nothing has changed for the kernel.

  • very good diagramm, a real eye-opener – Abdul Al Hazred Feb 24 '15 at 1:37
2

I would say your source is false.

There are many different operating systems called "UNIX", but in none of them are shells such "privileged" processes that they form the underlying layer for other userspace utilities.

A shell is just another userspace process.

Not the answer you're looking for? Browse other questions tagged or ask your own question.