Understaning the basics?

Soldato
Joined
3 Dec 2004
Posts
2,625
Hi all,

Although I love computers and working with them, my knowledge of what exactly 'goes on' is limited.

Is my understanding of the following right;

Unix was where things took off, it built the foundations of what the majority of computers were based on thereafter. 'Windows' was mainly a UI of controlling the environment?

The major downside of UNIX is that its source code is protected. Linux sort to change that be making another 'foundation' and letting it become freely available?

'kernels' are like the controllers of the environment. A bit like ubuntu and windows?

^Is any of that right or do I fail miserably :)
 
Not quite. If I understand your statement about Windows being a controlling UI, then I'd point out that Windows is not based on Unix.

Unix is one example of a 'POSIX' compliant OS. POSIX is a set of standards which define API's. There are various Unix-like OS's. Unix, Linux and BSD are some of them.

The Linux kernel was created by Linus Torvalds and adhered to the POSIX standard. This was independent of Bill Gates Windows. Windows is not a POSIX compliant OS and is not built on top of any Unix/Linux/BSD code.

However, if you look at Apple's Mac OSX that is a GUI on top of BSD which is POSIX compliant. Most parts of proprietary Unix distributions (such as IBM's AIX and HP's HPUX) are indeed protected. But in most cases there is an open source version of that component in the Linux and BSD world. Windows is an entirely closed source OS which is owned and written by Microsoft. It did not grow out on any form of Unix.

If anyone is interested in the origins of the Linux kernel that Linus Torvalds biography Just For Fun is an excellent read.
 
Last edited:
Hi all,

Although I love computers and working with them, my knowledge of what exactly 'goes on' is limited.

Is my understanding of the following right;

Unix was where things took off, it built the foundations of what the majority of computers were based on thereafter. 'Windows' was mainly a UI of controlling the environment?

The major downside of UNIX is that its source code is protected. Linux sort to change that be making another 'foundation' and letting it become freely available?

'kernels' are like the controllers of the environment. A bit like ubuntu and windows?

^Is any of that right or do I fail miserably :)

Personally I wouldn't really say Unix "build the foundations of computers". Unix was the firstly OS to be ported across to a decent number of platforms which is very much behind it's influence. Although there are actually quite a few commonalities between Unix and Windows - Windows is in no way a GUI to Unix. The major GUI to Unix is
the X windowing system (X11).

Kernels control most low level functionality - file system interaction, processing management etc. Linux uses a monolithic kernel - essentially (and perhaps this is a little harsh but hey) it's very bloaty it's got stuff like device drives running in Kernel space (an area of memory with pretty much global access and high run privileges).

I'd say by far the "best" thing about Linux is how portable it is, the sheer number of supported platforms is insane. This is mainly due to the fact that the Linux kernel is written in C.
 
Thanks for replies guys. I have to admit I'm slightly more confused now though :)

So the most basic level is Binary. How this code is used and interpreted is what defines it as a language?
If that's right, when someone says "they are programming in C++", what they actually mean is in an environment where the rules and interpretations have been set?

I've a lot more questions but they are only valid if the above ^ is true.
 
Last edited:
Thanks for replies guys. I have to admit I'm slightly more confused now though :)

So the most basic level is Binary. How this code is used and interpreted is what defines it as a language?
If that's right, when someone says "they are programming in C++", what they actually mean is in an environment where the rules and interpretations have been set?

I've a lot more questions but they are only valid if the above ^ is true.

Your processor executes machine code[1]. Programmers use a compiler [2] which will create CPU executable machine code given high level language code (E.g. C++ / C code)

When someone says they are "programming in C++" that's exactly what they mean, they are writing C++ code.

Note in the context of cross platform development. Each architecture has it's own instruction set I.e. a set of functions that the CPU can perform. So this is why each architecture has will have it's own compilers.

[1]http://en.wikipedia.org/wiki/Machine_code
[2] http://en.wikipedia.org/wiki/Compiler
 
