11.07.2015 Views

Encyclopedia of Computer Science and Technology

Encyclopedia of Computer Science and Technology

Encyclopedia of Computer Science and Technology

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

UNIX 485Vasilakos, Athanasios, <strong>and</strong> Witold Pedrycz, eds. Ambient Intelligence,Wireless Networking, <strong>and</strong> Ubiquitous Computing. Boston:Artech House, 2006.UNIXBy the 1970s, time-sharing computer systems were in use atmany universities <strong>and</strong> engineering <strong>and</strong> research organizations.Such systems, <strong>of</strong>ten running on computers such asthe PDP series (see minicomputer), required a new kind<strong>of</strong> operating system that could manage the resources foreach user as well as the running <strong>of</strong> multiple programs (seemultitasking).An elaborate project called Multics had been begun inthe 1960s in an attempt to create such an operating system.However, as the project began to bog down, two <strong>of</strong> its participants,Ken Thompson <strong>and</strong> Dennis Ritchie (see Ritchie,Dennis) decided to create a simple, more practical operatingsystem for their PDP-7. The result would become UNIX,an operating system that today is a widely used alternativeto proprietary operating systems such as those from IBM<strong>and</strong> Micros<strong>of</strong>t.ArchitectureThe essential core <strong>of</strong> the UNIX system is the kernel, whichprovides facilities to organize <strong>and</strong> access files (see kernel<strong>and</strong> file), move data to <strong>and</strong> from devices, <strong>and</strong> controlthe running <strong>of</strong> programs (processes). In designing UNIX,Thompson deliberately kept the kernel small, noting that hewanted maximum flexibility for users. Since the kernel wasthe only part <strong>of</strong> the system that could not be reconfigured orreplaced by the user, he limited it to those functions that reliability<strong>and</strong> efficiency dictated be h<strong>and</strong>led at the system level.Another way in which the UNIX kernel was kept simplewas through device independence. This meant that instead<strong>of</strong> including specific instructions for operating particularmodels <strong>of</strong> terminal, printers, or plotters within the kernel,generic facilities were provided. These could then be interfacedwith device drivers <strong>and</strong> configuration files to controlthe particular devices.A UNIX system typically has many users, each <strong>of</strong> whommay be running a number <strong>of</strong> programs. The interface thatprocesses user comm<strong>and</strong>s is called the shell. It is importantto note that in UNIX a shell is just another program,so there can be (<strong>and</strong> are) many different shells reflectingvarying tastes <strong>and</strong> purposes (see shell). Traditional UNIXshells include the Bourne shell (sh), C shell (csh), <strong>and</strong> Kornshell (ksh). Modern UNIX systems can also have graphicaluser interfaces similar to those found on Windows <strong>and</strong>Macintosh personal computers (see user interface).Working with Comm<strong>and</strong>sUNIX systems come with hundreds <strong>of</strong> utility programs thathave been developed over the years by researchers workingat Bell Labs <strong>and</strong> campuses such as the University <strong>of</strong> Californiaat Berkeley (UCB). These range from simple comm<strong>and</strong>sfor working with files <strong>and</strong> directories (such as cd to set acurrent directory <strong>and</strong> ls to list the files in a directory) tolanguage compilers, editors, <strong>and</strong> text-processing utilities.Whatever shell is used, UNIX provides several key featuresfor constructing comm<strong>and</strong>s. A powerful system <strong>of</strong>patterns (see regular expression) can be used to find filesthat match various criteria. For a very simple example, thecomm<strong>and</strong>% ls *.docwill list all files in the current directory that end in .doc.(The % represents the comm<strong>and</strong> prompt given by the shell.)Most earlier operating systems used special syntax torefer to devices such as the user’s terminal <strong>and</strong> the printer.UNIX, however, treats devices just like other files. Thismeans that a program can receive its input by opening a terminalfile <strong>and</strong> send its output to another file. For example:% cat > noteThis is a note.^DThe cat (short for concatenate) comm<strong>and</strong> adds the user’sinput to a file called note. The ^D st<strong>and</strong>s for Control-D, thespecial character that marks end-<strong>of</strong>-file. Once the comm<strong>and</strong>finishes, there is a file called note on the disk, which can belisted by the ls comm<strong>and</strong>:% ls –l note-rw———- 1 hrh well 16 Mar 25 20:16 noteThe contents <strong>of</strong> the file can be checked by issuinganother cat comm<strong>and</strong>:% cat noteThis is a note.Many comm<strong>and</strong>s default to taking keyboard input if noinput file is specified. For example, one can type sort followedby a list <strong>of</strong> words to sort:% sortapplepearorangetangerinelemon^DOnce the input is finished, the sort comm<strong>and</strong> outputsthe sorted list:applelemonorangepeartangerineOne <strong>of</strong> the things that makes UNIX attractive to its usersis the ability to combine a set <strong>of</strong> comm<strong>and</strong>s in order to performa task. For example, suppose a user on a timesharingsystem wants to know which other users are logged on. Thewho comm<strong>and</strong> provides this information, but it includes alot <strong>of</strong> details that may not be <strong>of</strong> interest. Suppose one justwants the names <strong>of</strong> the current users. One way to do this isto connect the output <strong>of</strong> the who comm<strong>and</strong> to awk, a scriptinglanguage (see awk <strong>and</strong> scripting languages).

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!