1 / 14

Unix Comp-145

Unix Comp-145. Lecture 1: Concepts of the UNIX Operating System Source: S. Das, “Your Unix: The ultimate Guide”, 2 nd Edition, McGraw Hill, 2006. Contents. Why an Operating System (OS) How a Program Runs on a Computer Running Multiple Programs Key Concepts

declan
Télécharger la présentation

Unix Comp-145

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Unix Comp-145 Lecture 1: Concepts of the UNIX Operating System Source: S. Das, “Your Unix: The ultimate Guide”, 2nd Edition, McGraw Hill, 2006 BROOKDALE COMMUNITY COLLEGE

  2. Contents Why an Operating System (OS) How a Program Runs on a Computer Running Multiple Programs Key Concepts UNIX Architecture: The Kernel UNIX Architecture: The Shell UNIX Fragmentation Why UNIX Commands Are Noninteractive Structure of a Command Types of Commands How the Shell Determines the Command to Run BROOKDALE COMMUNITY COLLEGE

  3. Why an Operating System (OS) • OS interacts with hardware and manages programs. • Programs not expected to know which hardware they will run on. • Must be possible to change hardware without changing the programs. • Programs can’t manage themselves. • OS provides a safe environment for programs to run. BROOKDALE COMMUNITY COLLEGE

  4. Important Organizations & Standards for UNIX • The OPEN GROUP • Owns UNIX trademark • POSIX – Portable Operating System Interface [for UNIX] • Defines standardized UNIX computing environment • OSs based on UNIX can claim conformity • Specification Issue 6 • XPG – X-Open Portability Guide BROOKDALE COMMUNITY COLLEGE

  5. How a Program Runs on a Computer • OS loads program from disk and allocates memory and CPU. • Instructions in program are run on CPU and OS keeps track of last instruction executed. • If program needs to access the hardware, OS does the job on its behalf. • OS saves the state of the program if program has to leave CPU temporarily. • OS cleans up memory and registers after process has completed execution. BROOKDALE COMMUNITY COLLEGE

  6. Running Multiple Programs • Multiprogramming: Multiple programs can be in memory. • Multiuser: Multiple users can run programs. • Multitasking: One user can run multiple programs. BROOKDALE COMMUNITY COLLEGE

  7. Key Concepts • Everything in the system is represented as a file. • Work gets done by processes • The program of execution in foreground & background • Workload shared by two separate programs(kerneland shell) • Kernel – the Core OS • Shell – Interfaces with user program & OS. Interpreted set of commands in an environment, e.g., a login session • Kernel uses system calls to do most of the work. • All UNIX systems use the same system calls. BROOKDALE COMMUNITY COLLEGE 11/19/2009 rwj BROOKDALE COMMUNITY COLLEGE 7

  8. UNIX Architecture: The Kernel • Program always resides in memory, i.e., the OS. • Has direct access to the hardware. • Handles file I/O. • Manages processes. • Only one copy shared by all users. BROOKDALE COMMUNITY COLLEGE

  9. UNIX Architecture: The Shell • A program or command invoked only when the user logs in. • Accepts user input, examines and rebuilds the command line. • Makes calls to the kernel for all other functions. • At least one shell is invoked by every user. • User has a choice of shells. BROOKDALE COMMUNITY COLLEGE

  10. UNIX’s Fragmented Evolution • System V from AT&T (SVR4) • BSD UNIX from Berkeley • Linux with help from GNU BROOKDALE COMMUNITY COLLEGE

  11. Why UNIX Commands Are Non-interactive • Command may take input from the output of another command. • May be scheduled to run at specific times (e.g., at & cron). • User input can also be provided through command line arguments. • Command arguments need not be known in advance. • Allows designing of applications that determine their own behavior by reading configuration files. • NOTES: • 1. Many UNIX commands (called filters) possess an unusual property in that the output of one command can be connected to the input of another. In this way, pipelines of two or more commands can be set up to handle complex text manipulation tasks. You can’t have a pipeline of interactive commands. • 2. The behavior of some applications like the shell is mainly determined by settings placed in a configuration file. The application reads this file on startup and then knows how to behave. A major advantage of noninteractivity. BROOKDALE COMMUNITY COLLEGE

  12. Structure of a Command • e.g. ls -l -u -t chap01 • Command filenames need no specific extensions. • A command’s behavior is determined by its arguments and options. • Command and arguments mustbe separated by whitespace. • Generally possible to combine multiple options into a single one • (like ls -l -u -t== ls -lut) • Order of combining is generally not important (like ls -lut== ls -utl) BROOKDALE COMMUNITY COLLEGE

  13. Types of Commands • External program on disk which could be • a binary executable (written in C, C++). • a script file (like a shell or perl script). • Internal command of the shell which could be • a built-in (like cd, pwd, etc.) • an alias defined by the user that invokes the disk or • internal version in a specific manner. BROOKDALE COMMUNITY COLLEGE

  14. How the Shell Determines the Command to Run • If command is invoked with a pathname (like /bin/echo), theshell runs program at the specified location. • If command is invoked without a pathname, the shell first checks whether it is an alias or built-in: • If alias or built-in, the shell runs it without looking in disk. • Examples of built-in commands: type, whatisandwhich • NOTE: These commands can help locate other commands and determine which commands are built-in • If not, the shell looks at the PATH variable for directories where the command may reside. • $ echo $PATH where $echois a shell, $pathindicatesinput variable BROOKDALE COMMUNITY COLLEGE

More Related