Upload
dinhnga
View
230
Download
0
Embed Size (px)
Citation preview
Department of
Engineering Technology
LSN 10
Linux Overview
ECT362 Operating Systems
ECT 362 Operating Systems [email protected]
LSN 10 – Linux Overview
• Linux
– Contemporary open source implementation of UNIX
available for free on the Internet
– Introduced in 1991 by Linus Torvalds
– UNIX OS introduced in 1973
• Small no-frills OS
• Kernel only contained essential functionality
• Source owned by AT&T Bell Labs (Lucent)
• 1989 released a common program interface POSIX
– First free form of UNIX source code
ECT 362 Operating Systems [email protected]
LSN 10 – Linux Distribution
• Includes OS
– Wide variety of supplemental tools
• Linux is the kernel of an OS, not a complete OS (just like UNIX)
• Common distributions
– Red Hat
– Fedora
– Mandrake
– SUSE
– Debian
– Linspire (Lindows)
– Ubuntu
ECT 362 Operating Systems [email protected]
LSN 10 – Kernel Organization
• Linux uses a monolithic kernel
• All OS functions reside in a single executable software
module except device management
– Device management is handled by a separate collection of
device drivers and interrupt handlers
• Linux added a container called a module to the
standard UNIX kernel organization
– Implement extensions to the main part of the kernel
– Can be dynamically installed with OS running
ECT 362 Operating Systems [email protected]
LSN 10 – Kernel Organization
• Using Linux kernel services
– Kernel ADT
– Kernel software contains no threads of execution or processes
– User programs must link to the kernel code to use it
• Use a hardware trap instruction to keep user code from running in supervisory mode
• Serial execution
– Linux is a single-threaded kernel
– Kernel functions can operate without concern of being interrupted
ECT 362 Operating Systems [email protected]
LSN 10 – Linux Kernel Responsibilities
• Resource abstraction
– Creation of software to simplify the operations that must be
applied to the hardware to cause it to function properly
• Device drivers
– The computer’s components are abstracted into processes
and resources
– Manage allocating and deallocating the system’s resources
to and from the processes as they execute
ECT 362 Operating Systems [email protected]
LSN 10 – Installing Linux
• Distribution
– Complete Linux system
– http://ubuntu.com/
• Kernel Archive
– Linux kernel source code
– http://www.kernel.org/
• Supported Hardware
– http://hardware.redhat.com
ECT 362 Operating Systems [email protected]
LSN 10 – Installing Linux
• Types of installations
– Server
• 300-600 MB
• Does not include the graphical interface
– Standard desktop / workstation
• 600-900 MB
• Includes graphical desktop and common utilities
– Developer’s workstation
• 700-1300 MB
• Adds software development packages
– Complete installation
• 1.3 – 6+ GB
ECT 362 Operating Systems [email protected]
LSN 10 – Installing Linux
• System setup procedure
– Imaging a computer
– Hard drive partitioning
– Device driver verification
•
ECT 362 Operating Systems [email protected]
LSN 10 – Linux System Booting
• Dual boot systems
– Requires a boot manager program to select desired OS to use
• GRUB
• LILO
• Booting procedure
– i386 machines are typically designed to support Microsoft OSs
• Incorporate Basic I/O System (BIOS) in ROM
– OS loaded from boot disk
• Contains Master Boot Record (MBR) at first logical sector
– Details the disks physical layout
– Kernel code is started by boot loader once the OS is placed into main
memory
• Initial process starts the idle process
ECT 362 Operating Systems [email protected]
LSN 10 – Linux VM
• Virtual Machine
– Isolated OS running as an application on a host OS
– Process VM (application virtualization)
– System VM (hardware virtualization)
• Run Linux on a virtual machine on top of another OS
• Oracle VirtualBox VM
ECT 362 Operating Systems [email protected]
LSN 10 – Linux Users
• Linux user accounts
– root
– user
– sudo
ECT 362 Operating Systems [email protected]
LSN 10 – The Linux Desktop
• A graphical display is optional in Linux
• Linux graphic display is based on the X Window System
– X server
• Program that communicates with the video card, keyboard, and mouse
– X client
• Any graphical application
– Window manager
• Special purpose graphical application
– Graphical libraries
• Collection of programming functions that X clients can use to manage the graphical environment elements
ECT 362 Operating Systems [email protected]
LSN 10 – The Linux Desktop
• Desktop interfaces
– Manage icons
– Manage multiple application environments (windows)
– Provide basic user applications
• KDE
– www.kde.org
• GNOME
– www.gnome.org
ECT 362 Operating Systems [email protected]
LSN 10 – The Linux Shell
• Provides an easy interface for user to run programs
and work with files in Linux
• Types of shells
– Bourne shell (sh)
– Bourne Again shell (bash)
– C shell (csh)
– Korn shell (ksh)
– Z shell (zsh)
ECT 362 Operating Systems [email protected]
LSN 10 – The Linux Shell
• Linux Shell Commands (only a few)
– cat – display requested text file
– ps – process status
– ls – show list of files in directory
– pwd – print working directory
– grep – find text within a file
– man – manual, provides in-depth information about
requested command
– cd– change to desired directory
– chmod– change the file/directory permission
ECT 362 Operating Systems [email protected]
LSN 10 – The Linux Shell
– chown – change owner of file/directory
– clear – clear the screen
– cp – copy files
– cmp – compare two files
– finger – get user information
– mount/unmount – mount or unmount a file system
– su – switch user, or become super user if user name is not
given, or change the user ID
– top – to see process information in neat format
– whoami – about yourself
ECT 362 Operating Systems [email protected]
LSN 10 –The Linux Shell
• Shell scripts
– Shortcuts to perform a series of user commands
– Written with plain-text (do not compose in a word
processor)
• Script format
– Requires a ‘shebang’ at the beginning
– ‘#’ is used for comments
– ‘$_” is used to extract command line arguments
– ‘$(command)’ is used to replace self with results from
executing the command in the ()
• Scripts must be made executable to operate
ECT 362 Operating Systems [email protected]
LSN 10 – The Linux Directory Tree
ECT 362 Operating Systems [email protected]
LSN 10 – The Linux File System
• File system descriptors (using ls –l)
– Directories (d)
– Links (l)
• The path
– PATH environment variable
• List of directories in the system where executable files can be found
– Path relativism
• Absolute paths start from the root directory (/)
• Relative paths start from current directory (pwd)
ECT 362 Operating Systems [email protected]
LSN 10 – The Linux File System
• File system table (fstab)
– Lists all disks, disk partitions, and other storage devices for a
given system
– Located in the /etc directory
– Comprised of several fields depicting each storage devices’
setup
Device name | mount point | filesystem type | mount options | …
ECT 362 Operating Systems [email protected]
LSN 10 – /proc
• /proc is a virtual file system containing information
about system resources
• Provides a mechanism for inspecting the kernel state
• Allows the use of read and write system calls to access
the address space of another process
• Appears as a directory within the Linux file system
ECT 362 Operating Systems [email protected]
LSN 10 – Assignment
• Homework – HW 5 – HMWRK5.pdf
• References – Using Linux:
• http://www.linux.org/lessons/beginner/toc.html
– Dalheimer, K. and Welsh, M., Running Linux, O’Reilly, 5th Edition, 2005
• This is a great Linux resource
– Linux shell commands:
• http://www.linuxcommand.org/index.php
– Linux shell scripting:
• http://www.freeos.com/guides/lsst/ch02sec01.html