Last edited:
Kernels control most low level functionality - file system interaction, processing management etc. Linux uses a monolithic kernel - essentially (and perhaps this is a little harsh but hey) it's very bloaty it's got stuff like device drives running in Kernel space (an area of memory with pretty much global access and high run privileges).

So what exactly are the advantages of running device drivers at the application level?

C is the programming language. It's the set of instructions by which the developers have to follow to stay within the confines of the language, of which C is a good choice because it was essentially designed for Operating Systems. There are a few Java based OSes out there but they are horrible to use and have no real advantages other than 'just because'.
 
So what exactly are the advantages of running device drivers at the application level?

C is the programming language. It's the set of instructions by which the developers have to follow to stay within the confines of the language, of which C is a good choice because it was essentially designed for Operating Systems. There are a few Java based OSes out there but they are horrible to use and have no real advantages other than 'just because'.

There are many advantages to having device drives moved into user space rather than kernal space, a classic example is security. The argument is (and it's valid in most environments) the device driver code cannot be fully trusted, yet it runl with privileged access (so they could, if they liked overwrite areas of memory with where the kernel itself is residing). Device drivers can provide a *very very* nasty platform for an attack, and are often exploited in rootkits
 
Last edited:
Your processor executes machine code[1]. Programmers use a compiler [2] which will create CPU executable machine code given high level language code (E.g. C++ / C code)

http://en.wikipedia.org/wiki/Compiler

Thanks again guys,

So my assumption that Binary is the most basic form is right? I.e raw data?

So, the CPU controls the binary code based on how it was used by the languge (c++, java or anything else). This then gives 'machine code' which is the processed data?
 
So what exactly are the advantages of running device drivers at the application level?

As above, security is really the best reasoning :) Additionally though, if a hardware device driver crashes (and they do) do you want it to bring down the kernel/entire system or just fail gracefully in user-space. It's also much easier to run a debugger in user-space than inside the kernel.
 
Thanks again guys,

So my assumption that Binary is the most basic form is right? I.e raw data?

So, the CPU controls the binary code based on how it was used by the languge (c++, java or anything else). This then gives 'machine code' which is the processed data?

The CPU executes machine code, which can have binary or hexadecimal representations.

