CO324 * Computer Systems

advertisement
(and what is it anyway?)
Bob Eager
History of UNIX
1
An overview
 What is UNIX?
 loosely speaking, it’s a computer operating system
operating systems are the programs that ‘run’ computers
 examples of other operating systems are Windows, MacOS X, etc.
 Is it new?
 no, it first saw the light of day in the very early 1970s
 but it has changed and grown a lot since then
 Do many people use it?
 many millions!
 Can I run my Windows programs on it?
 sometimes, but that’s not the point – there are free alternatives

History of UNIX
2
 UNIX is actually a trademark, although it’s used informally for:
 UNIX derivatives :
FreeBSD, OpenBSD, NetBSD, etc.
 UNIX lookalikes (wannabes!):
 ‘Linux’ systems in all their many incarnations
 ‘real’ UNIX™ systems (i.e. those that can legally use the name):
 MacOS X (Apple)
 Solaris (Sun, now Oracle)
 HP-UX (Hewlett-Packard, or HP)
 AIX (IBM)

History of UNIX
3
 so really, it’s merely a name applied to a specification of a system
 but since they all look similar, they get called ‘UNIX’!
 many versions available (mostly open source and free)
 user friendly (ish), but picky about its friends!
 although much more friendly (less hostile?) than it used to be
 for example, it now has a graphical user interface…
 …but the real power lies in the original ‘command line’
 originally, UNIX worked entirely at the command line
 and still does, if you want it that way
 real UNIX users mostly use the command line – it’s very fast and
productive
 here’s a sample…
History of UNIX
4
History of UNIX
5
UNIX features
 originally based around a textual command prompt
 now provides a graphical user interface
 in fact, many different graphical user interfaces
 take your pick – some of the GUIs are excessively bloated!
 multi-user
 proper security
makes it harder to do accidental damage...
 remote access via network (or hardwired)
 extensive networking support
 very rich set of features and applications

So, how did it all start?
History of UNIX
6
Phase I – the mini systems
 UNIX was internally developed by researchers at Bell Laboratories in
the USA, in the late 1960s/early 1970s
 Ken Thompson, Dennis Ritchie, and others (picture soon)
 the initial system (First Edition) was on a spare PDP-7 (an 18-bit
machine), and it was capable of building programs, and text processing
– this was between 1969 and 1971
 by 1973, it had been rewritten in a new language called C. This had
developed from a previous Bell Labs language called B - which was in
turn based on a language called BCPL
 BCPL was developed at the University of Cambridge, UK, in the mid
1960s – a completely typeless language, much more ‘dangerous’
than C!
 in 1975, Sixth Edition UNIX was released to academic and research
institutions - it arrived at Kent in July 1975, being the first system in
England, if not the UK
History of UNIX
7
 Kent’s copy of Sixth Edition arrived on three exchangeable disks of
2.4MB each:
History of UNIX
8
 Here’s the drive it fitted into:
History of UNIX
9
 at Kent, Sixth Edition UNIX ran on a Digital Equipment Co (DEC)
PDP-11/40; a 16 bit machine with 112kB of memory (costing tens of
thousands of pounds)
 this supported 6 simultaneous users (most of the CS students at the
time!)
 if you want to try running this version, a free licence is now available
 disk images and a PDP-11 simulator are available – more later
 the Kent system ran for over 5 years before it was replaced by a VAX
(see later)
History of UNIX
10
 What was this PDP-11?
 made by the Digital Equipment Corporation of Massachusetts
 one of the most successful minicomputers of all time
 at one point, Kent probably had at least ten of them
Bob owns four!
 16 bits, memory from about 56kB up to 2MB or so (mostly at the low
end)
 many possible peripherals
 some in big cabinets, some in deskside towers

 Now for some historical pictures….
History of UNIX
11
 Hardware – a PDP-11/40 CPU! This was in a full height rack (6 feet
high), modules 19 inches wide…this is just the CPU and memory
History of UNIX
12
 More hardware! A big PDP-11 (actually, two), with Ritchie and
Thompson using it:
Dennis
Ritchie
Ken
Thompson
History of UNIX
13
 In the previous picture, note the main I/O device – the teletype; this
ran at 10 characters/second, in upper case only:
History of UNIX
14
 Students needed long term storage (as we use USB sticks today); the
equivalent was the DECtape, storing 300kB or so of data:
History of UNIX
15
 just about small enough to carry around in a (large) pocket…
