week seven agenda

48

Upload: pravat

Post on 23-Feb-2016

33 views

Category:

Documents


0 download

DESCRIPTION

Week Seven Agenda. Announcements Link of the week Review week six lab assignment This week’s expected outcomes Next lab assignment Break-out problems Upcoming deadlines Review midterm exam Lab assistance, questions and answers. Link of the week. http://www.kernel.org/ - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Week Seven Agenda
Page 2: Week Seven Agenda

Week Seven Agenda• Announcements• Link of the week• Review week six lab assignment• This week’s expected outcomes• Next lab assignment• Break-out problems• Upcoming deadlines• Review midterm exam• Lab assistance, questions and answers

Page 3: Week Seven Agenda

Link of the weekhttp://www.kernel.org/The Linux Kernel Archives web sitehttp://www.kernelnewbies.org/This web site is a community of people that want to improve or update

their kernels. This site is referenced by experienced developers willing to share their knowledge with newcomers.

Define: Kernel is the central component of most operating systems. The kernel is responsible for managing the system’s resources and the communications between hardware and software.

Legacy terms: nucleus or coreThe kernel connects software applications to the system resource.The Linux kernel is portable to most 32 or 64 bit architectures.

Page 4: Week Seven Agenda

Link of the weekDefine: Kernel space is space allocated specifically for

the kernel. Users are not able to access this area. This area is generally larger than user space. The kernel is never swapped out to disk.

Define: User space is space in memory where all user mode applications execute. Applications executing in this space are subject to being swapped out to disk.

Define: monolithic kernel is where all code is executed in kernel addresses space to increase the performance of the system.

Define: microkernel uses system calls to implement minimal OS services such as memory management, multitasking, and inter process communication.

Page 5: Week Seven Agenda

Link of the weekhttp://vista.intersystems.com/csp/docbook/DocBook.UI.Page.cls?KEY=GCI_unixparms#GCI_unixparms_notes_hpuxCalculating System Parameters for UNIX and LinuxConfigure Unix Kernel Parameters

Swap spaceNumber of global/routine buffersNumber of usersNumber of inodesMaximum database sizeNumber of semaphores

Page 6: Week Seven Agenda

Review week six lab assignment• makefile rule has the following format:

target : prerequisites (dependencies)commands_1commands_2

• Target is typically the name of the file to be generated. A target may also be an action to be performed.

• Prerequisites are files that this target depends on.

• command_n are the SHELL commands necessary to produce the target (one command per line). Each line MUST be prefixed with a horizonal tab ( TAB key). Any other spacing will cause your script to fail.

Page 7: Week Seven Agenda

Review week six lab assignment prog : a.o b.o c.o g++ –o prog a.o b.o c.oa.o : prog.h a.c g++ –c prog.h a.cb.o : prog.h b.c g++ –c prog.h b.cc.o : c.c c.y

g++ –c c.cc.y : c.y

yacc c.ymv y.tab.c c.c

Page 8: Week Seven Agenda

Review week six lab assignment• What is a dependency between source files?

main.cpp employee.cpp address.cppSome source files depend on other source files.

• What are the two parts of a dependency rule? 1) What files a file is dependent on

2) Rule that tells how to recompile the file

• What part of the dependency line is considered the target?

• What is considered the action line in a makefile script?

• We use the –c option on g++ to compile the source files to create object files.

• We use the –o option to create the executable program from the object files.

Page 9: Week Seven Agenda

Review week six lab assignmentLinker combines a number of object and archive files, relocates their data and ties up symbol references. Usually the last step in compiling a program is to run linker.

Link object files into an executable whose name is “myProgram”

g++ -o myProgram a.o b.o c.o.cpp is C++ source code file formatCompile source code main.cppg++ -c main.cpp

Page 10: Week Seven Agenda

Review week six lab assignment• Source(s) code compiler Object Module(s)

linker Load Module loader

• What are the differences between a makefile and a shell script?

• The rules in the makefile are executed based upon dependency, and not sequential order. The “make” utility performs a recursive decent through the target tree building the lowest level targets first.

• A target is rebuilt if any of its prerequisites have a newer time stamp than itself.

Page 11: Week Seven Agenda