Take an example. This is a simple C program that prints "Hello World" (which originates from K&R's 'The C programming language" - excellent book);

Code:
1	#include<stdio.h>
2	#include<string.h>
3	
4	main(){
5	  printf("Hellow World \n");
6	}

Now in assembly (IA32 instruction set) this is:

Code:
lea    0x4(%esp),%ecx
and    $0xfffffff0,%esp
pushl  -0x4(%ecx)
push   %ebp
mov    %esp,%ebp
push   %ecx
sub    $0x14,%esp
movl   $0x80484b0,(%esp)
call   0x80482f4 <puts@plt>
add    $0x14,%esp
pop    %ecx
pop    %ebp
lea    -0x4(%ecx),%esp
ret

And finally in machine code (middle), with the assembly beside it (right):

Code:
80483c4:	8d 4c 24 04          	lea    0x4(%esp),%ecx
 80483c8:	83 e4 f0             	and    $0xfffffff0,%esp
 80483cb:	ff 71 fc             	pushl  -0x4(%ecx)
 80483ce:	55                   	push   %ebp
 80483cf:	89 e5                	mov    %esp,%ebp
 80483d1:	51                   	push   %ecx
 80483d2:	83 ec 14             	sub    $0x14,%esp
 80483d5:	c7 04 24 b0 84 04 08 	movl   $0x80484b0,(%esp)
 80483dc:	e8 13 ff ff ff       	call   80482f4 <puts@plt>
 80483e1:	83 c4 14             	add    $0x14,%esp
 80483e4:	59                   	pop    %ecx
 80483e5:	5d                   	pop    %ebp
 80483e6:	8d 61 fc             	lea    -0x4(%ecx),%esp
 80483e9:	c3                   	ret

(apologizes for the formatting for the last code extract)

(Also I should say this is my understanding of it, so I stand to be corrected)
 
Last edited:
In the beginning there was unix, it was proprietary and set a lot of people's expectations of OSs.

Then came other stuff like minix, which was a proprietary "unix like" OS, with a more advanced "micro-kernel" unlike unix's "monolithic" kernel.

Then came GNU, the beginning of the open-source movement, started by Richard Stallman. They wanted to make an entire system and started with tools (like bash), which people compiled and used on unix, minix, etc.

GNU were making (and still are making) a micro-kernel called Herd. But then in 1992 a Finnish student called Linus Torvalds quickly made an open-source monolithic kernel called Linux, and the majority of GNU people went to an OS using GNU tools and a Linux Kernel, hence distros like Debian GNU/Linux (what Ubuntu is based on) arrived.

Windows arrived in the 80s, they have moved through several kernels and now use a micro-kernel called NT. There is NO unix in windows.


That's about the gist of it.
 
Many thanks for replies guys, and sorry for late reply.
I still very interested in all this but realise it's going to take a lot more reading and researching for me to understand :) I'm going to purchase a few books on the subject.

The CPU executes machine code, which can have binary or hexadecimal representations.

So am i right in saying that computer hardware gives out pure binary as a representation of its current state? It's the CPU's job to turn this into machine code via a language (and presumably something usable/useful)?

GNU were making (and still are making) a micro-kernel called Herd. But then in 1992 a Finnish student called Linus Torvalds quickly made an open-source monolithic kernel called Linux, and the majority of GNU people went to an OS using GNU tools and a Linux Kernel, hence distros like Debian GNU/Linux (what Ubuntu is based on) arrived.


I thought though that the unix source code was still protected. How did Linus manage to get round making an open-source project yet still based (and built?) on unix?
 
Last edited:
In the beginning there was unix, it was proprietary and set a lot of people's expectations of OSs.

Then came other stuff like minix, which was a proprietary "unix like" OS, with a more advanced "micro-kernel" unlike unix's "monolithic" kernel.

Then came GNU, the beginning of the open-source movement, started by Richard Stallman. They wanted to make an entire system and started with tools (like bash), which people compiled and used on unix, minix, etc.

GNU were making (and still are making) a micro-kernel called Herd. But then in 1992 a Finnish student called Linus Torvalds quickly made an open-source monolithic kernel called Linux, and the majority of GNU people went to an OS using GNU tools and a Linux Kernel, hence distros like Debian GNU/Linux (what Ubuntu is based on) arrived.

Windows arrived in the 80s, they have moved through several kernels and now use a micro-kernel called NT. There is NO unix in windows.


That's about the gist of it.

That's not to say that it's as simple as the Mico Kernel is superior to Monolithic.

http://en.wikipedia.org/wiki/Tanenbaum–Torvalds_debate
 
I thought though that the unix source code was still protected. How did Linus manage to get round making an open-source project yet still based (and built?) on unix?

It is, and he didn't; Linus made a kernel from the ground up, it contains no Unix, it simply conforms to POSIX standards.
 
It is, and he didn't; Linus made a kernel from the ground up, it contains no Unix, it simply conforms to POSIX standards.


Ahh I see. So linux is actually only BASED on unix and not actually BUILT-on it? 'based on' meaning many of the ideas and similarities remain in Linux? That's what it was getting confused with.

Also, when a piece of sofware becomes 'copyrighted' and not open-source. Is it possible for programmers to actually see the coding that was used? I.e can the public see for example the coding used in vista or is it physically heavy protected?
 
Last edited:
"Based" is the wrong word. Just say Linux is "Unix like".

And no, you can't see Vista code.

Open souce code technically is copyrighted too, just the Intellectual Property owner has allowed us all to see and use his code under the GNU GPL (General Public License) or some other open source license.
 
Erm if your book is on C then you really need to use that not Visual Basic.

If you are running linux then you can install (or may have already installed) the gcc C compiler.
 
Erm if your book is on C then you really need to use that not Visual Basic.

If you are running linux then you can install (or may have already installed) the gcc C compiler.

:) Ahh right. I was always under the impression VB was an environment and not an actual language?

I'm using XP.
 
Back
Top Bottom