Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

70
Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System

Transcript of Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Page 1: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating SystemsFifth Edition

Chapter 13

Unix Operating System

Page 2: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 2

Learning Objectives

• The goals of UNIX designers

• The significance of using files to manipulate devices

• The strengths and weaknesses of having competing versions of UNIX

• The advantages of command-driven user interfaces

• The roles of the Memory, Processor, Device, and File Managers in UNIX

Page 3: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 3

Overview

• Three major advantages of UNIX– Portability

• Code written in high-level language (C language) – Powerful utilities

• Brief, single operation commands• Combinable into single command

– Application device independence• Configurable to operate on any device type

• Disadvantage– No single standardized version– Brief, cryptic commands difficult for novice learner

Page 4: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 4

History

• Research project originally in 1965– Joint venture between Bell Labs, AT&T, General

Electric, and MIT• Goal

– Develop MULTICS for GE-645 mainframe• MULTICS ambition

– Serve diverse user group needs• Too intricate, complex, large for commercial value

• Bell labs withdrew in 1969• Ken Thompson and Dennis Ritchie continued the

project

Page 5: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 5

History (continued)

Page 6: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 6

The Evolution of Unix

• Original language– DEC PDP-7 assembly language

• First official version: 1971– Design

• Do one thing well

– Ran on DEC PDP-11– No pipes or filters

• Added in version 2

• Thompson and Ritchie: version 3– New programming language (C language)

Page 7: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 7

The Evolution of Unix (continued)

• AT&T forbidden to sell software– Universities and developers advanced software

• Commercial transformation

• Berkley BSD version: 1973-1975

• 1984: government deregulation– AT&T personal computer with UNIX System 4

• Contained additional Berkley version features

• AT&T System 4 promotion as standard fails

• 1990: two dozen versions

Page 8: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 8

The Evolution of Unix (continued)

• 1991: AT&T UNIX system laboratories– Develops System V release 4– Features

• System V release 3, BSD 4.3, SunOS, Xenix

• “The Open Group” formed– Owns UNIX trademark

• 1993: Berkeley– 4.4 BSD: based on AT&T’s UNIX (AT&T license)– Novell acquires UNIX from AT&T

Page 9: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 9

The Evolution of Unix (continued)

• Current releases– Modify “do one thing well” position– Commands more difficult to use

• Pipelines preserved– Adaptable to new situations with ease

• Meet new user needs– Full local area network support– Comply with international standards– Security improved– Uses Common Desktop Environment (CDE)– ISO/IEC 9945:2003 Standard

Page 10: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 10

Design Goals

• Thompson and Ritchie vision– UNIX operating system

• Created by programmers for programmers– Fast, flexible, easy-to-use

• Immediate goals– Support software development

• Included utilities for customized code• Utilities designed for simplicity: do one thing well• Small manageable sections of code

– Keep algorithms simple• Based on simplicity, not sophistication

Page 11: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 11

Design Goals (continued)

• Long-term goal– Portability

• Reduces conversion costs• Application packages not obsolete

– Achieved with UNIX version 4• Hardware independent

• POSIX – Portable operating system interface for computer

environments• IEEE standards defining portable operating system

interface• IEEE STD. 1003.1 (2004 edition)

Page 12: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 12

Memory Management

• Multiprogramming systems– Swapping (small jobs)

• Entire program in main memory before execution

• Program size restriction

• Round robin policy

– Demand paging (large jobs)• More complicated hardware

• Increases system overhead

• Thrashing (under heavy loads)

• Advantage: implements virtual memory concept

Page 13: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 13

Memory Management (continued)

• Typical internal memory layout (single user)– Program code– Data segment– Stack

Page 14: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 14

Memory Management (continued)

• Program code– Sharable portion of program– Reentrant code

• Physically shared by several processes

• Code protected: instructions not modified during normal execution

• Data references: without absolute physical address

– Space allocation• Program cannot release until all processes completed

• Text table: tracks processes using program code

Page 15: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 1515

Memory Management (continued)

• Data segment– After program code

• Grows toward higher memory locations – Nonsharable section of memory

• Stack– Starts at highest memory address

• Grows downward• Subroutine calls and interrupts add information • Main memory • Process information saved when process interrupted

– Nonsharable section of memory

Page 16: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 16

Memory Management (continued)

• UNIX kernel– Implements “system calls”

• Memory boundaries for process coexistence

– System calls• File Manager interaction and request of I/O services

– Implements most primitive system functions• Permanently resides in memory