Review week six lab assignments

prog

a.o b.o c.o

a.c prog.h b.c c.c

c.y

Page 12: Week Seven Agenda

Review week six lab assignments

myProgram

main.o employee.o address.o

employee.cppemployee.h main.cpp address.haddress.cpp

Page 13: Week Seven Agenda

Review week six lab assignment1. touch everything - everything should buildg++ -c main.cppg++ -c employee.cppg++ -c address.cppg++ -o myProgram main.o employee.o address.o

2. touch nothing - nothing should buildmake: `myProgram' is up to date.

3. touch address.h - main and employee should buildG++ -c main.cppg++ -c employee.cppg++ -o myProgram main.o employee.o address.o

4. touch main.cpp - only main.o should buildg++ -c main.cppg++ -o myProgram main.o employee.o address.o

5. touch employee.cpp - only employee.o should buildg++ -c employee.cppg++ -o myProgram main.o employee.o address.o

6. touch address.cpp - only address.o should buildg++ -c address.cppg++ -o myProgram main.o employee.o address.o

Page 14: Week Seven Agenda

Review week six lab assignmentHelpful Hint for Lab Assignment 6-2

myProgram: < fill in dependencies > g++ -o < fill in dependencies>main.o: < fill in dependencies> g++ -c < fill in dependencies>address.o: < fill in dependencies> g++ -c < fill in dependencies>employee.o: <fill in dependencies> g++ -c <fill in dependencies>

Page 15: Week Seven Agenda

Review week six lab assignment

Software InstallationInstalling through a software package

Package managerAntAnt2

Manualmakemakefileconfigure

Page 16: Week Seven Agenda

Review week six lab assignment

Package Install Instructions

 A package is used by the installer to correctly place all the binary and data files on a system.  An installer records version numbers, file locations and check sums for verification, uninstalls and does version updates.  By using the installer all other packages that a particular application depend on will be installed at the same time. 

Page 17: Week Seven Agenda

Review week six lab assignment

The first thing to do to is "bootstrap" the installer to your system.If you have a 32-bit system (most people do) then download the  Bootstrap installer (x86) file.If you have a 64-bit system (AMD64, not IA64) then download the Bootstrap installer (AMD64) file. If you have a 32-bit or 64-bit Vista system then download the Bootstrap installer (Vista) file.The installer can be run by the Administrator or by a member of the Administrators group.

Page 18: Week Seven Agenda

Review week six lab assignment

Doing an Installation

To install a package use the pkg_update utility.  For example, if you wish to install bash you will enter the following command:

pkg_update -L bash

This command will automatically download and install the most current bash package.  If the package needs to have another package installed with it, that package will be downloaded and installed too.  Pkg_update also takes care of which machine architecture you are using and what is the most current version of the software.

Page 19: Week Seven Agenda

Review week six lab assignmentWhat's Installed, Removing an Installation

To display information about the current software packages installed on a system.

Synopsis: pkg_info [options] [pkg-name]

To remove a software package from a system .  You do not need to know the version to delete a package. 

Synopsis: [kg_delete [options] [pkg-name]

To install a software package on a system.Synopsis: pkg_add [options] [pkg- name]

Page 20: Week Seven Agenda

Review week six lab assignmentAvailable Packages

You can find a list of all of the available packages on the /Tools Warehouse web page: http://www.interopsystems.com/tools/warehouse.aspx. (Requires login.)  This list continues to have new packages added and current packages updated with newer versions.When an updated release of a package is available it is announce it through the /Tools Warehouse Updates Forum.  To install an updated package you give the same command as when you installed it originally. The installer will remove the older version for you before installing the newer version.  Any changes in package dependencies will be handled at the same time.  If you have already installed the most current version of a package the installer notices this and will leave things alone.

Page 21: Week Seven Agenda

Review week six lab assignment

Package Licensing

The licensing terms for each package can be easily viewed from the /Tools Warehouse web page before you decide to download by selecting the src directory.  It is important for you to understand that there are many different licenses used. Our preference is to use Full Open License software such as BSD and MIT.  There are many packages that are GPL or LGPL that may place restrictions on what you may do with a package's utilities and/or libraries. 

Page 22: Week Seven Agenda

Review week six lab assignment• Installation Recommendations

It is recommended that software packages be installed using the following command:

•pkg_update -L {pkg-name}

This command provides to you the most trouble-free installation since so many packages are dependent on other packages.  This command ensures that you get the most current release of a package and avoiding any unnecessary downloads.  Regularly checking for updates is very important for bug and security fixes.  Several times people have reported that they are having a problem with a package that they downloaded 30 to 40 days ago.  During that time the problem has been fixed.

Page 23: Week Seven Agenda

Review week six lab assignment• Checking for updates for all installed packages

is easily done using the command:

pkg_update -La

These installations and updates are done over the Internet and packages are not stored on your system -- this helps the system to keep more free disk space on a local system.

Directory locations: /var/db/pkg/<pkg_name>

Page 24: Week Seven Agenda

Review week six lab assignmentThere are two ways to do an installation. You can choose the type of installation you want based on the type of installation you are going to perform.  For the multiple versions of software and multiple hardware platforms. It is strongly recommend to use the pkg_update for single or multiple packages.  Administrators will want to keep users using pkg_update.

It is always recommended to install a package as:

pkg_update -L {name}

The software version number isn’t needed for this type of installation.  The current version number will be discovered. The most recent/current version number will be used.

Page 25: Week Seven Agenda

Review week six lab assignmentMultiple Software Versions

When a group of packages requires installation, you want to verify that all currently installed packages are up-to-date.  To do an automated check for new packages then pkg_update is the tool for you to use.  You may always refer to the pkg_update manual page for more information.

Page 26: Week Seven Agenda

Review week six lab assignmentMultiple Software Versions

New users usually want to install a group of packages to match their profile.  Currently three profiles exist: user, developer and administrator.  their profiles may be added in the future based on /Tools member feedback . By using a profile, a large number of packages can be selected and installed at one time. You can do the installations easily as:

user: pkg_update -A developer: pkg_update -D administrator: pkg_update -G

Page 27: Week Seven Agenda

Review week six lab assignmentpkg_add Install

Caveat:The pkg_add utility is the "older" tool that should be used with care.  The pkg_add command should be used when a specific package is to be installed (such as an older archived version for comparison).  You may always refer to the pkg_add manual page for more information.

Page 28: Week Seven Agenda

Review week six lab assignmentMultiple Hardware Platforms

Administrators of several machines want to control what software can be installed or updated. Administrators usually like to test and validate software (for a multitude of reasons that we won't cover here) before making this software available to their users.  We understand the needs for this requirement and want to help.

Page 29: Week Seven Agenda

Review week six lab assignmentMultiple Hardware Platforms

This control can be done setting these conditions:

1.  Cache packages have to be validated on a local network drive. 2.  Create your own "list" file in the cache directory with 'tags'. 3.  Set the PKG_LOCATION and PKG_PATH environment variables to this network drive on each system for members of the administrators group. 4.  Have members of the administrators group only use pkg_update for installations and updates.

Page 30: Week Seven Agenda

Review week six lab assignmentProblems, Bugs, Your Suggestions

If you encounter a problem installing a package please check that you are installing the most recent version of the package.  The installer itself receives regular updates too.  So keeping the installer up-to-date will help too. 

The installer can update itself. We recommend that when a new version is announced you update to that version.  You can safely update the installer by doing:

pkg_update -L pkg

If you already have the current version the installer will notice and leave things as they are.

Page 31: Week Seven Agenda

Week seven expected outcomesUpon successful completion of this module, the

student will be able to:• Create make file scripts for software programs. • Use pattern rules in make files. • Create an effective PowerPoint presentation. • Create make files with multiple targets. • Install software packages on a server.

Page 32: Week Seven Agenda

Next lab assignmentDefine: Data structure is where information is

stored/collected in one place. The stored information may or may not be related.

Data structures are unique in their construction so as to deliver a specific usage. Commonly data structures are arrays, hash tables, stacks, and queues.

Page 33: Week Seven Agenda

Next lab assignment• inode ( index node)

Every file is associated with one inode.• An inode is a data structure on UNIX-like

operating system that stores all the information about a file.

• An inode does not store the file name and its actual data.

• UNIX or Linux never stores file creation time.• An inode is a unique number assigned to a file

by the file system.

Page 34: Week Seven Agenda

Next lab assignment• The number of inodes is a kernel tunable

parameter value.• An inode can only hold a fixed number of

direct data block addresses (10 for Linux). Large files use indirect block addresses.

Page 35: Week Seven Agenda

Next lab assignmentThe inode data structure

file mode – file permissions (rwx)count of hard links – how many hard links

point to the inodefile type – executable, block specialowner idgroup idtime of last file access - timestamptime of last file modification - timestampfile size - bytesfile addresses – addresses of the blocks of

storage containing the files data on a HDD

Page 36: Week Seven Agenda

Next lab assignmentLinks can be viewed as entries in a directory that

reference other files.

In UNIX we can create two types of links:Physical (hard) linksSymbolic (soft) links

Page 37: Week Seven Agenda

Next lab assignmentA Physical Link references the exact same file (inode) as

the file entry itself.

A file name in a directory can be viewed as a physical link and is no different than any other physical link. A directory is a list of physical links.

Shell link command:ln test_file_1 test_file_hard_linkls –li (long listing with inodes)ls –i

Page 38: Week Seven Agenda

Next lab assignment

Page 39: Week Seven Agenda

Next lab assignment

Page 40: Week Seven Agenda

Next lab assignmentA Symbolic Link references a “pointer file”

which has its own inodeThe pointer file points to the directory entry that

references the target file (inode)The inode for the symbolic link and the target

are different.

Page 41: Week Seven Agenda

Next lab assignment

Page 42: Week Seven Agenda

Next lab assignment

Inode 300 isn’t concerned about symbolic link 555

The symbolic link isn’t updated even if “your file” is deleted.

Shell link command:ln –s test_file_1 test_file_symbolic_link

Page 43: Week Seven Agenda

Next lab assignmentDefine: tar was originally designed for tape

backups. Tar creates one large file called a heap that contains a collection of many files and directories. A tar file occupies a large amount of space for the files and directories, and a bit more. A tar file is not compressed.

The extension for a tar file is .tar. Create a tar file

tar –cf newpack.tar /export/home/dandrear

Extract the contents from a tar filetar –xvf origpack.tar

List the table of contents tar –tvf origpack.tar

Page 44: Week Seven Agenda

Next lab assignmentDefine: gzip is a utility that compresses a tar file.

The compressed file extension becomes tar.gz.Compress a tar file

gzip filename.tar Decompress a compressed tar file

gzip –d filename.tar.gzgunzip filename.tar.gz

Define: bzip2 / bunzip2 Used to compress and decompress tar files. File extension .bz2.Compress a tar file

bzip2 filename.tarDecompress a compressed bzip2 file

bunzip2 –d filename.tar.bz2

Page 45: Week Seven Agenda

Next lab assignmentDemonstrate the execution of listdir.pl script# Case #1: ./listdir.pl# Explanation: List current directory files in ascending

order.# Case #2: ./listdir.pl –l# Explanation: List current directory files with format File

name, Size, User, and Group column headings.# Case #3: ./listdir.pl -l -d /bin# Explanation: List /bin directory files with formatted column

headings (File name, Size, User, and Group). # Case #4: ./listdir.pl -d /bin# Explanation: List /bin directory files in ascending order.

Page 46: Week Seven Agenda

Break-out problems• inode• System panic • Semaphore• Tunable UNIX Parameters• Kernel space• Call by value• Call by reference• Data structure• Definition of a kernel• User space

Page 47: Week Seven Agenda

Upcoming deadlinesLab Assignment 6-1 is due February 27, 2011Lab Assignment 6-2 is due February 20, 2011Lab Assignment 7-1 (midterm) has to be

completed by February 20, 2011. Midterm exam will be administered from February 14 through 19, 2011.Midterm outline is posted on the Bulletin Board

• Good luck on the midterm exam

Page 48: Week Seven Agenda

Lab assistance, questions and answers

• Questions• Comments• Concerns

• I am available after this Franklin Live session to discuss any problems and/or concerns regarding the lab assignments