## LSU EE 3755 Spring 2002 Homework 5
 ## Due Wednesday, 24 April 2002

 ## WARNING:  Those who print this will only need to print about one third of this file,
 ## the rest contains sample text for Problem 2.  The last printed page should contain
 ## the sample text, "The GNU Project".  On my copy of Microsoft Internet Explorer
 ## (Version 6.0) this worked out to pages 1-7, YMMV. 

        .asciiz ""  # Put your name between the quotes.

  # It is expected that the person above completed (or at least gave a good
  # try at) this homework assignment.  Collaboration is allowed, but
  # highly asymmetric collaboration is not.  Use these guidelines:
  # Okay:  Discussing solution strategies with classmates, friends,
  #        faculty, intelligent pets, netnews correspondents, etc.
  # Okay:  Asking above-listed people for a hint when you're stuck.
  # Okay:  Peeking at a classmate's solution to see how a particular
  #        instruction is used.
  # Can't: Copy someone's solution, even if it's your [girl|boy]friend.
  # Can't: Search for a MIPS assembler solution for the problems posed here,
  #        that includes textbooks, Web searches, etc.  
  # Can't: Copy and modify a solution.
  # Why Not?
  #  Because the point of the homework assignments is to learn the
  #  material and how to write code; for engineers (and many others)
  #  learning is not just memorizing.

 ## Instructions:
  # Copy this to a file, local path name
  # /home/classes/ee3755/com/s/hw05.s, to a directory ~/hw in your
  # class account. (~ is your home directory.)  Use this file for your
  # solution.
  # Procedure shells have been provided for each problem.  Place
  # your solution within the respective shells.
  # The code at the top runs a test on each problem.  That code can be
  # modified, for example, only calling the test for the problem
  # currently being worked on.
  # Your entire solution should be in this file.  
  # Do not rename the line labels in this file and be sure to use the
  # directory and filename given above.  (Line labels may be added.)
  # Instructions for each problem (0, 1, and 2) are provided below, followed
  # by the main routine and solution shells.

 ## Additional Resources
  # MIPS Architecture Manual Volume 2 (Contains a list of instructions.)
  #     http://www.ece.lsu.edu/ee4720/mips32v2.pdf
  #      Note: SPIM implements MIPS-I instructions.
  # SPIM Documentation:
  #      Appendix A of Patterson and Hennessey.
  #     http://www.ece.lsu.edu/3755/spim.pdf

 ## Grading Criteria
  # The code must pass the tests in this file, and similar tests.
  # The code must be reasonably efficient.
  # Points will be DEDUCTED for needlessly setting a register to zero!!!!
  # For example, instead of doing this:
  #   add $2, $0, $0   # This instruction not needed!!!!!!!!!!!!!!!!!!!
  #   or  $2, $3, $4
  # Do this:
  #   or  $2, $3, $4

## Problem 0

# Before making any changes to this file (other than comments) run
# the assembler/simulator SPIM using the following steps:

#  Load this file into an Emacs buffer using the class-account Emacs.
#  Start the SPIM assembler/simulator by pressing [F9].
#    -> A window entitled "xspim" should pop up.  The top pane should show
#       register values, the next pane should have buttons, the third
#       should show the program in binary and assembler forms, the fourth
#       pane shows the data area, and the bottom pane (which might extend
#       past the bottom of the screen) shows messages.
#  Run the program by clicking the "run" button then clicking "ok" on the
#  dialog box that pops up.
#    -> A window entitled "SPIM Console" should pop up, the window
#       should be asking you to include your name in this file.  After
#       a name is entered and Spim is re-run it should print fail
#       messages for the two problems.  For Problem 0 those fail
#       messages indicate success!!!

 ## Note on SPIM
# Clicking the close button (usually the upper-right-hand button on
# the window frame) of any window will immediately exit SPIM.

 ## Troubleshooting
# Make sure that the "run" dialog box shows 0x0400000 for the starting
# address.  If not, __start was not properly defined, possibly due to
# an error before __start.
# Check the messages (bottommost) pane for syntax and other errors.  It
# may be necessary to shorten other panes to make the messages pane visible.
# Common syntax errors include using "addi" instead of "add", or vice versa.
# Another common error is mistyping a label in a branch or jump target.
# Check the "Text Segments" pane to make sure all of your program is there.
# If not, there may have been an error reading the program.
# If your program fails a test or otherwise does not produce the
# expected output modify the test code so that the particular test it
# fails comes first (if it's not already).  Then, single-step the code
# (using the "step") button until you find the problem.
# The item above can save lots of time for some people but it requires
# using the step command and figuring out a little bit about the test
# code, which is something you don't otherwise have to do.  Therefore
# those who rarely make programming errors can skip it.  Why spend
# five minutes looking over test code when you'll find the bug in 90
# seconds by studying the stuff that you wrote!  :-)

## Problem 1 Description

# Complete routine deposit below so that it inserts a few bits of one
# number (d, below) in another number (N, below) as follows:
# Input Values: 
#  $a0:  N:  Number in which to insert another number.
#  $a1:  p:  Starting position of N at which to insert bits. (0 is LSB)
#  $a2:  s:  Number of bits to insert, always positive.
#  $a3:  d:  The bits to insert.  Extra bits (more than s) are ignored.
# Return Value:
#  $v0:  N with bits p to p+s-1 replaced with d.
# Examples:
#  N            p  s  d     Return Val.
#  0            0, 4, 0xe,  0xe            # Insert 0xe within 0 starting at 0
#  0            0, 4, 0x3e, 0xe            # Use 4 bits of b, ignore 3 digit.
#  0x12345678,  4, 8, 0xee, 0x12345ee8     # Insert 0xee at position 4
#  0x12345678, 24, 8, 0xee, 0xee345678     # Insert 0xee at position 24

## Problem 2 Description

# Complete routine word_count below so that it counts the number of
# times a word appears in text.
# Input Values:
#  $a0:  Address of text to scan.
#  $a1:  Address of string (word) to search for.
# Return Value
#  $v0:  Number of times string (word) appears.

# The text and word are stored as a C-format string: a sequence of
# ASCII bytes ending with a zero.

# Do not worry about word delimiters.  (If you don't know what that
# means you're probably not worrying about it, so don't worry about
# not knowing what it means.)
# For example, in the text "there's the other lathe" word "the" should
# match four times. (It would match just once if we were worrying
# about delimiters.)

# A character should only be counted once.  For example, in the text
# "lalala, he said" word "lala" appears once.  (If a character could
# be counted twice then both the first four letters and the last four
# letters of "lalala" would match.)

## Main Routine

# This routine runs the test code for the two problems.  It also makes
# sure you put your name at the top of the file.  It does not have to
# be modified, but it can be if it would help.  For example, you might
# comment out a test for one of the problems when working on the
# other.

        .asciiz "Please put your name in the top of the file where indicated."

        .globl __start
        # First things first.
        la $s0, name
        lb $s0, ($s0)
        bne $s0, $0  TESTS
        la $a0, who_are_you  # [sic]
        addi $v0, $0, 11
        addi $v0, $v0, 10
        jal test_dep   # Comment out this line to skip this test.
        jal test_wc    # Comment out this line to skip this test.
        addi $v0, $0, 10   # Code for the exit system call.

## Problem 1 Solution Shell

        .globl deposit

        ## Register Usage
        # $a0:  Procedure input: N, Value to modify and return.
        # $a1:  Procedure input: p, Starting bit position.
        # $a2:  Procedure input: s, Size of data to insert, at least 1.
        # $a3:  Procedure input: d, Data to insert.
        # $v0:  Procedure output: N, with bits p to p+s-1 replaced with d

        # [ ] Modify registers $t0-$t9 and $v0 only.
        # [ ] Do not modify $a0-$a3, $sp, $fp, or $ra
        # [ ] Fill as many delay slots as possible.
        # [ ] Do not peel off one bit at a time, that takes too long.

        # Hint: Use sllv and sub to create a mask (sequence of 1s),
        #       use the mask with  and, and other logical instructions.

        # A correct solution uses ten instructions, including jr  More are okay.

        jr   $ra
        nop  # Can replace with another instruction.

## Problem 2 Solution Shell

        .globl word_count

        ## Register Usage
        # $a0: Procedure input:  Start of text to search.
        # $a1: Procedure input:  Start of string to find.
        # $v0: Procedure output: Number of times string found in text.

        # [ ] Modify registers $t0-$t9 and $v0 only.
        # [ ] Do not modify $a0-$a1, $sp, $fp, or $ra
        # [ ] Fill as many delay slots as possible.

        # A correct solution uses 17 instructions, more are okay.

        jr $ra
        nop    # Can replace with another instruction.

## Test Code for deposit

