Unix - part 1

Key Concepts

O S Structure


    +---------------+
    |  shell        |
    |  +---------+  |
    |  | kernel  |  |
    |  |         |  |
    |  +---------+  |
    +---------------+
The kernel deals with The shell sits on top of the kernel, and uses it. Shell provides On top of all this, there are several GUI systems we can run, which give it windows, mouse facility.

Linux

Many components for a PC version of Unix were created before Linus arrived.
But he wrote the kernel, resulting in a PC open-source version of Unix for PC was available - Linux.

Filing System

Allows 'proper' sharing of files. Each file can have 3 categories of protection There are also 3 categories of user We can combine these to produce a range of levels of protection for each file and/ or folder, e.g:

I.O. redirection and pipes

We can use > to redirect the output of a program into a file
If we type the ls command , it displays our file names, as in:

ls                      (we type)
fred.java               (displayed by the ls command)
test.txt
Now we type:

ls > myfiles
nothing is displayed - what would have been displayed is placed in the new file named 'myfiles'

Now we will use the wc (word count) tool, which counts the number of lines in its input data.
We use < to send a data file to it.

wc < myfiles
We can also send the output of one program to the input of another program, without using a file. We use the pipe |
ls | wc
Both programs appear to run at the same time, in RAM. A pipe is a queue of characters held in RAM.
Data flow:
                            characters in transit
                 ls ------>---------------------->--------- wc
                      queue back             queue front
behind the scenes, the kernel switches between ls and wc.
Q: when must ls and/or wc wait?

Summary