– Uses LRU page replacement algorithm

• Network PCs, single-user, and multi-user systems– Use same memory management concepts

Page 17: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 17

Process Management

• Handles– CPU allocation– Process scheduling– Satisfaction of process requests

• Kernel maintains tables– Coordinates process execution– Device allocation

• Uses predefined policies– Select process from READY queue– Begin execution

• Give time slice

Page 18: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 18

Process Management (continued)

• Process scheduling algorithm– Selects highest priority process to run first– Priority value: accumulated CPU time

• Processes with large CPU time get lower priority

– Compute-to-total-time ratio• System updates for each job every second

• Total time process in system divided by used process CPU time

– Ratio = one• CPU-bound job

Page 19: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 19

Process Management (continued)

• Process scheduling algorithm (continued)– Processes with same computed priority

• Handled by round robin

– Interactive processes: low ratio (no special policies)– Balance I/O-bound jobs with CPU-bound jobs

• Keeps processor busy

• Minimizes waiting processes overhead

Page 20: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 20

Process Management (continued)

• Process scheduling algorithm (continued)– Loading process from READY queue

• Process with longest secondary storage time

– Swap out process• Process waiting longest (disk I/O, idle )

– When processor becomes available• Process selected may not be ready (waiting on I/O)

• Determine inactive but ready for execution

• Process priorities recalculated

• Handled dynamically

Page 21: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 21

Process Table Versus User Table

• Simple processes (nonsharable code)

• Tables– Keep system running smoothly

• Process table– Always resides in memory– Maintains text table

• User table– Resides in memory while process is active– User table, process data segment, code segment

• Swapped as needed

Page 22: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 22

Page 23: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 23

Process Table Versus User Table (continued)

• Process table

• Each entry contains: – Process identification number– User identification number– Process memory address or secondary storage

address– Process size and scheduling information

• Set up when process is created

• Deleted when process terminates

Page 24: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 24

Process Table Versus User Table (continued)

• Text table– Sharable code processes– Process table maintains

• Contains:– Memory address or secondary storage address of

text segment (sharable code)– Count: tracks number of processes using code

• Increased by one when process starts using code

• Decreased by one when process stops using code

• Count = 0: implies code no longer needed

Page 25: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 25

Process Table Versus User Table (continued)

• User table– Allocated to each active process– Stored in transient memory area

• Contains:– User and group identification numbers

• Determine file access privileges– Pointers to system’s file table

• Every file process uses– Pointer to current directory– List of responses for various interrupts– All information accessible when process running

Page 26: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 26

Synchronization

• UNIX– True multitasking operating system

• Requires processes wait for certain events– Each event represented by integers

• Equal to address of table associated with event

• Race occurs – Event happens during process transition decision

• Wait for event and entering WAIT state

Page 27: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 27

Synchronization (continued)

• fork– Execute one program from another program – Second program

• Given all first program attributes (open files)

– Save first program in original form– Split program: two copies

• Both run from statement after fork command

– fork executed• “Process id” (pid) generated

• Ensure each process has unique ID number

Page 28: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 28

Synchronization (continued)

Page 29: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 29

Synchronization (continued)

• wait– Synchronize process execution

• Suspend parent until child finished

– Program IF-THEN-ELSE structure• Controlled by pid value

• pid > zero: parent process

• pid = zero: child process

• pid < zero: error in fork call

Page 30: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 30

Synchronization (continued)

Page 31: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 31

Synchronization (continued)

• exec– Start new program execution from another program

• execl, execv, execls, execlp, and execvp

– Successful exec call • Overlay second program over first

• Only second program in memory

– No return from successful exec call• Parent-child concept: does not hold

– Each exec call• Followed by test ensuring successful completion

Page 32: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 32

Synchronization (continued)

Page 33: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 33

Device Management

• Device independence to applications– I/O device treated as special file type

• Device files given name– Descriptors called “iodes”

• Identifies devices, contains device information, stored in device directory

• Device drivers– Subroutines working with operating system – Supervise data transmission

• Between main memory and peripheral unit– Most common drivers included in UNIX

Page 34: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 34

Device Management (continued)

• Device driver kernel incorporation– During system configuration

• Recent UNIX versions– Program called config– Automatically creates conf.c

• For any hardware configuration– conf.c contains parameters controlling resources

• Number of internal kernel buffers and swap space size– conf.c contains two tables

• bdevsw (“block I/O switch”)• cdevsw (“character I/O switch”)

Page 35: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 35

Device Classifications