# The lines after deposit_data can be rearranged so that, for example,
# a test that your code is failing comes first (useful when single-stepping).

        #     N            p  s   d             Return Val.
        .word 0,           0, 4,  0xee,         0xe
        .word 0x12345678,  4, 8,  0xee,         0x12345ee8
        .word 0x12345678, 24, 8,  0xee,         0xee345678
	.word 0x7be9c1bd,  2, 27, 0x746b9fbe,   0x71ae7ef9
	.word 0x2d04417f, 17,  7, 0x02b26e0b,   0x2d16417f
	.word 0x418fedcf, 30,  1, 0x1a1f5e2b,   0x418fedcf
	.word 0x307d7761, 16, 15, 0x2232310f,   0x310f7761
	.word 0x2dac5ceb, 26,  1, 0x5e6392b6,   0x29ac5ceb
	.word 0x66b90348,  1, 23, 0x618b18a4,   0x66163148
	.word 0x3a6ab4bf,  9, 22, 0x4e68589b,   0x50b136bf
	.word 0x09648aa6, 27,  1, 0x054e4c63,   0x09648aa6
	.word 0x484f2abd, 24,  7, 0x75536c3d,   0x3d4f2abd
	.word 0x50b10549, 24,  4, 0x1240f318,   0x58b10549
        .word 0x12345678, 33
        .asciiz "All deposit tests passed.\n"
        .ascii  "Test deposit failed:\n"
        .ascii  "  Number = 0x%/t3/x, pos = %/a1/d, size = %/a2/d, data = %/a3/x \n"
        .asciiz "  Returned number %/t2/x (wrong) != %/s1/x (correct)\n"

        .globl test_dep
        addi $sp, $sp, -16
        sw $ra, 12($sp)
        sw $s2, 8($sp)
        sw $s1, 4($sp)
        sw $s0, 0($sp)
        la $s0, deposit_data
        addi $s2, $0, 33
        lw $a0, 0($s0)
        lw $a1, 4($s0)
        beq $a1, $s2 DEP_PASS
        lw $a2, 8($s0)
        jal deposit
        lw $a3, 12($s0)
        lw $s1, 16($s0)
        bne $s1, $v0 DEP_FAIL
        addi $s0, $s0, 20
        j DEPOSIT_LOOP

        la $a0, dep_pass_fmt
        j DEP_MSG

        add $t3, $a0, $0
        la $a0, dep_fail_fmt
        add $t2, $v0, $0
        li $v0, 11
        lw $ra, 12($sp)
        lw $s2, 8($sp)
        lw $s1, 4($sp)
        lw $s0, 0($sp)
        jr $ra
        addi $sp, $sp, 16

## Test Code for Word Count