History of UNIX
16
 a micro PDP-11!
 deskside size
 often used for word processing
 circa mid 1980s
 Bob has one of these...
History of UNIX
17
 Seventh Edition UNIX appeared in 1979, and included various
enhancements. It was a very tight squeeze except on more expensive
PDP-11s (which supported an operating system area of 120kB instead of
56kB)
 at about the same time, an interesting derivative was UNIX 2.9BSD, a
modified version developed by staff (and, largely, graduate students) at
the University of California at Berkeley (the Berkeley System
Distribution, or Berkeley Software Distribution)
 included networking
 again a very tight fit!
 Kent didn’t have an expensive PDP-11, so never really used these a great
deal
 it is said that only two important things came out of Berkeley at that
time: BSD and the drug LSD – and that this is no coincidence!
History of UNIX
18
 Bell Labs also produced ‘Mini-UNIX’, which ran on really small PDP-11s
and supported (effectively) just one user with some limitations (no real
pipes, for example) (~1978)
 still on the PDP-11 series, but low end ones
 this was limited simply because it ran on machines with the
minimum amount of memory, and no memory management
hardware at all
 really just a feasibility project, although fun to look at
 but it was possible to do real work on it
History of UNIX
19
 UNIX source code was not meant to be shown to undergraduates, but
someone actually used it to teach operating systems…
 this was a man called John Lions, at the University of New South
Wales, Australia
 he went further, and in 1977 had the UNIX kernel source code made
into a book, with his own companion volume as a ‘commentary’ on the
code
 probably one of the most interesting computer science/operating
systems publications ever produced
 it was circulated internally in UNSW, and also sold to UNIX
licensees
 unfortunately, Bell Labs/AT&T were not happy, and essentially had the
books rationed to one per company/institution after the first print run
was sold; by 1978 they were completely unavailable
 despite the books being under copyright, “they must be the most
frequently photocopied books in the whole area of computer science”
History of UNIX
20
 they were finally republished as a single volume in 1996 – see link on
website later
History of UNIX
21
 UNIX was (and is) written mostly in the C language; here’s a sample:
/*
* Switch to stack of the new process and set up his segmentation registers.
*/
retu(rp->p_addr);
comments
sureg();
/*
* If the new process paused because it was swapped out, set the stack level to the
* last call to savu(u_ssav). This means that the return which is executed
* immediately after the call to aretu actually returns from the last routine which
* did the savu.
*/
/*
* You are not expected to understand this.
*/
code
if(rp->p_flag&SSWAP) {
rp->p_flag =& ~SSWAP;
aretu(u.u_ssav);
}
/*
* The value returned here has many subtle implications.
* See the newproc comments.
*/
return(1);
History of UNIX
22
 yes, C looks a bit like Java, but pre-dates it by decades!
 the C ‘look’ has been adopted by many other languages
 C is a very low level language, and allows the programmer to do pretty
well anything
 even if it’s dangerous
 even if it makes no sense at all
 which is why it’s fun…
 UNIX systems are written almost entirely in C
 a few hundred lines, at most, may be written in assembler, to
interface with the hardware
 in other words, the innermost layer of our operating system kernel
History of UNIX
23
Phase II – the 32 bit systems
 a major turning point was the transfer to the Digital Equipment VAX
‘supermini’ systems (~1980)
 32 bit machines with, to start with, 1MB of memory
 they were relatively ‘affordable’ compared to the mainframes (also
32 bit) of the time, yet relatively powerful
 the VAX was to be a very influential machine for the next 15 years
 machine architecture based heavily on the PDP-11, so a lot of
expertise from PDP-11s made the re-engineering of UNIX simpler
than it might have been
 the VAX had proper hardware for virtual memory support (that on
the PDP-11 was very limited)
 VAX stood for Virtual Address eXtension
 other machines were also tried, but the VAX dominated by far – it was
to drive UNIX forward for the next few years
History of UNIX - Part 2
24
 UNIX on the VAX was developed from Seventh Edition on the PDP-11,
and was known as UNIX 32-V (it came straight from AT&T, previously
Bell Labs)
 a Berkeley release followed shortly, to be known as 4.0BSD
 it was more popular than UNIX 32-V, which was fairly basic
 BSD became the de facto standard for VAX systems
 subsequent Berkeley releases were called 4.1BSD, 4.2BSD, 4.3BSD
