Essay,
Pages 12 (2824 words)
What is an operating system?
- Kernel – provides a well-defined interface between programs and the hardware. It is a resource manager where the resources include memory, CPU access, input/output ports, etc.
- Shell – interacts with the user, accepting commands and starting user programs.
- Utilities – include programs required to make the system useful, such as programs to copy files, or simple text editors.
- Windowing system – a collection of programs that implement a graphical user interface.
Although the traditional definition of an operating system includes just the kernel, it is now more commonly known as a collection of most or all of these components.
Don’t waste time
Get Your Custom Essay on
“An Operating System and How a Kernel Defines the Operating System”
Get High-quality Paper
helping students since 2016
How A Kernel Defines the Operating System
How a kernel defines the interface between programs and the underlying hardware greatly affects the programs designed for that operating system. Some features that define the kernel are:
- Single or Multi-Tasking
- A single-tasking operating system allows only one program to run at a time. This program must complete before a second program may begin.
- A multi-tasking operating system allows multiple programs to run on the same system. In order to do this, it must define a means of communicating between programs, protecting running programs from errors encountered in other programs, and for scheduling when programs will run.
- Single or Multi-User
- A single-user operating system has only one user at a time. This user is granted exclusive access to all system resources.
- A multi-user operating system can have more than one user at the same time. Most multi-user operating systems are also multi-tasking.
- Memory Management
- This defines how memory is allocated to specific tasks, and how memory is protected from other processes.
- Device Interface
- Device interfaces define the nature of the peripherals which may be connected to a system, the ease with which new devices are added, the extent to which the full power of a device may be used, and how knowledgeable user programs have to be to work with that device.
- File System
- The design of the file system is often so closely linked to the kernel design that is often the first indicator of differences between similar operating systems. This can include such simple clues as how files are named, or how directories or folders are named.
- Degree of Integration
- While some systems attempt to separate the various layers of products into separate distinct systems, others try to tightly integrate them often to the point where the separate functions become indistinguishable.
- Security System
- Although security is often associated with unauthorized access by malicious users, it is also associated with protection from poorly designed programs.
UNIX Operating System Overview
- Multi-user, multi-tasking
- Virtual memory management, strong task protection
- Devices look like files, usually with little information required about device features for its effective use.
- A single file system includes all mounted drives, whether spanning physical drives or even machines.
- A low degree of integration in that services are layered, with little overlap.
- Strong system security features both internally and across networks.
- Highly portable, available on machines ranging from PC’s to supercomputers.
The Shell
- UNIX shells are programs like any other application
- Commands typed in by the user are interpreted (parsed) by the shell and then passed on to the kernel for processing
- The shells can interpret a sequence of commands and support modern programming constructs and are in fact a programming language in their own right
- Users can modify their environment via environment variables that the shells interpret
- Many shells are available, strictly user preference dictates which one may be used
- The Bourne shell (sh) is always used by the root user (superuser) for historic and guaranteed compatibility reasons
- The C shell (csh) is a very popular shell used by programmers
- The Korn shell (ksh) is a shell gaining in popularity
- The Bourne-Again shell (bash) is a popular public domain shell (GNU)Shells – Common Features
- Command inputs to the shell arrive from a variety of sources
- keyboard
- files
- another command (pipes)
- Command outputs may be redirected to
- terminals
- files
- another command
- All shells have programming constructs that enable decisions to be made in the sequence of commands. Looping is also supported
- Users may execute commands in both the foreground and the background
- Command input, command output, redirection
- Programming constructs
- Foreground execution
- Background execution
- Shorthand file naming
- Customized user environment
The Bourne Shell (sh)
- Developed at AT&T Bell Labs by Stephen Bourne
- Historically precedes all other shells
- Used for most of the system related scripts
- Uses the “$” symbol for the user prompt as a default
The C Shell (csh)
- Developed at University of California at Berkeley (UCB) by William Joy
- Uses a command syntax closely modeled after the C programming language
- Support for command aliases, name your own
- Supports a command history mechanism, command typed in earlier may be recalled, modified and resubmitted
- Supports a nenhanced job control mechanism fortheforeground and back ground execution of commands
- Usesthe “%” symbolfortheuserpromptas a default
The Korn Shell (ksh)
- AT&T follow on to the Bourne shell
- Historically follows both the Bourne and the C shell
Supports all the innovations found in the C shell and adds new functionality
- Supports enhanced command editing
- Supports command history features
- Supports command aliases
The Bourne-Again Shell (bash)
- Developed by Brian Fox of the Free Software Foundation, Inc.
- Supports the features of C shell, Korn shell, and Bourne shell
- Syntax of commands is similar to the Bourne shell
- Programming language is compatible with the Bourne shell
- Supports filename completion
Shell Command Structure
- All commands have
- A command name
- Zero or more options
- Zero or more arguments
- Unix is case sensitive, commands are usually (not always) in lowercase
- The options are usually preceded by a minus (-) sign to indicate the option is on
- The arguments are command specific, for example a file name
command (+/- option] [arguments]
Files and Directories
- A file contains zero or more bytes (characters) of information
- A directory contains zero or more references to files and/or other directories
- The users current directory, immediately upon logging in, is the assigned home directory
- The system administrator usually decides the actual location within the file system
- The file system is based on an inverted tree architecture
Multi-User Features
- UNIX supports multiple, concurrent users
- Identification of each user is by assignment of a unique user name and corresponding user id
- The system administrator assigns the user name and user id for each account on the system
- Several names are reserved for special UNIX users, such as
- Root, the superuser account
- Only one root user per system
- Highest access, hence the term superuser
- No restrictions
- Can execute all commands
- Many ordinary users exist on a system
- For confidentiality ordinary users may
- Create, modify and delete only their own files
- Be part of a group of users, whereby members of the group may be granted access to specific files
- Grant any user on the system access to files if desired
The Password File – /etc/passwd
- The password file is where all user account information is contained, this includes
- The user’s login name and id
- The user’s password, encrypted
- Many Unix systems now use shadow password files where the actual encrypted field is contained
- The user’s group id
- Text describing the user, used by some utilities
- The user’s home (login) directory
- The user’s login shell (sh, csh, ksh or other shell)
- The password file is read only to everyone on the system, except root
The Group File – /etc/group
- The group file defines which users are members of the available groups
- Groups are defined by a group name followed by a list of which users belong to the group
- Users may belong to more than one group
- The group file is read only to everyone on the system, except root
Logging on to the system is referred to as the login process
- To log on, a user is required to have an account
- An account is comprised of a login name and a password
Once the user enters the login name and password, the system validates the account and then sets up the user based on the account information in the password file
- The user can now interact with the selected login shell
- An invalid user name and/or password results in a “Login incorrect” message
The Login Process
- After “logging in” each user is interacting with a shell
- Which one is based on preference, usually assigned to the user by the system administrator
- The first shell is referred to as the login shell
- Although not immediately obvious, users may be executing more than one shell concurrently
- By default
- Standard input is from the users terminal keyboard
- Standard output is to the users terminal screen
- Standard error (command diagnostics) output is to the users terminal screen
Logging on – details
- User account names follow a specific set of rules
- Combination of lowercase letters and/or numbers
- No embedded blanks
On some systems, user passwords
- Are not echoed (displayed on the screen for security reasons
. Must be at least six characters long
- Must contain at least two letters and one number
- Cannot be the account name (or reverse of)
- The system performs numerous steps during the login process. For a login shell, the profile file is executed on behalf of the user if either the Bourne or Korn shells are used. For the C shell, the .login file is executed and, for the bash shell, the .bash profile is run. The C, Korn and Bash shells each read an additional file, the .cshrc, .kshrc and .bashrc respectively, prior to each new shell instance,
Changing Passwords
- The passwd command is used to change a users password
- The root user may change any users password
- The passwd command changes the users password after first validating that the user knows the old password, if one existed
- The user is asked to re-enter the new password
Logging out
- To leave the system, the user should always log off
- Failure to do so means anyone may access the users account
- Depending on which shell is being used the user logs of using
exit – for the Bourne shell
- Control-D – for any of the shells unless the ignore environment variable in the C and Korn shells has been set true
- logout – for the C shell
- For the C shell users the script .logout, if found in the users home directory, is executed as part of the logout sequence
UNIX File Types
- There are essentially three different types of files in UNIX, namely
- Ordinary Files
- Directory files
- Special (device files)
Ordinary Files
- Traditional general purpose files used by both the users, the system and applications to store information
- UNIX imposes no record structure rules or guidelines on the actual structure of regular files
- User data files, program files, scripts, …
- System executables, scripts, mail files, …
- Are the most common type of file accounting for most of the files on the system
Directory Files
- Directory files are files that contain references to other files
- Within directories there may be references to ordinary files, special files and other directory files
- Directories allow both the users and the system to group related files by category, making the process of locating files simpler
Special (Device) Files
- Unix handles operations on the hardware and software devices within the system identically to the input and output operations on files within the file system
- The hardware and software devices are accessed through special device files found in the /dev directory
- In essence, special device files
- Identify the hardware devices and software drivers used by the system
- Allow the user to handle I/O devices in the same way that other files are handled
- Are usually located in the system directory /dev
File Names
- Every file on the system has a name
- These are unique within a directory only, i.e. two files with the same name may exist in different directories
- File names can be up to 255 characters in length and few restrictions on the characters within the file name are imposed
- The size of a file is constrained by either the actual hardware or by settings within the setup of the system
Current Directory – pwd
- Displays the full path name of the current directory
- The user’s home directory is the default location upon logging on to the system
- All directories have a unique path name
- The shell variables pwd (Bourne, Korn, Bash) and cwd (C shell) values indicate the current directory path name
Navigating the File System
All Shells
cd [directory]
All shells except Bourne
cd -[user) (directory]
cd changes the current directory to the specified directory
Navigating the File System – Hierarchy
- Directories are organized in a tree structure
- The topmost directory is called the root directory and is referenced by the symbol / (forward slash)
- To travel directly to the root directory, the cd command with the root file symbol / is all that is required
- At any given directory, to travel down to any other directory we need only specify the name of the directory (relative traversal)
- Two special files exist in every directory
- The parent directory .. (two dots)
- This does not exist for root, no parent !!
- The current directory. (single dot)
- To move one level up to the parent directory, the command cd .. (relative traversal from the current directory to the parent directory) is used
- In any given directory, ordinary files and/or device files within the directory are accessed directly by name
- To move directly to a given directory from any arbitrary location, an absolute specification of the directory may be given such as cd /dev/rdsk or, if desired, a relative path such as cd ../../dev/rdsk
Navigating the File System – Home Directories
- Using cd with no arguments changes the current directory to the user’s home directory (same area as at login time)
- Using the C, Korn, or Bash shells, the ~ option without a user specification (implies the current user) changes the current directory to the directory specified within the user’s home directory
- Using the C, Korn, or Bash shells, the ~ option with a user specification changes the current directory to the directory within the specified user’s home directory
- If no directory is specified and the – option is used, the current directory is the specified user’s home directory
- The directory specification can be an absolute or relative specification
Navigating the File System – Nomenclature
- Parent Directory – directory one level above a given directory, root has no parent
- Subdirectory – directory one level below a given directory
- Pathname – sequence of one or more directories separated by slashes, indicates the order to follow to locate a file
- Full Pathname – also known as absolute pathname, indicates the path to follow from the root directory / and therefore starts with a /
- Relative Pathname – route to follow from the current directory to locate a file
- Travelling Upward – use the current directory. (single dot) followed by one or more .. (double dots) to traverse parent directories
Benefits of a Hierarchical File System
- Organization
- Permits users to group their files
- Encourages putting related files under same directory
- Usually different users have separate directory trees
- Peripheral devices
- Have file names
- Therefore, easy to add, modify and subtract devices without forcing a system reboot
- Portability
- Easy to transport directory trees and whole file systems among UNIX systems
File Types
file file_specification
. The file command tries to determine the type of the file given the file name
- There are numerous file types, some of the most common are
- Test files
- Directories
- Executables
- Object files
- C source code
Important System Directories
/ root directory, ancestor of all files
/bin standard UNIX utility programs
/sbin system administration utilities, booting files
/var holds files that vary as the system runs
/dev special (device) files, terminals, printer, …
letc administration, configuration and other system files (password, group files)
/tmp area for temporary storage, usually cleaned up after reboots, never store important files here
Hard Drives, Partitions, CDROM, Network Drives, …
- In other operating systems (DOS, Windows, Mac, OS/2) second hard drives, partitions, CDROMS, and network drives are displayed as a separate folder at the same level as the main drive (i.e. C:, D:, E:)
- In Unix there is nothing before the root /. All other drives are contained within the root, transparent to the user. The root user sets up the additional drives using the mount command.
- /dev/sdal on / is the main hard drive mounted at the root
- /dev/sdb2 on /home2 is a second hard drive mounted at /home2. That is if you look at the contents of /home2 you will be looking at the contents of the second hard drive.
- /dev/scdo on /cdrom is a SCSI cdrom mounted at /cdrom.
fox:/home on /tmp/home is the home directory of the machine fox mounted at /tmp/home.
Bibliography
- Learning the UNIX Operating System, 4th Edition
By Jerry Peek, Grace Todino, and John Strang
O’Reilly & Associates, Inc.
- UNIX For Dummies, 2nd Edition
By John R. Levine and Margaret Levine Young
IDG Books Worldwide, Inc.
Don’t waste time
Get Your Custom Essay on
“An Operating System and How a Kernel Defines the Operating System”
Get High-quality Paper
helping students since 2016