UNIX

From XPUB & Lens-Based wiki
Revision as of 19:29, 25 October 2016 by Andre Castro (talk | contribs)

Beginnings of Unix

After being withdrawn from project Multics Ken Thompson and Dennis Richie started writing UNIX in 1969 at AT&T Bell Labs.

Thompson&Richie.jpg

Ken Thompson and Dennis Richie found themselves at the Bell Labs without much hardware or funding.

Having to resort to discarded hardware and influenced by their experience of Multics, they start developing UNIX, a super slim operating system, that could run in hardware available and yet include some of appealing features of Multics.

Features of UNIX

Some of the features of UNIX were influenced from Multics,

  • it was time-sharing system, allowing for mutiples users to login to the machine ssh username@machineIP
  • included the shell: a program which performs command line interpretation ** whoaim
    • pwd print working directory - where am I?
    • date
    • users print the user names of users currently logged in to the current host
    • history commands' history
  • tree-structured file system
    • tree ~/ list contents of home (~ == /home/username ) in a tree-like format
    • ls ~ list files and directories in your user home ( ~ == /home/username )
    • ls . list files and directories in current directory ( . == current dir )
    • ls ../ list files and directories in parent directory ( . == current dir )
    • ls foo/ list files and directories in child foo/ directory
    • ls / list files and directories in root ( / == root )

Others emerged from the development and use of the system and crystallized into the Unix Philosophy:

  • Write programs that do one thing and one thing well
    • ls lists files in a directory
    • cat outputs content of file
    • wc counts number of words in file
  • Write programs that work together
    • echo "hello UNIX world" | sed 's/o/0/g' | sed 's/e/3/g' | sed 's/l/1/g' | figlet
  • Write programs that handle text streams, because that is a universal interface
    • man -a intro | espeak Linux introduction to user commands.


command arguments

Arguments are like option and or switch of a command-line program.

Some times they have values to them other times they don't.

Some times indicate with one "-" sometimes with two "--"

In man -a intro -a is an argument.

In cowsay --e '@@' -T 'jj' 'What are the arguments doing?'

Figure out what each argument does in these two commands?

Distribution of UNIX

Although UNIX was property of Bell Labs and AT&T it was not commercialized.

As AT&T was a state owned monopoly that controlled the US phone service it was legally forbidden to get into the software market.

Instead of making into a market, UNIX remained more of non-commercial. For a low price UNIX could be installed and changed to create derivatives. Yet UNIX's and its derivatives could only be distributed by AT&T. (How was Minix distributed???)

Source code

Rather than distributing UNIX and its tools only as binary files, its source code was an integral part of distribution.

Given the lack of documentation in its early years, the availability of source code made possible for users to study and understand undocumented parts of the system.

In Linux distributions download the source code is also possible, by instructing the package manager apt-get to --download-only the source code for cowsay program or any other program sudo apt-get --download-only source cowsay

 _______________________________________
( apt-get --download-only source cowsay )
 ---------------------------------------
        o    ,-^-.
         o   !oYo!
          o /./=\.\______
               ##        )\/\
                ||-----w||
                ||      ||

               Cowth Vader

Modifications & Distribution

The availability of the source code also allowed users to modify, fix and improve parts of the system, by changing its source code.

These changes constituted a significant development contribution to official distribution of UNIX, and Thompson and Richie eagerly integrated them into the official distribution.

What constituted a technical development brought unclarity to the ownership of UNIX. With code written by several users mingling with code written at Bell Labs was UNIX still the property of AT&T?

To go with the unclear ownership informal distribution where a tape with changes was circulated informally outside AT&T control.

man pages

Man(ual) pages - online documentation found on a Unix or Unix-like operating system - began to be written in 1971.

Combined with the availability of the source code, the documentation of the system and its tools made UNIX a popular teaching tool.

Currently, nearly all applications come with a man page, which can be called with man application_name. But also components of the operating system have man pages, such as files, system overview.

An extensive list Linux of man pages can be found in https://www.kernel.org/doc/man-pages/

Forking UNIX: Minix

Given its success and possible commercial viability UNIX Version 7 (1979) was released with a license that prohibited its source code from being studied.

UNIX had been for years a learning tool in computer science departments, as it allowed students to first hand study, modify and get to understand the inner-workings of the operating system.

University were now being asked to drop UNIX.

Andrew Tanenbaum who was teaching and using UNIX as a teaching tool at the Vrije Universiteit in Amsterdam, instead of complying decide to write a new UNIX like operating system called Minix. He did so without using a single line from the UNIX source code, but writing it from scratch, so that he and his students could continuing using it a learning tool.

Although conceptually close to UNIX, Minix was a different legal object, outside the control of AT&T.

Forking Minix: Linux

As UNIX spred through computer science departments so did Minix.

In 1991-1998 a Helsinki computer science student named Linus Troval sent an email to the comp.os.minix user group

    From: torvalds@klaava.Helsinki.FI (Linus Benedict Torvalds)
    Newsgroups: comp.os.minix
    Subject: What would you like to see most in minix?
    Summary: small poll for my new operating system
    Message-ID: <1991Aug25.205708.9541@klaava.Helsinki.FI>
    Date: 25 Aug 91 20:57:08 GMT
    Organization: University of Helsinki

    Hello everybody out there using minix –

    I’m doing a (free) operating system (just a hobby, won’t be big and
    professional like gnu) for 386(486) AT clones. This has been brewing
    since april, and is starting to get ready. I’d like any feedback on
    things people like/dislike in minix, as my OS resembles it somewhat
    (same physical layout of the file-system (due to practical reasons)
    among other things).

    I’ve currently ported bash(1.08) and gcc(1.40), and things seem to work.
    This implies that I’ll get something practical within a few months, and
    I’d like to know what features most people would want. Any suggestions
    are welcome, but I won’t promise I’ll implement them 🙂

    Linus (torvalds@kruuna.helsinki.fi)

    PS. Yes – it’s free of any minix code, and it has a multi-threaded fs.
    It is NOT protable (uses 386 task switching etc), and it probably never
    will support anything other than AT-harddisks, as that’s all I have :-(.
  • emphasis on Forking
  • Stallman: Free Software and motivation
  • Intersection with Stallman: forking UNIX - writing tools. Writing GPL
  • Linus licensed Linux under GPL as it was he had used the GNU C Complier
  • The Kernel was an important element missing from the GNU project
  • Linux distributions


What did not fit into the story

every thing is a file

== package managers

  • Linux:
    • aptitude
    • apt-get (lower level)
    • synaptic (graphic)
  • Mac OsX