and, lastly, 4.4BSD (this is now publicly available as source code
only, under the name 4.4BSD-Lite)
 you can get 4.xBSD, and run it on a VAX simulator if you want!
 a major BSD contribution was a new shell (command interpreter)
based on the C language (the C shell) - more later
History of UNIX - Part 2
25
 the transfer to the VAX removed the architectural limitations on
program size, etc., allowed proper virtual memory, and provided much
increased computing power
 Kent acquired a VAX-11/780 (~1 million instructions/second) in
1979/80, and this was a significant computer science teaching system
for some years; initially it was just called unix, later renamed to eagle
 it had approximately 300MB of disk space, and 1 MB of memory
 it supported 20-30 users, initially running UNIX-32V, then 4.0BSD,
all the way through to 4.3BSD
 it was soon supplemented by a VAX-11/750 (~600 thousand
instructions/second) for departmental use, also running 4.xBSD, called
comet (well, the pesky students were using eagle far too much)
 these were eventually replaced at Kent by various other machines from
various manufacturers, latterly from Sun, for example, and others
History of UNIX - Part 2
26
 The Kent VAX-11/780 (eagle)
tape
drive
30MB
tapes
glass
teletype
100MB
disk
History of UNIX - Part 2
27
 A VAX-11/750 (like comet) – about 1.5 metres tall
boot selector
switch
tape drive for
software
installation etc.
(capacity 360kB)
History of UNIX - Part 2
28
 UNIX development meanwhile continued at AT & T, culminating in
1983 in a different, incompatible, UNIX system known as System V
 there were various releases, the most common being release 4.2
(SVR4.2) in 1989, unifying contributions from System V and BSD
(and other variants)
 these notably included the C shell, and the underlying support
for it
 this was licensed to many vendors who added their own
modifications and names (often ending in -ix!)
 meanwhile, other vendors had formed the X/Open Company (now
known as ‘The Open Group’), who wanted to produce a single
specification for an open system, based on UNIX
 in 1994, after a lot of messy politics, the UNIX™ trademark and the
‘Single UNIX Specification’ were transferred to X/Open
History of UNIX - Part 2
29
 also in 1994, BSD4.4-Lite was released, eliminating all code still
claimed to rely on the commercial version. This version was merely a
collection of source code, and was not absolutely complete; it did
however show what could be used, and what could not
 this is available if anyone wants to have a look, for interest
 in 1995, the UNIX branding programme was introduced; this still exists
and is the basis of ‘commercial’ systems
 note that any system creator can apply to have it certified as UNIX™
 it must comply with the Single UNIX Specification, but need not
use any particular set of source code
 e.g. MacOS X is loosely based on BSD
 Solaris (Sun, then Oracle) based more on System V
 but both are UNIX™
History of UNIX - Part 2
30
A GNU interlude
 before going into Phase III, let’s backtrack a little…in time!
 we’ll visit a group of ‘hackers’ (programmers, not security breakers) at
Massachusetts Institute of Technology (MIT)
 this would be from the early 1960s, all the way to 1981 or so
 they worked in a laid back, co-operative way, freely giving away any
programs etc. that they wrote, and modifying others they were given
 things changed, and most of them left; those that remained had to use
commercial software that they couldn’t hack around, and they were no
longer as free to give away their work either
 one person decided that this was wrong, and that software should be
free and unencumbered
 a software socialist!
History of UNIX - Part 2
31
 his name was...Richard Stallman...!
 any similarity to School of Computing staff is entirely coincidental...
 Stallman resigned from MIT, and started a ‘free software’ project
 ‘free’ as in ‘no strings attached’ rather than ‘never any payment’
 the plan was (eventually) to produce a complete UNIX-like system that
wasn’t UNIX, but would look the same
 the project was called GNU – a recursive acronym standing for “GNU’s
Not UNIX”
The GNU logo
Stallman
History of UNIX - Part 2
32
 the first product was going to be a C compiler, but it ended up being an
editor program called EMACS – one of the most powerful editors
available, because it’s ridiculously extensible
 in it, you can:
 play Tetris, Towers of Hanoi
 check phases of the moon
 have a Java development environment
 manage files
 etc.
 it is programmed in a language called LISP, with a large library of
stuff
 EMACS was also considered ridiculous because it was a very big
program
 a common joke was that EMACS stood for ‘Eight Megabytes And
Continually Swapping’
 another was “You means that EMACS can edit files, too?”