• Divide I/O system– “Block I/O” system (“structured I/O” system) – “Character I/O” system (“unstructured I/O” system)

• Physical device identification– Minor device number– Major device number– Class: block or character

Page 36: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 36

Device Classifications (continued)

Page 37: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 37

Device Classifications (continued)

• Class: block or character– Each has configuration table

• Array of entry points into device drivers– Major device number

• Index to array to access appropriate code (specific driver)

– Minor device number• Passed as an argument to device driver• Access one of several identical physical devices

– Block I/O system• Devices addressed as 512-byte block sequences• Allows device manager to buffer (reduce I/O traffic)

Page 38: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 38

Device Classifications (continued)

• Character class devices– Device drivers handle implementing character lists– Example: terminal

• Typical character device

• Two input queues and one output queue

• I/O procedure synchronized through hardware completion interrupts

• Some devices belong to both classes– Examples: disk drives, tape drives

Page 39: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 39

Device Drivers

• Special section in kernel– Includes instructions

• Allows operating system communication with device

• Disk drive’s device drivers– Use seek strategy to minimize arm movement

• Kept in set of files– Loaded as needed

• Case of seldom used devices– Kept in memory all the time

• Loaded at boot time– Kept in /dev directory by default and convention

Page 40: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 40

File Management

• Three file types – Directories– Ordinary files– Special files

• Each enjoys certain privileges

• Directories– Maintain hierarchical structure of file system– Users allowed to read information in directory files– Only system allowed directory file modification

Page 41: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 41

File Management (continued)

• Ordinary files– Users store information– Protection based on user requests

• Related to read, write, execute, delete functions performed on file

• Special files– Device drivers providing I/O hardware interface– Appear as entries in directories– Part of file system (most in /dev directory)– Special filename indicates type of device association

Page 42: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 42

File Management (continued)

• Files stored as sequences of bytes– No structure imposed

• Text files– Character strings

• Lines delimited by line feed, new line, character

• Binary files– Sequences of binary digits

• Grouped into words as they appear in memory during program execution

• Structure of files– Controlled by programs using them: not by system

Page 43: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 43

File Management (continued)

• Organizes disk into blocks of 512 bytes each

• Divides disk into four basic regions – First region (address 0): reserved for booting– Second region: contains disk size and other regions’

boundaries – Third region includes: file definitions called “i-list” – Remaining region: free blocks available for file

storage

• Files stored in contiguous empty blocks– Simple allocation and no need to compact

Page 44: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 44

File Management (continued)

• “i-node”

• Each entry in i-list called an “i-node” (or inode)– Contains 13 disk addresses

• Contains specific file information– Owner’s identification– Protection bits, physical address, file size– Time of creation, last use, and last update– Number of links– File type

• Directory, ordinary file, or special file

Page 45: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 45

File Naming Conventions

• Case-sensitive filenames

• 255 character length

• No file naming conventions– Some compilers expect specific suffixes

• Supports hierarchical tree file structure– Root directory identified by slash (/)

Page 46: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 46

File Naming Conventions (continued)

Page 47: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 47

File Naming Conventions (continued)

• Path name rules– Path name starting with slash

• Root directory

– Path name • One name or list of names: separated by slashes

• Last name on list: filename requested

– Two periods (..) in path name• Moves upward in hierarchy (closer to root)

• Only way to go up hierarchy

• All other path names go down tree

– Spaces not allowed within path names

Page 48: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 48

Directory Listings

• “long listing” – Eight pieces of information for each file

• First column – Shows file type and access privileges for each file

• First character: nature of file or directory

• Next three characters: access privileges granted file owner

• Next three characters: access privileges granted other user’s group members

• Last three characters: access privileges granted to users at large (system-wide)

Page 49: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 49

Directory Listings (continued)

• Second column– Indicates number of links (number of aliases)

• Referring to same physical file

• Aliases– Important UNIX feature: support file sharing

• Several users work together on same project– Shared files appear in different directories belonging

to different users– Filename: may be different from directory to directory– Eventually number will indicate when file no longer

needed: can be deleted

Page 50: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 50

Directory Listings (continued)

Page 51: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 51

Data Structures

• File descriptors divided into parts– Hierarchical directories

• Contain filename and i-number

• Pointer to another location: i-node

– i-node • Contains rest of information

– i-nodes stored in reserved part of device• Where directory resides

– i-node has 13 pointers (0–12)

Page 52: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 52

Data Structures (continued)

Page 53: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 53