# This test scans a long text segment.  For a shorter text segment
# change wc_long_text to wc_short_text and change wc_long_counts
# to wc_short_counts.


        .asciiz "  The"
        .asciiz "can't"
        .asciiz "troubles"
        .asciiz "the"
        .asciiz "o"
        .asciiz "l"
        .asciiz ""

        .word 81, 2, 0, 534, 2796, 1231, 0
        .word 1, 0, 0, 0, 1, 2, 0

        .asciiz "Test word count passed.\n"

        .ascii  "Test word count failed for word %/a1/s\n"
        .asciiz "  Count %/t0/d (correct) != %/t1/d (wrong)\n"

        .globl test_wc
        addi $sp, $sp, -16
        sw $ra, 12($sp)
        sw $s2, 8($sp)
        sw $s1, 4($sp)
        sw $s0, 0($sp)
        la $a0, wc_long_text
        la $a1, wc_words
        la $s0, wc_long_counts
        lbu $t0, 0($a1)
        beq $t0, $0, WC_PASS
        jal word_count
        lw $t0, 0($s0)
        addi $s0, $s0, 4
        bne $v0, $t0 WC_FAIL

        lbu $t0, 0($a1)
        bne $t0, $0, WC_FIND_NEXT_WORD
        addi $a1, $a1, 1
        j WC_TB_LOOP

        la $a0, wc_pass_fmt
        j WC_MSG

        la $a0, wc_fail_fmt
        j WC_MSG
        addi $t1, $v0, 0

        li $v0, 11
        lw $ra, 12($sp)
        lw $s2, 8($sp)
        lw $s1, 4($sp)
        lw $s0, 0($sp)
        jr $ra
        addi $sp, $sp, 16

   .ascii  "   The GNU Project\n"
   .ascii  "\n"
   .asciiz "   by Richard Stallman\n"

   .ascii  "   The GNU Project\n"
   .ascii  "\n"
   .ascii  "   by Richard Stallman\n"
   .ascii  "\n"
   .ascii  "   originally published in the book \"Open Sources\"\n"
   .ascii  "\n"
   .ascii  "  The first software-sharing community\n"
   .ascii  "\n"
   .ascii  "   When I started working at the MIT Artificial Intelligence Lab in 1971,\n"
   .ascii  "   I became part of a software-sharing community that had existed for\n"
   .ascii  "   many years.  Sharing of software was not limited to our particular\n"
   .ascii  "   community; it is as old as computers, just as sharing of recipes is as\n"
   .ascii  "   old as cooking.  But we did it more than most.\n"
   .ascii  "\n"
   .ascii  "   The AI Lab used a timesharing operating system called ITS (the\n"
   .ascii  "   Incompatible Timesharing System) that the lab's staff hackers (1) had\n"
   .ascii  "   designed and written in assembler language for the Digital PDP-10, one\n"
   .ascii  "   of the large computers of the era.  As a member of this community, an\n"
   .ascii  "   AI lab staff system hacker, my job was to improve this system.\n"
   .ascii  "\n"
   .ascii  "   We did not call our software \"free software\", because that term did\n"
   .ascii  "   not yet exist; but that is what it was.  Whenever people from another\n"
   .ascii  "   university or a company wanted to port and use a program, we gladly\n"
   .ascii  "   let them.  If you saw someone using an unfamiliar and interesting\n"
   .ascii  "   program, you could always ask to see the source code, so that you\n"
   .ascii  "   could read it, change it, or cannibalize parts of it to make a new\n"
   .ascii  "   program.\n"
   .ascii  "\n"
   .ascii  "   (1) The use of \"hacker\" to mean \"security breaker\" is a confusion on\n"
   .ascii  "   the part of the mass media.  We hackers refuse to recognize that\n"
   .ascii  "   meaning, and continue using the word to mean, \"Someone who loves to\n"
   .ascii  "   program and enjoys being clever about it.\"\n"
   .ascii  "\n"
   .ascii  "  The collapse of the community\n"
   .ascii  "\n"
   .ascii  "   The situation changed drastically in the early 1980s when Digital\n"
   .ascii  "   discontinued the PDP-10 series.  Its architecture, elegant and powerful\n"
   .ascii  "   in the 60s, could not extend naturally to the larger address spaces\n"
   .ascii  "   that were becoming feasible in the 80s.  This meant that nearly all of\n"
   .ascii  "   the programs composing ITS were obsolete.\n"
   .ascii  "\n"
   .ascii  "   The AI lab hacker community had already collapsed, not long before.  In\n"
   .ascii  "   1981, the spin-off company Symbolics had hired away nearly all of the\n"
   .ascii  "   hackers from the AI lab, and the depopulated community was unable to\n"
   .ascii  "   maintain itself.  (The book Hackers, by Steve Levy, describes these\n"
   .ascii  "   events, as well as giving a clear picture of this community in its\n"
   .ascii  "   prime.)  When the AI lab bought a new PDP-10 in 1982, its\n"
   .ascii  "   administrators decided to use Digital's non-free timesharing system\n"
   .ascii  "   instead of ITS.\n"
   .ascii  "\n"
   .ascii  "   The modern computers of the era, such as the VAX or the 68020, had\n"
   .ascii  "   their own operating systems, but none of them were free software: you\n"
   .ascii  "   had to sign a nondisclosure agreement even to get an executable copy.\n"
   .ascii  "\n"
   .ascii  "   This meant that the first step in using a computer was to promise not\n"
   .ascii  "   to help your neighbor.  A cooperating community was forbidden.  The rule\n"
   .ascii  "   made by the owners of proprietary software was, \"If you share with\n"
   .ascii  "   your neighbor, you are a pirate.  If you want any changes, beg us to\n"
   .ascii  "   make them.\"\n"
   .ascii  "\n"
   .ascii  "   The idea that the proprietary software social system--the system that\n"
   .ascii  "   says you are not allowed to share or change software--is antisocial,\n"
   .ascii  "   that it is unethical, that it is simply wrong, may come as a surprise\n"
   .ascii  "   to some readers.  But what else could we say about a system based on\n"
   .ascii  "   dividing the public and keeping users helpless? Readers who find the\n"
   .ascii  "   idea surprising may have taken proprietary social system as given, or\n"
   .ascii  "   judged it on the terms suggested by proprietary software businesses.\n"
   .ascii  "   Software publishers have worked long and hard to convince people that\n"
   .ascii  "   there is only one way to look at the issue.\n"
   .ascii  "\n"
   .ascii  "   When software publishers talk about \"enforcing\" their \"rights\" or\n"
   .ascii  "   \"stopping piracy\", what they actually *say* is secondary.  The real\n"
   .ascii  "   message of these statements is in the unstated assumptions they take\n"
   .ascii  "   for granted; the public is supposed to accept them uncritically.  So\n"
   .ascii  "   let's examine them.\n"
   .ascii  "\n"
   .ascii  "   One assumption is that software companies have an unquestionable\n"
   .ascii  "   natural right to own software and thus have power over all its users.\n"
   .ascii  "   (If this were a natural right, then no matter how much harm it does to\n"
   .ascii  "   the public, we could not object.)  Interestingly, the US Constitution\n"
   .ascii  "   and legal tradition reject this view; copyright is not a natural\n"
   .ascii  "   right, but an artificial government-imposed monopoly that limits the\n"
   .ascii  "   users' natural right to copy.\n"
   .ascii  "\n"
   .ascii  "   Another unstated assumption is that the only important thing about\n"
   .ascii  "   software is what jobs it allows you to do--that we computer users\n"
   .ascii  "   should not care what kind of society we are allowed to have.\n"
   .ascii  "\n"
   .ascii  "   A third assumption is that we would have no usable software (or, would\n"
   .ascii  "   never have a program to do this or that particular job) if we did not\n"
   .ascii  "   offer a company power over the users of the program.  This assumption\n"
   .ascii  "   may have seemed plausible, before the free software movement\n"
   .ascii  "   demonstrated that we can make plenty of useful software without\n"
   .ascii  "   putting chains on it.\n"
   .ascii  "\n"
   .ascii  "   If we decline to accept these assumptions, and judge these issues\n"
   .ascii  "   based on ordinary common-sense morality while placing the users first,\n"
   .ascii  "   we arrive at very different conclusions.  Computer users should be free\n"
   .ascii  "   to modify programs to fit their needs, and free to share software,\n"
   .ascii  "   because helping other people is the basis of society.\n"
   .ascii  "\n"
   .ascii  "   There is no room here for an extensive statement of the reasoning\n"
   .ascii  "   behind this conclusion, so I refer the reader to the web page,\n"
   .ascii  "   <http://www.gnu.org/philosophy/why-free.html>.\n"
   .ascii  "\n"
   .ascii  "  A stark moral choice.\n"
   .ascii  "\n"
   .ascii  "   With my community gone, to continue as before was impossible.  Instead,\n"
   .ascii  "   I faced a stark moral choice.\n"
   .ascii  "\n"
   .ascii  "   The easy choice was to join the proprietary software world, signing\n"
   .ascii  "   nondisclosure agreements and promising not to help my fellow hacker.\n"
   .ascii  "   Most likely I would also be developing software that was released\n"
   .ascii  "   under nondisclosure agreements, thus adding to the pressure on other\n"
   .ascii  "   people to betray their fellows too.\n"
   .ascii  "\n"
   .ascii  "   I could have made money this way, and perhaps amused myself writing\n"
   .ascii  "   code.  But I knew that at the end of my career, I would look back on\n"
   .ascii  "   years of building walls to divide people, and feel I had spent my life\n"
   .ascii  "   making the world a worse place.\n"
   .ascii  "\n"
   .ascii  "   I had already experienced being on the receiving end of a\n"
   .ascii  "   nondisclosure agreement, when someone refused to give me and the MIT\n"
   .ascii  "   AI lab the source code for the control program for our printer.  (The\n"
   .ascii  "   lack of certain features in this program made use of the printer\n"
   .ascii  "   extremely frustrating.)  So I could not tell myself that nondisclosure\n"
   .ascii  "   agreements were innocent.  I was very angry when he refused to share\n"
   .ascii  "   with us; I could not turn around and do the same thing to everyone\n"
   .ascii  "   else.\n"
   .ascii  "\n"
   .ascii  "   Another choice, straightforward but unpleasant, was to leave the\n"
   .ascii  "   computer field.  That way my skills would not be misused, but they\n"
   .ascii  "   would still be wasted.  I would not be culpable for dividing and\n"
   .ascii  "   restricting computer users, but it would happen nonetheless.\n"
   .ascii  "\n"
   .ascii  "   So I looked for a way that a programmer could do something for the\n"
   .ascii  "   good.  I asked myself, was there a program or programs that I could\n"
   .ascii  "   write, so as to make a community possible once again?\n"
   .ascii  "\n"
   .ascii  "   The answer was clear: what was needed first was an operating system.\n"
   .ascii  "   That is the crucial software for starting to use a computer.  With an\n"
   .ascii  "   operating system, you can do many things; without one, you cannot run\n"
   .ascii  "   the computer at all.  With a free operating system, we could again have\n"
   .ascii  "   a community of cooperating hackers--and invite anyone to join.  And\n"
   .ascii  "   anyone would be able to use a computer without starting out by\n"
   .ascii  "   conspiring to deprive his or her friends.\n"
   .ascii  "\n"
   .ascii  "   As an operating system developer, I had the right skills for this job.\n"
   .ascii  "   So even though I could not take success for granted, I realized that I\n"
   .ascii  "   was elected to do the job.  I chose to make the system compatible with\n"
   .ascii  "   Unix so that it would be portable, and so that Unix users could easily\n"
   .ascii  "   switch to it.  The name GNU was chosen following a hacker tradition, as\n"
   .ascii  "   a recursive acronym for \"GNU's Not Unix.\"\n"
   .ascii  "\n"
   .ascii  "   An operating system does not mean just a kernel, barely enough to run\n"
   .ascii  "   other programs.  In the 1970s, every operating system worthy of the\n"
   .ascii  "   name included command processors, assemblers, compilers, interpreters,\n"
   .ascii  "   debuggers, text editors, mailers, and much more.  ITS had them, Multics\n"
   .ascii  "   had them, VMS had them, and Unix had them.  The GNU operating system\n"
   .ascii  "   would include them too.\n"
   .ascii  "\n"
   .ascii  "   Later I heard these words, attributed to Hillel (1):\n"
   .ascii  "\n"
   .ascii  "   If I am not for myself, who will be for me?\n"
   .ascii  "   If I am only for myself, what am I?\n"
   .ascii  "   If not now, when?\n"
   .ascii  "\n"
   .ascii  "   The decision to start the GNU project was based on a similar spirit.\n"
   .ascii  "\n"
   .ascii  "   (1) As an Atheist, I don't follow any religious leaders, but I\n"
   .ascii  "   sometimes find I admire something one of them has said.\n"
   .ascii  "\n"
   .ascii  "  Free as in freedom\n"
   .ascii  "\n"
   .ascii  "   The term \"free software\" is sometimes misunderstood--it has nothing to\n"
   .ascii  "   do with price.  It is about freedom.  Here, therefore, is the definition\n"
   .ascii  "   of free software: a program is free software, for you, a particular\n"
   .ascii  "   user, if:\n"
   .ascii  "\n"
   .ascii  "     * You have the freedom to run the program, for any purpose.\n"
   .ascii  "     * You have the freedom to modify the program to suit your needs.  (To\n"
   .ascii  "       make this freedom effective in practice, you must have access to\n"
   .ascii  "       the source code, since making changes in a program without having\n"
   .ascii  "       the source code is exceedingly difficult.)\n"
   .ascii  "     * You have the freedom to redistribute copies, either gratis or for\n"
   .ascii  "       a fee.\n"
   .ascii  "     * You have the freedom to distribute modified versions of the\n"
   .ascii  "       program, so that the community can benefit from your improvements.\n"
   .ascii  "\n"
   .ascii  "   Since \"free\" refers to freedom, not to price, there is no\n"
   .ascii  "   contradiction between selling copies and free software.  In fact, the\n"
   .ascii  "   freedom to sell copies is crucial: collections of free software sold\n"
   .ascii  "   on CD-ROMs are important for the community, and selling them is an\n"
   .ascii  "   important way to raise funds for free software development.  Therefore,\n"
   .ascii  "   a program which people are not free to include on these collections is\n"
   .ascii  "   not free software.\n"
   .ascii  "\n"
   .ascii  "   Because of the ambiguity of \"free\", people have long looked for\n"
   .ascii  "   alternatives, but no one has found a suitable alternative.  The English\n"
   .ascii  "   Language has more words and nuances than any other, but it lacks a\n"
   .ascii  "   simple, unambiguous, word that means \"free,\" as in\n"
   .ascii  "   freedom--\"unfettered,\" being the word that comes closest in meaning.\n"
   .ascii  "   Such alternatives as \"liberated\", \"freedom\" and \"open\" have either the\n"
   .ascii  "   wrong meaning or some other disadvantage.\n"
   .ascii  "\n"
   .ascii  "  GNU software and the GNU system\n"
   .ascii  "\n"
   .ascii  "   Developing a whole system is a very large project.  To bring it into\n"
   .ascii  "   reach, I decided to adapt and use existing pieces of free software\n"
   .ascii  "   wherever that was possible.  For example, I decided at the very\n"
   .ascii  "   beginning to use TeX as the principal text formatter; a few years\n"
   .ascii  "   later, I decided to use the X Window System rather than writing\n"
   .ascii  "   another window system for GNU.\n"
   .ascii  "\n"
   .ascii  "   Because of this decision, the GNU system is not the same as the\n"
   .ascii  "   collection of all GNU software.  The GNU system includes programs that\n"
   .ascii  "   are not GNU software, programs that were developed by other people and\n"
   .ascii  "   projects for their own purposes, but which we can use because they are\n"
   .ascii  "   free software.\n"
   .ascii  "\n"
   .ascii  "  Commencing the project\n"
   .ascii  "\n"
   .ascii  "   In January 1984 I quit my job at MIT and began writing GNU software.\n"
   .ascii  "   Leaving MIT was necessary so that MIT would not be able to interfere\n"
   .ascii  "   with distributing GNU as free software.  If I had remained on the\n"
   .ascii  "   staff, MIT could have claimed to own the work, and could have imposed\n"
   .ascii  "   their own distribution terms, or even turned the work into a\n"
   .ascii  "   proprietary software package.  I had no intention of doing a large\n"
   .ascii  "   amount of work only to see it become useless for its intended purpose:\n"
   .ascii  "   creating a new software-sharing community.\n"
   .ascii  "\n"
   .ascii  "   However, Professor Winston, then the head of the MIT AI Lab, kindly\n"
   .ascii  "   invited me to keep using the lab's facilities.\n"
   .ascii  "\n"
   .ascii  "  The first steps\n"
   .ascii  "\n"
   .ascii  "   Shortly before beginning the GNU project, I heard about the Free\n"
   .ascii  "   University Compiler Kit, also known as VUCK.  (The Dutch word for\n"
   .ascii  "   \"free\" is written with a V.)  This was a compiler designed to handle\n"
   .ascii  "   multiple languages, including C and Pascal, and to support multiple\n"
   .ascii  "   target machines.  I wrote to its author asking if GNU could use it.\n"
   .ascii  "\n"
   .ascii  "   He responded derisively, stating that the university was free but the\n"
   .ascii  "   compiler was not.  I therefore decided that my first program for the\n"
   .ascii  "   GNU project would be a multi-language, multi-platform compiler.\n"
   .ascii  "\n"
   .ascii  "   Hoping to avoid the need to write the whole compiler myself, I\n"
   .ascii  "   obtained the source code for the Pastel compiler, which was a\n"
   .ascii  "   multi-platform compiler developed at Lawrence Livermore Lab.  It\n"
   .ascii  "   supported, and was written in, an extended version of Pascal, designed\n"
   .ascii  "   to be a system-programming language.  I added a C front end, and began\n"
   .ascii  "   porting it to the Motorola 68000 computer.  But I had to give that up\n"
   .ascii  "   when I discovered that the compiler needed many megabytes of stack\n"
   .ascii  "   space, and the available 68000 Unix system would only allow 64k.\n"
   .ascii  "\n"
   .ascii  "   I then realized that the Pastel compiler functioned by parsing the\n"
   .ascii  "   entire input file into a syntax tree, converting the whole syntax tree\n"
   .ascii  "   into a chain of \"instructions\", and then generating the whole output\n"
   .ascii  "   file, without ever freeing any storage.  At this point, I concluded I\n"
   .ascii  "   would have to write a new compiler from scratch.  That new compiler is\n"
   .ascii  "   now known as GCC; none of the Pastel compiler is used in it, but I\n"
   .ascii  "   managed to adapt and use the C front end that I had written.  But that\n"
   .ascii  "   was some years later; first, I worked on GNU Emacs.\n"
   .ascii  "\n"
   .ascii  "  GNU Emacs\n"
   .ascii  "\n"
   .ascii  "   I began work on GNU Emacs in September 1984, and in early 1985 it was\n"
   .ascii  "   beginning to be usable.  This enabled me to begin using Unix systems to\n"
   .ascii  "   do editing; having no interest in learning to use vi or ed, I had done\n"
   .ascii  "   my editing on other kinds of machines until then.\n"
   .ascii  "\n"
   .ascii  "   At this point, people began wanting to use GNU Emacs, which raised the\n"
   .ascii  "   question of how to distribute it.  Of course, I put it on the anonymous\n"
   .ascii  "   ftp server on the MIT computer that I used.  (This computer,\n"
   .ascii  "   prep.ai.mit.edu, thus became the principal GNU ftp distribution site;\n"
   .ascii  "   when it was decommissioned a few years later, we transferred the name\n"
   .ascii  "   to our new ftp server.)  But at that time, many of the interested\n"
   .ascii  "   people were not on the Internet and could not get a copy by ftp.  So\n"
   .ascii  "   the question was, what would I say to them?\n"
   .ascii  "\n"
   .ascii  "   I could have said, \"Find a friend who is on the net and who will make\n"
   .ascii  "   a copy for you.\"  Or I could have done what I did with the original\n"
   .ascii  "   PDP-10 Emacs: tell them, \"Mail me a tape and a SASE, and I will mail\n"
   .ascii  "   it back with Emacs on it.\"  But I had no job, and I was looking for\n"
   .ascii  "   ways to make money from free software.  So I announced that I would\n"
   .ascii  "   mail a tape to whoever wanted one, for a fee of $150.  In this way, I\n"
   .ascii  "   started a free software distribution business, the precursor of the\n"
   .ascii  "   companies that today distribute entire Linux-based GNU systems.\n"
   .ascii  "\n"
   .ascii  "  Is a program free for every user?\n"
   .ascii  "\n"
   .ascii  "   If a program is free software when it leaves the hands of its author,\n"
   .ascii  "   this does not necessarily mean it will be free software for everyone\n"
   .ascii  "   who has a copy of it.  For example, public domain software (software\n"
   .ascii  "   that is not copyrighted) is free software; but anyone can make a\n"
   .ascii  "   proprietary modified version of it.  Likewise, many free programs are\n"
   .ascii  "   copyrighted but distributed under simple permissive licenses which\n"
   .ascii  "   allow proprietary modified versions.\n"
   .ascii  "\n"
   .ascii  "   The paradigmatic example of this problem is the X Window System.\n"
   .ascii  "   Developed at MIT, and released as free software with a permissive\n"
   .ascii  "   license, it was soon adopted by various computer companies.  They added\n"
   .ascii  "   X to their proprietary Unix systems, in binary form only, and covered\n"
   .ascii  "   by the same nondisclosure agreement.  These copies of X were no more\n"
   .ascii  "   free software than Unix was.\n"
   .ascii  "\n"
   .ascii  "   The developers of the X Window System did not consider this a\n"
   .ascii  "   problem--they expected and intended this to happen.  Their goal was not\n"
   .ascii  "   freedom, just \"success\", defined as \"having many users.\"  They did not\n"
   .ascii  "   care whether these users had freedom, only that they should be\n"
   .ascii  "   numerous.\n"
   .ascii  "\n"
   .ascii  "   This lead to a paradoxical situation where two different ways of\n"
   .ascii  "   counting the amount of freedom gave different answers to the question,\n"
   .ascii  "   \"Is this program free?\" If you judged based on the freedom provided by\n"
   .ascii  "   the distribution terms of the MIT release, you would say that X was\n"
   .ascii  "   free software.  But if you measured the freedom of the average user of\n"
   .ascii  "   X, you would have to say it was proprietary software.  Most X users\n"
   .ascii  "   were running the proprietary versions that came with Unix systems, not\n"
   .ascii  "   the free version.\n"
   .ascii  "\n"
   .ascii  "  Copyleft and the GNU GPL\n"
   .ascii  "\n"
   .ascii  "   The goal of GNU was to give users freedom, not just to be popular.  So\n"
   .ascii  "   we needed to use distribution terms that would prevent GNU software\n"
   .ascii  "   from being turned into proprietary software.  The method we use is\n"
   .ascii  "   called \"copyleft\".(1)\n"
   .ascii  "\n"
   .ascii  "   Copyleft uses copyright law, but flips it over to serve the opposite\n"
   .ascii  "   of its usual purpose: instead of a means of privatizing software, it\n"
   .ascii  "   becomes a means of keeping software free.\n"
   .ascii  "\n"
   .ascii  "   The central idea of copyleft is that we give everyone permission to\n"
   .ascii  "   run the program, copy the program, modify the program, and distribute\n"
   .ascii  "   modified versions--but not permission to add restrictions of their\n"
   .ascii  "   own.  Thus, the crucial freedoms that define \"free software\" are\n"
   .ascii  "   guaranteed to everyone who has a copy; they become inalienable rights.\n"
   .ascii  "\n"
   .ascii  "   For an effective copyleft, modified versions must also be free.  This\n"
   .ascii  "   ensures that work based on ours becomes available to our community if\n"
   .ascii  "   it is published.  When programmers who have jobs as programmers\n"
   .ascii  "   volunteer to improve GNU software, it is copyleft that prevents their\n"
   .ascii  "   employers from saying, \"You can't share those changes, because we are\n"
   .ascii  "   going to use them to make our proprietary version of the program.\"\n"
   .ascii  "\n"
   .ascii  "   The requirement that changes must be free is essential if we want to\n"
   .ascii  "   ensure freedom for every user of the program.  The companies that\n"
   .ascii  "   privatized the X Window System usually made some changes to port it to\n"
   .ascii  "   their systems and hardware.  These changes were small compared with the\n"
   .ascii  "   great extent of X, but they were not trivial.  If making changes were\n"
   .ascii  "   an excuse to deny the users freedom, it would be easy for anyone to\n"
   .ascii  "   take advantage of the excuse.\n"
   .ascii  "\n"
   .ascii  "   A related issue concerns combining a free program with non-free code.\n"
   .ascii  "   Such a combination would inevitably be non-free; whichever freedoms\n"
   .ascii  "   are lacking for the non-free part would be lacking for the whole as\n"
   .ascii  "   well.  To permit such combinations would open a hole big enough to sink\n"
   .ascii  "   a ship.  Therefore, a crucial requirement for copyleft is to plug this\n"
   .ascii  "   hole: anything added to or combined with a copylefted program must be\n"
   .ascii  "   such that the larger combined version is also free and copylefted.\n"
   .ascii  "\n"
   .ascii  "   The specific implementation of copyleft that we use for most GNU\n"
   .ascii  "   software is the GNU General Public License, or GNU GPL for short.  We\n"
   .ascii  "   have other kinds of copyleft that are used in specific circumstances.\n"
   .ascii  "   GNU manuals are copylefted also, but use a much simpler kind of\n"
   .ascii  "   copyleft, because the complexity of the GNU GPL is not necessary for\n"
   .ascii  "   manuals.\n"
   .ascii  "\n"
   .ascii  "   (1) In 1984 or 1985, Don Hopkins (a very imaginative fellow) mailed me\n"
   .ascii  "   a letter.  On the envelope he had written several amusing sayings,\n"
   .ascii  "   including this one: \"Copyleft--all rights reversed.\" I used the word\n"
   .ascii  "   \"copyleft\" to name the distribution concept I was developing at the\n"
   .ascii  "   time.\n"
   .ascii  "\n"
   .ascii  "  The Free Software Foundation\n"
   .ascii  "\n"
   .ascii  "   As interest in using Emacs was growing, other people became involved\n"
   .ascii  "   in the GNU project, and we decided that it was time to seek funding\n"
   .ascii  "   once again.  So in 1985 we created the Free Software Foundation, a\n"
   .ascii  "   tax-exempt charity for free software development.  The FSF also took\n"
   .ascii  "   over the Emacs tape distribution business; later it extended this by\n"
   .ascii  "   adding other free software (both GNU and non-GNU) to the tape, and by\n"
   .ascii  "   selling free manuals as well.\n"
   .ascii  "\n"
   .ascii  "   The FSF accepts donations, but most of its income has always come from\n"
   .ascii  "   sales--of copies of free software, and of other related services.\n"
   .ascii  "   Today it sells CD-ROMs of source code, CD-ROMs with binaries, nicely\n"
   .ascii  "   printed manuals (all with freedom to redistribute and modify), and\n"
   .ascii  "   Deluxe Distributions (where we build the whole collection of software\n"
   .ascii  "   for your choice of platform).\n"
   .ascii  "\n"
   .ascii  "   Free Software Foundation employees have written and maintained a\n"
   .ascii  "   number of GNU software packages.  Two notable ones are the C library\n"
   .ascii  "   and the shell.  The GNU C library is what every program running on a\n"
   .ascii  "   GNU/Linux system uses to communicate with Linux.  It was developed by a\n"
   .ascii  "   member of the Free Software Foundation staff, Roland McGrath.  The\n"
   .ascii  "   shell used on most GNU/Linux systems is BASH, the Bourne Again\n"
   .ascii  "   Shell(1), which was developed by FSF employee Brian Fox.\n"
   .ascii  "\n"
   .ascii  "   We funded development of these programs because the GNU project was\n"
   .ascii  "   not just about tools or a development environment.  Our goal was a\n"
   .ascii  "   complete operating system, and these programs were needed for that\n"
   .ascii  "   goal.\n"
   .ascii  "\n"
   .ascii  "   (1) \"Bourne again Shell\" is a joke on the name ``Bourne Shell'', which\n"
   .ascii  "   was the usual shell on Unix.\n"
   .ascii  "\n"
   .ascii  "  Free software support\n"
   .ascii  "\n"
   .ascii  "   The free software philosophy rejects a specific widespread business\n"
   .ascii  "   practice, but it is not against business.  When businesses respect the\n"
   .ascii  "   users' freedom, we wish them success.\n"
   .ascii  "\n"
   .ascii  "   Selling copies of Emacs demonstrates one kind of free software\n"
   .ascii  "   business.  When the FSF took over that business, I needed another way\n"
   .ascii  "   to make a living.  I found it in selling services relating to the free\n"
   .ascii  "   software I had developed.  This included teaching, for subjects such as\n"
   .ascii  "   how to program GNU Emacs and how to customize GCC, and software\n"
   .ascii  "   development, mostly porting GCC to new platforms.\n"
   .ascii  "\n"
   .ascii  "   Today each of these kinds of free software business is practiced by a\n"
   .ascii  "   number of corporations.  Some distribute free software collections on\n"
   .ascii  "   CD-ROM; others sell support at levels ranging from answering user\n"
   .ascii  "   questions, to fixing bugs, to adding major new features.  We are even\n"
   .ascii  "   beginning to see free software companies based on launching new free\n"
   .ascii  "   software products.\n"
   .ascii  "\n"
   .ascii  "   Watch out, though--a number of companies that associate themselves\n"
   .ascii  "   with the term \"open source\" actually base their business on non-free\n"
   .ascii  "   software that works with free software.  These are not free software\n"
   .ascii  "   companies, they are proprietary software companies whose products\n"
   .ascii  "   tempt users away from freedom.  They call these \"value added\", which\n"
   .ascii  "   reflects the values they would like us to adopt: convenience above\n"
   .ascii  "   freedom.  If we value freedom more, we should call them \"freedom\n"
   .ascii  "   subtracted\" products.\n"
   .ascii  "\n"
   .ascii  "  Technical goals\n"
   .ascii  "\n"
   .ascii  "   The principal goal of GNU was to be free software.  Even if GNU had no\n"
   .ascii  "   technical advantage over Unix, it would have a social advantage,\n"
   .ascii  "   allowing users to cooperate, and an ethical advantage, respecting the\n"
   .ascii  "   user's freedom.\n"
   .ascii  "\n"
   .ascii  "   But it was natural to apply the known standards of good practice to\n"
   .ascii  "   the work--for example, dynamically allocating data structures to avoid\n"
   .ascii  "   arbitrary fixed size limits, and handling all the possible 8-bit codes\n"
   .ascii  "   wherever that made sense.\n"
   .ascii  "\n"
   .ascii  "   In addition, we rejected the Unix focus on small memory size, by\n"
   .ascii  "   deciding not to support 16-bit machines (it was clear that 32-bit\n"
   .ascii  "   machines would be the norm by the time the GNU system was finished),\n"
   .ascii  "   and to make no effort to reduce memory usage unless it exceeded a\n"
   .ascii  "   megabyte.  In programs for which handling very large files was not\n"
   .ascii  "   crucial, we encouraged programmers to read an entire input file into\n"
   .ascii  "   core, then scan its contents without having to worry about I/O.\n"
   .ascii  "\n"
   .ascii  "   These decisions enabled many GNU programs to surpass their Unix\n"
   .ascii  "   counterparts in reliability and speed.\n"
   .ascii  "\n"
   .ascii  "  Donated computers\n"
   .ascii  "\n"
   .ascii  "   As the GNU project's reputation grew, people began offering to donate\n"
   .ascii  "   machines running UNIX to the project.  These were very useful, because\n"
   .ascii  "   the easiest way to develop components of GNU was to do it on a UNIX\n"
   .ascii  "   system, and replace the components of that system one by one.  But they\n"
   .ascii  "   raised an ethical issue: whether it was right for us to have a copy of\n"
   .ascii  "   UNIX at all.\n"
   .ascii  "\n"
   .ascii  "   UNIX was (and is) proprietary software, and the GNU project's\n"
   .ascii  "   philosophy said that we should not use proprietary software.  But,\n"
   .ascii  "   applying the same reasoning that leads to the conclusion that violence\n"
   .ascii  "   in self defense is justified, I concluded that it was legitimate to\n"
   .ascii  "   use a proprietary package when that was crucial for developing free\n"
   .ascii  "   replacement that would help others stop using the proprietary package.\n"
   .ascii  "\n"
   .ascii  "   But, even if this was a justifiable evil, it was still an evil.  Today\n"
   .ascii  "   we no longer have any copies of Unix, because we have replaced them\n"
   .ascii  "   with free operating systems.  If we could not replace a machine's\n"
   .ascii  "   operating system with a free one, we replaced the machine instead.\n"
   .ascii  "\n"
   .ascii  "  The GNU Task List\n"
   .ascii  "\n"
   .ascii  "   As the GNU project proceeded, and increasing numbers of system\n"
   .ascii  "   components were found or developed, eventually it became useful to\n"
   .ascii  "   make a list of the remaining gaps.  We used it to recruit developers to\n"
   .ascii  "   write the missing pieces.  This list became known as the GNU task list.\n"
   .ascii  "   In addition to missing Unix components, we listed added various other\n"
   .ascii  "   useful software and documentation projects that, we thought, a truly\n"
   .ascii  "   complete system ought to have.\n"
   .ascii  "\n"
   .ascii  "   Today, hardly any Unix components are left in the GNU task list--those\n"
   .ascii  "   jobs have been done, aside from a few inessential ones.  But the list\n"
   .ascii  "   is full of projects that some might call \"applications\".  Any program\n"
   .ascii  "   that appeals to more than a narrow class of users would be a useful\n"
   .ascii  "   thing to add to an operating system.\n"
   .ascii  "\n"
   .ascii  "   Even games are included in the task list--and have been since the\n"
   .ascii  "   beginning.  Unix included games, so naturally GNU should too.  But\n"
   .ascii  "   compatibility was not an issue for games, so we did not follow the\n"
   .ascii  "   list of games that Unix had.  Instead, we listed a spectrum of\n"
   .ascii  "   different kinds of games that users might like.\n"
   .ascii  "\n"
   .ascii  "  The GNU Library GPL\n"
   .ascii  "\n"
   .ascii  "   The GNU C library uses a special kind of copyleft called the GNU\n"
   .ascii  "   Library General Public License, which gives permission to link\n"
   .ascii  "   proprietary software with the library.  Why make this exception?\n"
   .ascii  "\n"
   .ascii  "   It is not a matter of principle; there is no principle that says\n"
   .ascii  "   proprietary software products are entitled to include our code.  (Why\n"
   .ascii  "   contribute to a project predicated on refusing to share with us?)\n"
   .ascii  "   Using the LGPL for the C library, or for any library, is a matter of\n"
   .ascii  "   strategy.\n"
   .ascii  "\n"
   .ascii  "   The C library does a generic job; every proprietary system or compiler\n"
   .ascii  "   comes with a C library.  Therefore, to make our C library available\n"
   .ascii  "   only to free software would not have given free software any\n"
   .ascii  "   advantage--it would only have discouraged use of our library.\n"
   .ascii  "\n"
   .ascii  "   One system is an exception to this: on the GNU system (and this\n"
   .ascii  "   includes GNU/Linux), the GNU C library is the only C library.  So the\n"
   .ascii  "   distribution terms of the GNU C library determine whether it is\n"
   .ascii  "   possible to compile a proprietary program for the GNU system.  There is\n"
   .ascii  "   no ethical reason to allow proprietary applications on the GNU system,\n"
   .ascii  "   but strategically it seems that disallowing them would do more to\n"
   .ascii  "   discourage use of the GNU system than to encourage development of free\n"
   .ascii  "   applications.\n"
   .ascii  "\n"
   .ascii  "   That is why using the Library GPL is a good strategy for the C\n"
   .ascii  "   library.  For other libraries, the strategic decision needs to be\n"
   .ascii  "   considered on a case-by-case basis.  When a library does a special job\n"
   .ascii  "   that can help write certain kinds of programs, then releasing it under\n"
   .ascii  "   the GPL, limiting it to free programs only, is a way of helping other\n"
   .ascii  "   free software developers, giving them an advantage against proprietary\n"
   .ascii  "   software.\n"
   .ascii  "\n"
   .ascii  "   Consider GNU Readline, a library that was developed to provide\n"
   .ascii  "   command-line editing for BASH.  Readline is released under the ordinary\n"
   .ascii  "   GNU GPL, not the Library GPL.  This probably does reduce the amount\n"
   .ascii  "   Readline is used, but that is no loss for us.  Meanwhile, at least one\n"
   .ascii  "   useful application has been made free software specifically so it\n"
   .ascii  "   could use Readline, and that is a real gain for the community.\n"
   .ascii  "\n"
   .ascii  "   Proprietary software developers have the advantages money provides;\n"
   .ascii  "   free software developers need to make advantages for each other.  I\n"
   .ascii  "   hope some day we will have a large collection of GPL-covered libraries\n"
   .ascii  "   that have no parallel available to proprietary software, providing\n"
   .ascii  "   useful modules to serve as building blocks in new free software, and\n"
   .ascii  "   adding up to a major advantage for further free software development.\n"
   .ascii  "\n"
   .ascii  "  Scratching an itch?\n"
   .ascii  "\n"
   .ascii  "   Eric Raymond says that \"Every good work of software starts by\n"
   .ascii  "   scratching a developer's personal itch.\"  Maybe that happens sometimes,\n"
   .ascii  "   but many essential pieces of GNU software were developed in order to\n"
   .ascii  "   have a complete free operating system.  They come from a vision and a\n"
   .ascii  "   plan, not from impulse.\n"
   .ascii  "\n"
   .ascii  "   For example, we developed the GNU C library because a Unix-like system\n"
   .ascii  "   needs a C library, the Bourne-Again Shell (bash) because a Unix-like\n"
   .ascii  "   system needs a shell, and GNU tar because a Unix-like system needs a\n"
   .ascii  "   tar program.  The same is true for my own programs--the GNU C compiler,\n"
   .ascii  "   GNU Emacs, GDB and GNU Make.\n"
   .ascii  "\n"
   .ascii  "   Some GNU programs were developed to cope with specific threats to our\n"
   .ascii  "   freedom.  Thus, we developed gzip to replace the Compress program,\n"
   .ascii  "   which had been lost to the community because of the LZW patents.  We\n"
   .ascii  "   found people to develop LessTif, and more recently started GNOME and\n"
   .ascii  "   Harmony, to address the problems caused by certain proprietary\n"
   .ascii  "   libraries (see below).  We are developing the GNU Privacy Guard to\n"
   .ascii  "   replace popular non-free encryption software, because users should not\n"
   .ascii  "   have to choose between privacy and freedom.\n"
   .ascii  "\n"
   .ascii  "   Of course, the people writing these programs became interested in the\n"
   .ascii  "   work, and many features were added to them by various people for the\n"
   .ascii  "   sake of their own needs and interests.  But that is not why the\n"
   .ascii  "   programs exist.\n"
   .ascii  "\n"
   .ascii  "  Unexpected developments\n"
   .ascii  "\n"
   .ascii  "   At the beginning of the GNU project, I imagined that we would develop\n"
   .ascii  "   the whole GNU system, then release it as a whole.  That is not how it\n"
   .ascii  "   happened.\n"
   .ascii  "\n"
   .ascii  "   Since each component of the GNU system was implemented on a Unix\n"
   .ascii  "   system, each component could run on Unix systems, long before a\n"
   .ascii  "   complete GNU system existed.  Some of these programs became popular,\n"
   .ascii  "   and users began extending them and porting them---to the various\n"
   .ascii  "   incompatible versions of Unix, and sometimes to other systems as well.\n"
   .ascii  "\n"
   .ascii  "   The process made these programs much more powerful, and attracted both\n"
   .ascii  "   funds and contributors to the GNU project.  But it probably also\n"
   .ascii  "   delayed completion of a minimal working system by several years, as\n"
   .ascii  "   GNU developers' time was put into maintaining these ports and adding\n"
   .ascii  "   features to the existing components, rather than moving on to write\n"
   .ascii  "   one missing component after another.\n"
   .ascii  "\n"
   .ascii  "  The GNU Hurd\n"
   .ascii  "\n"
   .ascii  "   By 1990, the GNU system was almost complete; the only major missing\n"
   .ascii  "   component was the kernel.  We had decided to implement our kernel as a\n"
   .ascii  "   collection of server processes running on top of Mach.  Mach is a\n"
   .ascii  "   microkernel developed at Carnegie Mellon University and then at the\n"
   .ascii  "   University of Utah; the GNU HURD is a collection of servers (or ``herd\n"
   .ascii  "   of gnus'') that run on top of Mach, and do the various jobs of the\n"
   .ascii  "   Unix kernel.  The start of development was delayed as we waited for\n"
   .ascii  "   Mach to be released as free software, as had been promised.\n"
   .ascii  "\n"
   .ascii  "   One reason for choosing this design was to avoid what seemed to be the\n"
   .ascii  "   hardest part of the job: debugging a kernel program without a\n"
   .ascii  "   source-level debugger to do it with.  This part of the job had been\n"
   .ascii  "   done already, in Mach, and we expected to debug the HURD servers as\n"
   .ascii  "   user programs, with GDB.  But it took a long time to make that\n"
   .ascii  "   possible, and the multi-threaded servers that send messages to each\n"
   .ascii  "   other have turned out to be very hard to debug.  Making the HURD work\n"
   .ascii  "   solidly has stretched on for many years.\n"
   .ascii  "\n"
   .ascii  "  Alix\n"
   .ascii  "\n"
   .ascii  "   The GNU kernel was not originally supposed to be called the HURD.  Its\n"
   .ascii  "   original name was Alix--named after the woman who was my sweetheart at\n"
   .ascii  "   the time.  She, a Unix system administrator, had pointed out how her\n"
   .ascii  "   name would fit a common naming pattern for Unix system versions; as a\n"
   .ascii  "   joke, she told her friends, \"Someone should name a kernel after me.\"  I\n"
   .ascii  "   said nothing, but decided to surprise her with a kernel named Alix.\n"
   .ascii  "\n"
   .ascii  "   It did not stay that way.  Michael Bushnell (now Thomas), the main\n"
   .ascii  "   developer of the kernel, preferred the name HURD, and redefined Alix\n"
   .ascii  "   to refer to a certain part of the kernel--the part that would trap\n"
   .ascii  "   system calls and handle them by sending messages to HURD servers.\n"
   .ascii  "\n"
   .ascii  "   Ultimately, Alix and I broke up, and she changed her name;\n"
   .ascii  "   independently, the HURD design was changed so that the C library would\n"
   .ascii  "   send messages directly to servers, and this made the Alix component\n"
   .ascii  "   disappear from the design.\n"
   .ascii  "\n"
   .ascii  "   But before these things happened, a friend of hers came across the\n"
   .ascii  "   name Alix in the HURD source code, and mentioned the name to her.  So\n"
   .ascii  "   the name did its job.\n"
   .ascii  "\n"
   .ascii  "  Linux and GNU/Linux\n"
   .ascii  "\n"
   .ascii  "   The GNU Hurd is not ready for production use.  Fortunately, another\n"
   .ascii  "   kernel is available.  In 1991, Linus Torvalds developed a\n"
   .ascii  "   Unix-compatible kernel and called it Linux.  Around 1992, combining\n"
   .ascii  "   Linux with the not-quite-complete GNU system resulted in a complete\n"
   .ascii  "   free operating system.  (Combining them was a substantial job in\n"
   .ascii  "   itself, of course.) It is due to Linux that we can actually run a\n"
   .ascii  "   version of the GNU system today.\n"
   .ascii  "\n"
   .ascii  "   We call this system version GNU/Linux, to express its composition as a\n"
   .ascii  "   combination of the GNU system with Linux as the kernel.\n"
   .ascii  "\n"
   .ascii  "  Challenges in our future\n"
   .ascii  "\n"
   .ascii  "   We have proved our ability to develop a broad spectrum of free\n"
   .ascii  "   software.  This does not mean we are invincible and unstoppable.\n"
   .ascii  "   Several challenges make the future of free software uncertain; meeting\n"
   .ascii  "   them will require steadfast effort and endurance, sometimes lasting\n"
   .ascii  "   for years.  It will require the kind of determination that people\n"
   .ascii  "   display when they value their freedom and will not let anyone take it\n"
   .ascii  "   away.\n"
   .ascii  "\n"
   .ascii  "   The following four sections discuss these challenges.\n"
   .ascii  "\n"
   .ascii  "  Secret hardware\n"
   .ascii  "\n"
   .ascii  "   Hardware manufactures increasingly tend to keep hardware\n"
   .ascii  "   specifications secret.  This makes it difficult to write free drivers\n"
   .ascii  "   so that Linux and XFree86 can support new hardware.  We have complete\n"
   .ascii  "   free systems today, but we will not have them tomorrow if we cannot\n"
   .ascii  "   support tomorrow's computers.\n"
   .ascii  "\n"
   .ascii  "   There are two ways to cope with this problem.  Programmers can do\n"
   .ascii  "   reverse engineering to figure out how to support the hardware.  The\n"
   .ascii  "   rest of us can choose the hardware that is supported by free software;\n"
   .ascii  "   as our numbers increase, secrecy of specifications will become a\n"
   .ascii  "   self-defeating policy.\n"
   .ascii  "\n"
   .ascii  "   Reverse engineering is a big job; will we have programmers with\n"
   .ascii  "   sufficient determination to undertake it? Yes--if we have built up a\n"
   .ascii  "   strong feeling that free software is a matter of principle, and\n"
   .ascii  "   non-free drivers are intolerable.  And will large numbers of us spend\n"
   .ascii  "   extra money, or even a little extra time, so we can use free drivers?\n"
   .ascii  "   Yes, if the determination to have freedom is widespread.\n"
   .ascii  "\n"
   .ascii  "  Non-free libraries\n"
   .ascii  "\n"
   .ascii  "   A non-free library that runs on free operating systems acts as a trap\n"
   .ascii  "   for free software developers.  The library's attractive features are\n"
   .ascii  "   the bait; if you use the library, you fall into the trap, because your\n"
   .ascii  "   program cannot usefully be part of a free operating system.  (Strictly\n"
   .ascii  "   speaking, we could include your program, but it won't run with the\n"
   .ascii  "   library missing.) Even worse, if a program that uses the proprietary\n"
   .ascii  "   library becomes popular, it can lure other unsuspecting programmers\n"
   .ascii  "   into the trap.\n"
   .ascii  "\n"
   .ascii  "   The first instance of this problem was the Motif toolkit, back in the\n"
   .ascii  "   80s.  Although there were as yet no free operating systems, it was\n"
   .ascii  "   clear what problem Motif would cause for them later on.  The GNU\n"
   .ascii  "   Project responded in two ways: by asking individual free software\n"
   .ascii  "   projects to support the free X toolkit widgets as well as Motif, and\n"
   .ascii  "   by asking for someone to write a free replacement for Motif.  The job\n"
   .ascii  "   took many years; LessTif, developed by the Hungry Programmers, became\n"
   .ascii  "   powerful enough to support most Motif applications only in 1997.\n"
   .ascii  "\n"
   .ascii  "   Between 1996 and 1998, another non-free GUI toolkit library, called\n"
   .ascii  "   Qt, was used in a substantial collection of free software, the desktop\n"
   .ascii  "   KDE.\n"
   .ascii  "\n"
   .ascii  "   Free GNU/Linux systems were unable to use KDE, because we could not\n"
   .ascii  "   use the library.  However, some commercial distributors of GNU/Linux\n"
   .ascii  "   systems who were not strict about sticking with free software added\n"
   .ascii  "   KDE to their systems--producing a system with more capabilities, but\n"
   .ascii  "   less freedom.  The KDE group was actively encouraging more programmers\n"
   .ascii  "   to use Qt, and millions of new \"Linux users\" had never been exposed to\n"
   .ascii  "   the idea that there was a problem in this.  The situation appeared\n"
   .ascii  "   grim.\n"
   .ascii  "\n"
   .ascii  "   The free software community responded to the problem in two ways:\n"
   .ascii  "   GNOME and Harmony.\n"
   .ascii  "\n"
   .ascii  "   GNOME, the GNU Network Object Model Environment, is GNU's desktop\n"
   .ascii  "   project.  Started in 1997 by Miguel de Icaza, and developed with the\n"
   .ascii  "   support of Red Hat Software, GNOME set out to provide similar desktop\n"
   .ascii  "   facilities, but using free software exclusively.  It has technical\n"
   .ascii  "   advantages as well, such as supporting a variety of languages, not\n"
   .ascii  "   just C++.  But its main purpose was freedom: not to require the use of\n"
   .ascii  "   any non-free software.\n"
   .ascii  "\n"
   .ascii  "   Harmony is a compatible replacement library, designed to make it\n"
   .ascii  "   possible to run KDE software without using Qt.\n"
   .ascii  "\n"
   .ascii  "   In November 1998, the developers of Qt announced a change of license\n"
   .ascii  "   which, when carried out, should make Qt free software.  There is no way\n"
   .ascii  "   to be sure, but I think that this was partly due to the community's\n"
   .ascii  "   firm response to the problem that Qt posed when it was non-free.  (The\n"
   .ascii  "   new license is inconvenient and inequitable, so it remains desirable\n"
   .ascii  "   to avoid using Qt.)\n"
   .ascii  "\n"
   .ascii  "   [Subsequent note: in September 2000, Qt was rereleased under the GNU\n"
   .ascii  "   GPL, which essentially solved this problem.]\n"
   .ascii  "\n"
   .ascii  "   How will we respond to the next tempting non-free library? Will the\n"
   .ascii  "   whole community understand the need to stay out of the trap? Or will\n"
   .ascii  "   many of us give up freedom for convenience, and produce a major\n"
   .ascii  "   problem? Our future depends on our philosophy.\n"
   .ascii  "\n"
   .ascii  "  Software patents\n"
   .ascii  "\n"
   .ascii  "   The worst threat we face comes from software patents, which can put\n"
   .ascii  "   algorithms and features off limits to free software for up to twenty\n"
   .ascii  "   years.  The LZW compression algorithm patents were applied for in 1983,\n"
   .ascii  "   and we still cannot release free software to produce proper compressed\n"
   .ascii  "   GIFs.  In 1998, a free program to produce MP3 compressed audio was\n"
   .ascii  "   removed from distribution under threat of a patent suit.\n"
   .ascii  "\n"
   .ascii  "   There are ways to cope with patents: we can search for evidence that a\n"
   .ascii  "   patent is invalid, and we can look for alternative ways to do a job.\n"
   .ascii  "   But each of these methods works only sometimes; when both fail, a\n"
   .ascii  "   patent may force all free software to lack some feature that users\n"
   .ascii  "   want.  What will we do when this happens?\n"
   .ascii  "\n"
   .ascii  "   Those of us who value free software for freedom's sake will stay with\n"
   .ascii  "   free software anyway.  We will manage to get work done without the\n"
   .ascii  "   patented features.  But those who value free software because they\n"
   .ascii  "   expect it to be techically superior are likely to call it a failure\n"
   .ascii  "   when a patent holds it back.  Thus, while it is useful to talk about\n"
   .ascii  "   the practical effectiveness of the \"cathedral\" model of development,\n"
   .ascii  "   and the reliability and power of some free software, we must not stop\n"
   .ascii  "   there.  We must talk about freedom and principle.\n"
   .ascii  "\n"
   .ascii  "  Free documentation\n"
   .ascii  "\n"
   .ascii  "   The biggest deficiency in our free operating systems is not in the\n"
   .ascii  "   software--it is the lack of good free manuals that we can include in\n"
   .ascii  "   our systems.  Documentation is an essential part of any software\n"
   .ascii  "   package; when an important free software package does not come with a\n"
   .ascii  "   good free manual, that is a major gap.  We have many such gaps today.\n"
   .ascii  "\n"
   .ascii  "   Free documentation, like free software, is a matter of freedom, not\n"
   .ascii  "   price.  The criterion for a free manual is pretty much the same as for\n"
   .ascii  "   free software: it is a matter of giving all users certain freedoms.\n"
   .ascii  "   Redistribution (including commercial sale) must be permitted, on-line\n"
   .ascii  "   and on paper, so that the manual can accompany every copy of the\n"
   .ascii  "   program.\n"
   .ascii  "\n"
   .ascii  "   Permission for modification is crucial too.  As a general rule, I don't\n"
   .ascii  "   believe that it is essential for people to have permission to modify\n"
   .ascii  "   all sorts of articles and books.  For example, I don't think you or I\n"
   .ascii  "   are obliged to give permission to modify articles like this one, which\n"
   .ascii  "   describe our actions and our views.\n"
   .ascii  "\n"
   .ascii  "   But there is a particular reason why the freedom to modify is crucial\n"
   .ascii  "   for documentation for free software.  When people exercise their right\n"
   .ascii  "   to modify the software, and add or change its features, if they are\n"
   .ascii  "   conscientious they will change the manual too--so they can provide\n"
   .ascii  "   accurate and usable documentation with the modified program.  A manual\n"
   .ascii  "   which does not allow programmers to be conscientious and finish the\n"
   .ascii  "   job, does not fill our community's needs.\n"
   .ascii  "\n"
   .ascii  "   Some kinds of limits on how modifications are done pose no problem.\n"
   .ascii  "   For example, requirements to preserve the original author's copyright\n"
   .ascii  "   notice, the distribution terms, or the list of authors, are ok.  It is\n"
   .ascii  "   also no problem to require modified versions to include notice that\n"
   .ascii  "   they were modified, even to have entire sections that may not be\n"
   .ascii  "   deleted or changed, as long as these sections deal with nontechnical\n"
   .ascii  "   topics.  These kinds of restrictions are not a problem because they\n"
   .ascii  "   don't stop the conscientious programmer from adapting the manual to\n"
   .ascii  "   fit the modified program.  In other words, they don't block the free\n"
   .ascii  "   software community from making full use of the manual.\n"
   .ascii  "\n"
   .ascii  "   However, it must be possible to modify all the *technical* content of\n"
   .ascii  "   the manual, and then distribute the result in all the usual media,\n"
   .ascii  "   through all the usual channels; otherwise, the restrictions do\n"
   .ascii  "   obstruct the community, the manual is not free, and we need another\n"
   .ascii  "   manual.\n"
   .ascii  "\n"
   .ascii  "   Will free software developers have the awareness and determination to\n"
   .ascii  "   produce a full spectrum of free manuals? Once again, our future\n"
   .ascii  "   depends on philosophy.\n"
   .ascii  "\n"
   .ascii  "  We must talk about freedom\n"
   .ascii  "\n"
   .ascii  "   Estimates today are that there are ten million users of GNU/Linux\n"
   .ascii  "   systems such as Debian GNU/Linux and Red Hat Linux.  Free software has\n"
   .ascii  "   developed such practical advantages that users are flocking to it for\n"
   .ascii  "   purely practical reasons.\n"
   .ascii  "\n"
   .ascii  "   The good consequences of this are evident: more interest in developing\n"
   .ascii  "   free software, more customers for free software businesses, and more\n"
   .ascii  "   ability to encourage companies to develop commercial free software\n"
   .ascii  "   instead of proprietary software products.\n"
   .ascii  "\n"
   .ascii  "   But interest in the software is growing faster than awareness of the\n"
   .ascii  "   philosophy it is based on, and this leads to trouble.  Our ability to\n"
   .ascii  "   meet the challenges and threats described above depends on the will to\n"
   .ascii  "   stand firm for freedom.  To make sure our community has this will, we\n"
   .ascii  "   need to spread the idea to the new users as they come into the\n"
   .ascii  "   community.\n"
   .ascii  "\n"
   .ascii  "   But we are failing to do so: the efforts to attract new users into our\n"
   .ascii  "   community are far outstripping the efforts to teach them the civics of\n"
   .ascii  "   our community.  We need to do both, and we need to keep the two efforts\n"
   .ascii  "   in balance.\n"
   .ascii  "\n"
   .ascii  "  \"Open Source\"\n"
   .ascii  "\n"
   .ascii  "   Teaching new users about freedom became more difficult in 1998, when a\n"
   .ascii  "   part of the community decided to stop using the term \"free software\"\n"
   .ascii  "   and say \"open source software\" instead.\n"
   .ascii  "\n"
   .ascii  "   Some who favored this term aimed to avoid the confusion of \"free\" with\n"
   .ascii  "   \"gratis\"--a valid goal.  Others, however, aimed to set aside the spirit\n"
   .ascii  "   of principle that had motivated the free software movement and the GNU\n"
   .ascii  "   project, and to appeal instead to executives and business users, many\n"
   .ascii  "   of whom hold an ideology that places profit above freedom, above\n"
   .ascii  "   community, above principle.  Thus, the rhetoric of \"open source\"\n"
   .ascii  "   focuses on the potential to make high quality, powerful software, but\n"
   .ascii  "   shuns the ideas of freedom, community, and principle.\n"
   .ascii  "\n"
   .ascii  "   The \"Linux\" magazines are a clear example of this--they are filled\n"
   .ascii  "   with advertisements for proprietary software that works with\n"
   .ascii  "   GNU/Linux.  When the next Motif or Qt appears, will these magazines\n"
   .ascii  "   warn programmers to stay away from it, or will they run ads for it?\n"
   .ascii  "\n"
   .ascii  "   The support of business can contribute to the community in many ways;\n"
   .ascii  "   all else being equal, it is useful.  But winning their support by\n"
   .ascii  "   speaking even less about freedom and principle can be disastrous; it\n"
   .ascii  "   makes the previous imbalance between outreach and civics education\n"
   .ascii  "   even worse.\n"
   .ascii  "\n"
   .ascii  "   \"Free software\" and \"open source\" describe the same category of\n"
   .ascii  "   software, more or less, but say different things about the software,\n"
   .ascii  "   and about values.  The GNU Project continues to use the term \"free\n"
   .ascii  "   software\", to express the idea that freedom, not just technology, is\n"
   .ascii  "   important.\n"
   .ascii  "\n"
   .ascii  "  Try!\n"
   .ascii  "\n"
   .ascii  "   Yoda's philosophy (\"There is no `try'\") sounds neat, but it doesn't\n"
   .ascii  "   work for me.  I have done most of my work while anxious about whether I\n"
   .ascii  "   could do the job, and unsure that it would be enough to achieve the\n"
   .ascii  "   goal if I did.  But I tried anyway, because there was no one but me\n"
   .ascii  "   between the enemy and my city.  Surprising myself, I have sometimes\n"
   .ascii  "   succeeded.\n"
   .ascii  "\n"
   .ascii  "   Sometimes I failed; some of my cities have fallen.  Then I found\n"
   .ascii  "   another threatened city, and got ready for another battle.  Over time,\n"
   .ascii  "   I've learned to look for threats and put myself between them and my\n"
   .ascii  "   city, calling on other hackers to come and join me.\n"
   .ascii  "\n"
   .ascii  "   Nowadays, often I'm not the only one.  It is a relief and a joy when I\n"
   .ascii  "   see a regiment of hackers digging in to hold the line, and I realize,\n"
   .ascii  "   this city may survive--for now.  But the dangers are greater each year,\n"
   .ascii  "   and now Microsoft has explicitly targeted our community.  We can't take\n"
   .ascii  "   the future of freedom for granted.  Don't take it for granted! If you\n"
   .ascii  "   want to keep your freedom, you must be prepared to defend it.\n"
   .ascii  "\n"
   .ascii  "  Copyright (C) 1998 Richard Stallman\n"
   .ascii  "\n"
   .ascii  "  Verbatim copying and distribution of this entire article is permitted\n"
   .asciiz "  in any medium, provided this notice is preserved.\n"