History of UNIX - Part 2
33
Here is EMACS
- running Tetris!
History of UNIX
34
 copies of EMACS are available on most platforms
 the ancestor of EMACS was an editor called TECO – real masochists
can try and use it – it’s available for most platforms
 here’s the TECO commands to create a file containing “Hello World”
and display that line:
*IHello World
$$
*-1t$$
Hello World
*ex$$
 (computer output in red above)
 one can also, apparently, use it to solve differential equations…
 for more information:
 http://en.wikipedia.org/wiki/TECO_%28text_editor%29
History of UNIX - Part 2
35
 the next GNU product was the C (and C++) compiler, gcc
 lots of other programs (often quite feature-heavy) followed
 really, LOTS...
 see http://www.gnu.org
 all the software was released under the GNU Public License (GPL)
 this said that you could do what you liked with it (even sell it) but
must provide all source code (including anything you added) free of
charge
 the license is still similar, but there are variants as it is sometimes too
restrictive
History of UNIX - Part 2
36
 eventually the GNU Project produced an operating system (HURD),
although it wasn’t really suitable for general use – it was slow and
underdeveloped
 so GNU became:
a software project looking for an operating system....
 (although HURD is not quite dead....)
 the GNU Project is sponsored by a non-profit organisation called the
Free Software Foundation – which promotes the idea of free software:
 http://www.fsf.org
Back to our story...
History of UNIX - Part 2
37
Phase III – the PC and beyond
 the earliest PC UNIX is probably PC-IX, developed by IBM for the
PC/AT (~1984) – an 80286 machine
 very few copies of this were sold; it was mainly an ‘executive toy’
 the 80286 had memory management hardware, but it was awful –
inferior to that on the old PDP-11/40
 various vendors provided UNIX over the next few years, but most
systems were expensive and needed expensive hardware
 UNIX still hadn’t properly cracked the commercial market
 the eventual breakthrough was gradual, and came via “free
software”…the catalyst was a system called:
MINIX
History of UNIX - Part 2
38
 in 1987, an academic named Andrew Tanenbaum wrote a book on
Operating Systems, with a real, small, UNIX-like system (called Minix)
as a working example; available free to students and educators
 all it needed was an IBM PC (or compatible) with two 5.25” floppy
drives (360kB each) – but it ran on other hardware too
 Bob used an IBM PC Portable he had lying around:
 the system was immensely popular, and versions were developed for
other hardware of the time such as the Atari ST and the Apple
Macintosh (not the Mac we know today)
 all versions came with complete source code, and the ability to modify
and rebuild any part of the system
History of UNIX - Part 2
39
Atari ST
Apple Macintosh
History of UNIX - Part 2
40
 the PC version of the system was the most popular:
 it initially required no more than a low end PC, an 8088 system with
two 5¼" floppy disk drives (capacity 360kB each)
 later versions supported hard disks, and indeed required them
 later still, network support was added
 latest version was released relatively recently (well, 2008)
 but it is essentially a teaching tool, and was never intended for real
production work
 it came complete with a textbook
 this didn’t stop people around the world from ‘improving’ and
extending it for several years
 various warring ‘splinter groups’ developed!
 it’s still around, but wouldn’t be used for serious work
However….
History of UNIX - Part 2
41
Linux
 in 1991, a Finnish postgraduate named Linus Torvalds had written a
derivative of MINIX; the first stable release appeared in 1994.
 known as Linux (pronounced lee-nooks, according to Linus)
 very different architecture to UNIX or BSD, since it was written from
scratch (but inspired by Minix)
 similar functionality, but definite differences both internal and
external
 not very well documented, at least in comparison to BSD
 it was free!
it was an operating system project looking for software....!
 Torvalds really just produced the operating system kernel, and relied
on other projects (notably the GNU Project) to provide all of the
necessary other programs (compilers, utilities etc.)
History of UNIX - Part 2
42
 the packaging of the Linux kernel with different combinations of
commands, installers etc. has resulted in many, many different
distributions of the basic Linux system (e.g. Debian, Ubuntu...)
 some concentrate on ease of installation, others on building a
system from scratch, others on reliability….
 there are also specialised embedded versions, e.g. for firewalls…
 it can be hard to choose! but there are ‘distro wars’…
 the Linux ‘mascot’ is called Tux:
