Aim or Objective :
To study basics of UNIX Operating System .
The Shell
- The shell is the interface between the command language user and the OS
 
- The shell is a user interface and comes in many forms (Bourne Shell, sh; Berkeley C Shell, csh; Korn Shell, ksh; Restricted Shell, rsh)
 
- User allowed to enter input when prompted ($ or %)
 
- System supports all shells running concurrently. Appropriate shell is loaded at login, but user can usually (except in sh, rsh) dynamically change the shell
 
- A UNIX command takes the form of
 
 executable_file [-options] arguments 
 
- The shell runs a command interpretation loop
 
 - accept command
 
- read command
 
- process command
 
- execute command
 
- Executing the command involves creating a child process running in another shell (an environment within which the process can run). This is done by Forking.
 
- The parent process usually waits for the child to terminate before re-entering the command interpretation loop
 
- Programs can be run in the background by suffixing the command-line entry with an ampersand (&). Parent will not wait for child to terminate
- accept command
- read command
- process command
- execute command
The Processing Environment
Input and Output- UNIX automatically opens three files for the process
 
 STDIN - standard input (attached to keyboard)
 STDOUT - standard output (attached to terminal)
 
 STDERR - standard error (attached to terminal)
 
 
- Because UNIX treats I/O devices as special types of files, STDIO can be easily redirected to other devices and files
 
 who > list _of _users 
- STDIN - standard input (attached to keyboard)
STDOUT - standard output (attached to terminal)
STDERR - standard error (attached to terminal)
The Kernel
- Central part of the OS which provides system services to application programs and the shell
 
- The kernel manages processes, memory, I/O and the Timer - so this is not the same as the kernel that we covered in Lecture 3!
 
- UNIX supports multiprogramming
 
- Processes have their own address space - for protection
 
- Each process's process environment is composed of an unmodifiable re-entrant text (code) region, a modifiable data region and a stack region.
 
- The text region is shareable
 
- Processes can modify their environment only through calls to the OS
The File System
- UNIX uses HDS with root as its origin
 
- A directory is a special UNIX file which contains file names and their i-nodes (index nodes)
 
- Subdirectories appear as file entries
 
- Directories cannot be modified directly, but can are changed by the operating system when files and subdirectories are created and deleted
 
- File and Directory names must be unique within a particular directory (i.e., the path name must be unique)
 
- The File System is a data structure that is resident on disk
 
- It contains a super block (definition of the file system); an array of i-nodes (definition of the files in the system); the actual file data blocks; and a collection of free blocks
 
- Space allocation is performed in fixed-size blocks
The i-node- Contains
 
 the file owner's user-id and group-id
 protection bits for owner, group, and world
 
 the block locator
 
 file size
 
 accounting information
 
 number of links to the file
 
 file type
 
 
The Block Locator- Consists of 13 fields
 
- First 10 fields points directly to first 10 file blocks
 
- 11th field is an indirect block address
 
- 12th field is a double-indirect block address
 
- 13th field is a triple-indirect block address
Permissions- Each UNIX file and directory has 3 sets of permission bits associated with it
 
- These give permissions for owner, group and world
 
- System files (inc. devices) are owned by root, wizard, or superuser (terminology!)
 
- Root has unlimited access to the entire installation - whoever owns the files!
Setuid- When you need to change your password, you need to modify a file called /etc/passwd. But this file is owned by root and nobody other than root has write permission!
 
- The passwd command (to change passwords) is owned by root, with execute permission for world.
 
- The setuid is a bit which when set on an executable file temporarily gives the user the same privileges as the owner of the file
 
- This is similar in concept to some OS commands executing in Supervisor mode to perform a service for an otherwise unauthorised process
- the file owner's user-id and group-id
protection bits for owner, group, and world
the block locator
file size
accounting information
number of links to the file
file type
 
Post a Comment