1 / 45

Week Six Agenda

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

kisha
Download Presentation

Week Six Agenda

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. Week Six Agenda • Announcements • Link of the week • Review week four lab assignment • This week’s expected outcomes • Next lab assignment • Review midterm exam • Break-out problems • Upcoming deadlines • Lab assistance, questions and answers

  2. Link of the week http://www.cert.org/homeusers/HomeComputerSecurity/ This Wed site provides useful information on how to secure your home computer, things you ought to know, and what should be done to secure a home computer. http://www.thefreecountry.com/perlscripts/index.shtml Free Perl and CGI scripts Perl is dual licensed under both the ArtisticLicense and the GNU General Public Licenses. Distributions are available for most operating systems.

  3. Link of the week Why do we love Perl? The Perl Programming Language currently has 21,000 Comprehensive Perl Archive (CPAN) modules. The CPAN has over 18,000 open source modules available for download. Perl is a highly capable, feature-rich programming language with over 23 years of development. Parts of the Perl language are still actively being pursued. Perl has over 300 local community groups. Perl 6 is a sister language, part of the Perl family.

  4. Link of the week • Definition: Trusted System is one that is replied upon to a specific extent to enforce a specific security policy. • Definition: Trusted Computing means that a computer will consistently behave in specific ways, and those behaviors will be enforced by hardware and software. • Where are trusted systems utilized? Homeland security, law enforcement, and social control

  5. Review week five lab assignment test_build.sh This script is used to execute the make command which in turn will call the makefile. test_build.sh -> make -> makefile

  6. Review week five lab assignment

  7. Review week five lab assignment Define make command: The make utility is a software engineering tool for managing and maintaining computer programs. Make provides most help when the program consists of many component files. As the number of files increase in a project, so to does the compile time, complexity of compilation. The likelihood of an error occurring with human(s) manageability is high.

  8. Review week five lab assignment Define the makefile: Make goes through the makefile (descriptor) file first starting with the target it is going to create. Make looks at each of the target’s dependencies to see if they are listed as targets. It follows the chain of dependencies until it reaches the end of the chain and then begins backing out and executing the commands found in each target's rule. Actually every file in the chain may not need to be compiled. Make looks at the time stamp for each file in the chain and compiles from the point that is required to bring every file in the chain up to date. If any file is missing it is updated if possible.

  9. Review week five lab assignment Makefile Components • Comments within a makefile (#) • makefile continuation lines (\) • Rule tells make both when and how to make a file • Dependency Line is a line with a colon (:) test_build.sh contains the make command which calls the makefile. The test_build.sh script is located in the /tmp directory. • Demonstrate makefile script under ~dandrear/temp (cs.franklin.edu)

  10. Review week five lab assignment Key Points about the makefile • Makefile recompiles all source files for an entire project. • Makefile recompiles only those files that have different time stamps. • Bottom up control flow. • Rules are shell commands.

  11. Review week five lab assignment Key Points about the makefile The file names used in this example have been abbreviated for simplicity. C++ compilations end in .cpp suffix. The .c suffix extension causes the C compiler to be invoked. The .o suffix represents a object file. The .h suffix represents a header file. The g++ is a compiler, and not a preprocessor. The G++ builds object code from your C++ program source. The –c option, compiles source to object code. The –o option, compiles object code.

  12. Review week five lab assignment Other software products that perform similar bundling operations - ANT developed by Apache Jakarta - ANT2 supplied from the Free Software Foundation which is part of Red Hat. What is a dependency between source files? main.cpp  employee.cpp  address.cpp 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 are the differences between a makefile and a shell script? The rules in a makefile are executed based on dependency, and not sequential order. Scripts execute in sequential order.

  13. Review week five lab assignment Target : Dependencies (prerequisites) <tab> Rule prog: a.o b.o c.o g++ -o a.o b.o c.o a.o: prog.h a.c g++ –c prog.h a.c b.o: prog.h b.c g++ –c prog.h b.c c.o: c.c g++ –c c.c c.c: c.y g++ -c c.y mv y_table.c c.y

  14. Review week five lab assignment

  15. Review week five lab assignment

  16. Review week five lab assignment Key Points About Perl • Dynamic typing • Dynamic allocation of memory for arrays and hash tables • Both procedural and object oriented programming capabilities • Rich third party software and use of modules

  17. Review week five lab assignment • Regular expression (a.k.a. regex or regexp) Is a pattern that describes a certain amount of text. A basic regular expression could be the single character, e.g.: a Alice is a women. It will match the first occurrence in the string. If succeeding matches are desired, the regex engine must be instructed to do so.

  18. Review week five lab assignment Regular Expression Special Characters * Open square bracket [ * Backslash \ * Caret ^ * Dollar sign $ * Dot . Pipe symbol | Question mark ? Asterisk * * Plus sign + Opening and closing round brackets ( )

  19. Review week five lab assignment Awk Script # Author: Bob D'Andrea # Script name: awksrc.sh # Command line awk -f awksrc.sh test.txt # Command line: awk -f awksrc.sh /^$/ { print "This is a blank line." } /[0-9]+/ { print "That is an integer." } /[A-Za-z]+/ { print "This is a string." }

  20. Review week five lab assignment • Perl Hash table is an unordered set of scalars, accessed by some string value that is associated with each scalar. Keys are 12, 19, and 30. Values are gray, black, and red. %colormap=( “12” => “gray”, “19” => “black”, “30” => “red”,); %colormap = (“12”, “gray”, “19”, “black”, “30”, “red”); %members = (John => "father", Paul => "son", Marie => "daughter");

  21. Review week five lab assignment names File Content Bob D'Andrea 222-40-1234 03/19/1947 male Bo Happy 444-20-2222 01/01/1945 male Jane Smith 324-78-9990 04/23/1978 female Razi Jake 564-54-9879 05/26/2005 male The file named “names” contains the above information. There are tabs in two places in the above data. One tab is after the name and after the birth date.

  22. Review week five lab assignment Without options, print the desired fields in any order. awk ‘{ print $1, $2, $3, $4, $5 }’ names The –F option changes the field separator on the command line. The \t is an Escape Sequence for a horizontal tab. awk –F”\t” ‘{ print $1 }’ names

  23. Review week five lab assignment Keys & Values %colormap = (“12”, “gray”, “19”, “black”, “30”, “red”); @codes = keys %colormap; # codes array contains just codes @colors = values %colormap; # colors array contains the colors # Printing the values out of a hash table (hash_prt.pl) while (($key, $value) = each(%colormap)) { print $key, “, “, $value, “\n"; } Executing the loop prints: 30, red 19, black 12, grey

  24. Review week five lab assignment Define Comma – arrow: The comma-arrow (=>) operator is used to initialize the %members hash variable in the previous slide lines of code. The left side of the comma-arrow operator is expected to be a simple string and therefore it is not necessary to be quoted.

  25. Review week five lab assignment

  26. Week six expected outcomes Upon successful completion of this module, the student will be able to: • Create makefile 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.

  27. Next lab assignment Installing software under UNIX is not always straightforward and easy. System administrators must be familiar with the layout of the file system. During a software installation, the possibility exists that the system could panic and/or have a hard disk failure.

  28. Next lab assignment Installation Software Package Methods Package manager - What are the tasks of a package manager? - The version of UNIX dictates which package manager will be used. - Many Linux versions utilize the Debian Package Manager. Manual - The utilization of makefiles or shell scripts to automate the install as much as possible. - On occasion, the installation of software is done by sending the source code to the site. - What steps are required to install a new software version? - How is a “configure” script utilized?

  29. Next lab assignment Installation Software Package Methods Package manager - Linux uses yum and rpm as there package manager. - Software has to be set or identified to use rpm. Otherwise, the software is configured manually.

  30. Next Lab Assignment shell Assembler Kernel Firmware Hardware

  31. Next Lab Assignment PID (Process ID) When you execute a program on your UNIX system, the system creates a special environment for that program. This environment contains everything needed for the system to run the program as if no other program were running on the system. Whenever you issue a command in UNIX, it creates, or starts, a new process. When you tried out the ls command to list directory contents, you started a process. A process, in simple terms, is an instance of a running program.

  32. Next Lab Assignment PID (Process ID) The operating system tracks processes through a five digit ID number known as the pid or process ID . Each process in the system has a unique pid. Pids eventually repeat because all the possible numbers are used up and the next pid rolls or starts over. At any one time, no two processes with the same pid exist in the system because it is the pid that UNIX uses to track each process.

  33. Next Lab Assignment Foreground Processes By default, every process that you start runs in the foreground. It gets its input from the keyboard and sends its output to the screen. You can see this happen with the ls command. If I want to list all the files in my current directory, I can use the following command:

  34. Next Lab Assignment PID (Process ID) A background process runs without being connected to your keyboard. If the background process requires any keyboard input, it waits. The advantage of running a process in the background is that you can run other commands; you do not have to wait until it completes to start another! The simplest way to start a background process is to add an ampersand ( &) at the end of the command.

  35. Next Lab Assignment ColumnDescription Output from ps –f command UID User ID that this process belongs to (the person running it). PID Process ID. PPID Parent process ID (the ID of the process that started it). C CPU utilization of process. STIME Process start time. TTY Terminal type associated with the process TIME CPU time taken by the process. CMD The command that started this process.

  36. Next Lab Assignment Options which can be used with ps command -a Shows information about all users -x Shows information about processes without terminals. -u Shows additional information like -f option. -e Display extended information.

  37. Next Lab Assignment Signals Signals are a form of process communication. Because they can come from another process, the kernel or the process itself, they might be better thought of as events that occur as a program runs. A crude example might be the bell most of us remember from our early days in school; when the bell rang, we reacted by switching from playful children to industrious students.

  38. Next Lab Assignment Signals The kill –l command will display the signals available on your system. HUP USR1 BUS INT SEGVFPE QUIT USR2 KILL ILL PIPE TRAP ALRM IOT TERM

  39. Next Lab Assignment Signals For each signal there is a default action, almost all of which terminate the process. For most signals, a program may specify another action—this is called catching or handling the signal—or may specify that no action occurs, which is called ignoring the signal. The signal SIGKILL cannot be caught or ignored; it always terminates a process.

  40. Next Lab Assignment kill Command Used to send a signal to another process. The kill command is used on Linux and other UNIX-like operating systems to terminate processes without having to log out or reboot (i.e., restart) the computer. Format: kill [signal or option] PID(s) kill -l kill –l TERM kill –l KILL

  41. Next Lab Assignment kill Command To determine the PID of any process belonging to you, enter the ps command at the prompt. The ps command will print, for each of your processes, a line containing the process's PID, the amount of time the process has used and the command with which the process was started

  42. Break-out problems • touch command • Top command • dot command notation (located where?) • dot dotcommand notation (located where?) • What function does the makefile provide a project? • What are the two parts of a dependency rule? • What language is used for writing makefile rules? • What two methods are used for installing software packages? • What is a regular expression • American National Standard Institute (ANSI)

  43. Upcoming deadlines Lab Assignment 5-1 is due October 27, 2013 Lab Assignment 6-1 is dueNovember 3, 2013 Lab Assignment 7-1 (midterm) has to be completed by October 21 through 26, 2013. Check with your proctor for his or her testing schedule.

  44. Questions and answers • Questions • Comments • Concerns • Are there questions regarding the mid-term outline? • After class I will help students with their scripts.

More Related