History of UNIX - Part 2
43
BSD revisited
 a parallel development to Minix was a version of BSD developed for the PC (the 386
and above, because they had proper memory management)
 it was known as 386BSD, and was the result of a ‘falling out’ (academic vs.
commercial) between researchers and ‘establishment’ at UCB; the researchers
(Bill Jolitz and Lynne Greer Jolitz) wrote a series of articles in Dr Dobb’s Journal
on ‘Porting UNIX to the 386’
 the first version of 386BSD was pretty unstable, and was ‘corrected’ by many
enthusiasts around the world, who eventually amalgamated into a group which
produced a system called FreeBSD
 once again, other groups existed, and there are two principal ‘other’ BSD systems
called OpenBSD (concentrating on standardization, correctness, security, and
cryptography), and NetBSD (specialising in high portability), although FreeBSD has
the largest installed base as a more general purpose system
History of UNIX - Part 2
44
 all of the BSD systems are based on the same source code, and are
therefore well documented by the many books written about BSD, as
well as by the BSD manuals and many academic papers
 BSD runs on a lot of different hardware, including:
 PC (386 upwards, including AMD and VIA chips as well as Intel)
 various Sun hardware
 ia64
 Digital Alpha and VAX
 Motorola 680x0 and 881x0 systems
 ARM
 PowerPC
 Xbox
 Raspberry Pi
 (Linux runs on quite a few too)
History of UNIX - Part 2
45
 BSD has its own mascot, called Beastie. There have been some religious
objections to it, but it remains the generic historical BSD mascot:
History of UNIX - Part 2
46
A diversion - nanoBSD
 what is nanoBSD?
 it’s a build of FreeBSD for embedded systems or ‘appliances’
 actually just a normal FreeBSD system, built to run from a read-only
system disk
 RAM disks are used for temporary files
 system does not page or swap
 can run all of the usual utilities, but may need to store them on
another machine
 advantages include: increased reliability (less to break), lower power
consumption, less noise and heat
 typical applications:
 firewall or router
 DVD player
 iPlayer appliance
History of UNIX - Part 2
47
 here is an example; it uses 15 watts of power, has no hard disk, and runs
from a Compact Flash card:
CF card
History of UNIX - Part 2
48
The Raspberry Pi
 the Raspberry Pi is a cheap, basic system designed for educational use,
although currently its principal use seems to be in various (often
bizarre) embedded applications!
 roughly the size of a credit card
 cost around £25-30 as a bare board
 needs USB peripherals, a power supply, and an SD card for storage
 700MHz ARM processor, integrated graphics
 the most common model (Model B) has a network interface
 video:
 RCA composite video (phono plug)
 HDMI video (standard HDMI plug)
 512MB RAM (earlier models had 256MB)
History of UNIX
49
8.5 cm
5.5 cm
History of UNIX
50
History of UNIX
51
The MakerSpace
 also known as ‘the Shed’ – in the quadrangle behind Computing
 this provides facilities for playing with things such as Raspberry Pis,
and much more
 tools and machinery as well as soldering, etc.
 a chance to experiment with hardware at levels lower than just
plugging things in
 we have some Raspberry Pis to play with
 just turn up and take a look – but not all at once…
History of UNIX
52
User interfaces
 all UNIX systems still have the command prompt, which can be
particularly fast and productive
 however, nearly everyone wants a graphical interface at times, and this
is usually (except for MacOS X) provided by a development of the ‘X
Window System’, now known as ‘Xorg’
 Xorg just provides a basic windowing system, and you can then add a
desktop environment on top of that
 two common ones are Gnome and KDE
 many others are available; Bob uses a lightweight one called LXDE
History of UNIX - Part 2
53
 here’s a screenshot of an LXDE desktop:
History of UNIX - Part 2
54
So, what now?
 if you’re a Kent computing student, you can (and will!) use UNIX on




the School’s systems
 initial access via http://www.cs.kent.ac.uk/systems/newuser/
you can install Linux or BSD on an old/spare computer
 systems can be downloaded from our Mirror Service, which is really
fast on campus
you can buy a Mac!
or a Raspberry Pi...
some facts:
 some people in the School use Linux
 others (including Bob) use FreeBSD
 the display screens in the School (e.g. in the common room) run on
FreeBSD (or did…)
 quite a few staff also use Macs
History of UNIX - Part 2
55
Resources
 there are lots of links and stuff here, including a copy of today’s
presentations (soon):
http://unixhistory.tavi.co.uk
Have fun!
History of UNIX - Part 2
56
Download