Data Structures (continued)

• When file opened– Device, i-number, read/write pointer stored in system

file table and indexed by i-node

• When file created– i-node allocated to it– Directory entry with filename and i-node number

created

Page 54: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 54

Data Structures (continued)

• When file linked– Directory entry created with new name – Original i-node number and link-count field in the i-

node incremented by one

• When shared file deleted– Link-count field in i-node decremented by one– When count reaches zero

• Directory entry erased

• Deallocate all disk blocks and allocate i-node block to file

Page 55: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 55

User Interface

• Command-driven system

• User commands– Very short

• One character or a group of characters (acronym)

– Cannot be abbreviated or spelled out – Must be in correct case

• System prompt very economical– Only one character: ($) or (%)

• Error messages quite brief

Page 56: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 56

User Interface (continued)

Page 57: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 57

User Interface (continued)

• General syntax of commands– command arguments file_name

• “command”– Any legal operating system command

• Interpreted and executed by shell

• “arguments“– Required for some commands, optional for others

• “file_name” – Relative or absolute path name

Page 58: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 58

User Interface (continued)

Page 59: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 59

Script Files

• Automate repetitious tasks– Command files

• Often called shell files or script files

• Each line of file– Valid instruction

• Executed by typing sh and script file name

• Also executed by defining file as executable command– Type filename at system prompt

Page 60: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 60

Script Files (continued)

• Script file example

setenv DBPATH /u/lumber:.:/zdlf/product/central/db

setenv TERMCAP $INFODIR/etc/termcap

stty erase `^H’

set savehistory

set history=20

alias h history

alias 4gen infogen -f

setenv PATH /usr/info/bin:/etc

Page 61: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 61

Redirection

• Send output to file or another device– Symbol: > (between command and destination)– Examples:

• ls > myfiles• cat chapt1 chapt2 > sectiona,• cat chapt* > sectiona

– Symbol >> appends new file to an existing file– Examples:

• cat chapt1 chapt2 >> sectiona• cat chapt* >> sectiona

Page 62: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 62

Redirection (continued)

• Reverse redirection (<)– Takes input for program from existing file instead of

keyboard– Example:

• mail ann roger < memo

Page 63: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 63

Redirection (continued)

• Redirection (>)– Combined with system commands to achieve any

desired results– Example: who > temporary

• Store in “temporary” file: all user names logged on

• Interpretation of < and >– Carried out by shell – Not by individual program

• Input and output redirection– Used with any program

Page 64: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 64

Pipes

• Provide possibility to redirect output or input to selected files or devices– Connect output from one program to input of another– No need for temporary or intermediate files– Example: who | sort

• Pipeline– Several programs simultaneously processing same

I/O stream– Example: who | sort | lpr

Page 65: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 65

Filters

• Program– Read some input, manipulate it, generate output– wc (word count):

• Example: wc journal• System response: 10 140 700• File journal has 10 lines, 140 words, 700 characters

– sort: Contents of file sorted and displayed on screen• Example: sort sortednames

Page 66: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 66

Filters (continued)

• Sort list in alphabetical order ignoring letter case– sort –f > sortednames

• Obtain numerical sort in ascending order– sort -n > sortednums

• Obtain numerical sort in descending order– sort -nr > sortednums

Page 67: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 67

Additional Commands

• man– Displays operating system online manual– Example: man cmp

• Displays page for compare (cmp) command

• grep– “global regular expression and print”– Look for specific character patterns– Examples:

• grep Pittsburgh maillist• grep -v Pittsburgh maillist• grep -c Pittsburgh maillist

Page 68: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 68

Additional Commands (continued)

• grep (continued)– Can be combined with who command– Example: who | grep sam

• Sam’s name, device, date and time he logged in

– Example: ls -l / | grep '^d‘ • Displays subdirectories list (not files) in root directory

• nohup– Log off the system without program completion– Example:

nohup cp oldlargefile newlargefile and

Page 69: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 69

Additional Commands (continued)

• nice– Allows lowering program priority– Example:

nice cp oldlargefile newlargefile and

Page 70: Understanding Operating Systems Fifth Edition Chapter 13 Unix Operating System.

Understanding Operating Systems, Fifth Edition 70

Summary

• UNIX: major force in operating system field– Written by programmers for programmers– Quite popular among programmers

• Advantages– Spare user interface, device independence,

portability, lack of verbosity, powerful command combinations

• Disadvantages– Learning command-driven interface, brief commands

• Graphical interface and point-and-click surfacing