174x Filetype PDF File size 1.57 MB Source: isc.ku.edu.kw
Kuwait University College of Life Sciences Department of Information Science Lab Manual ISC 357 Operating Systems and File System Organization LABORATORY PREPARED BY DR. KALIM QURESHI PROF. DR. MOHAMMAD SARFRAZ MARYAM AL-OTAIBI TABLE OF CONTENTS Lab Hardware, Software’s / Tools Requirements ............................................................................................... 6 LAB SYLLABUS for ISC357 ............................................................................................................................................ 7 Operating Systems and File System Organization .............................................................................................. 7 Course catalog ............................................................................................................................................................... 7 Lab Objective ................................................................................................................................................................. 7 Prerequisite .................................................................................................................................................................... 7 Lab Schedule .................................................................................................................................................................. 8 Evaluation Policy ......................................................................................................................................................... 9 Project .............................................................................................................................................................................. 9 Laboratory Policy ........................................................................................................................................................ 9 Laboratory 0: How install UBUNTU 8.10 DESK TOP EDITION ................................................ 10 Laboratory1: Introduction to the UNIX Operating System .......................................................................... 18 What is UNIX? ............................................................................................................................................................. 18 Types of UNIX ............................................................................................................................................................. 18 Unix Major Components ........................................................................................................................................ 18 Files and processes .................................................................................................................................................. 19 The Directory Structure ......................................................................................................................................... 20 Accessing UNIX System .......................................................................................................................................... 21 Connected to UNIX machines remotely via Putty ................................................................... 21 Starting UNIX terminal ...................................................................................................................... 22 Laboratory2, 3, 4: Unix Commands ........................................................................................................................ 24 UNIX Directory Management Commands ....................................................................................................... 25 Printing working directory command - pwd ........................................................................... 25 Changing Directory- cd ..................................................................................................................... 25 List -ls ....................................................................................................................................................... 27 Make a directory-mkdir .................................................................................................................... 28 Remove directory ................................................................................................................................ 29 copy -cp ................................................................................................................................................... 30 Move-mv ................................................................................................................................................. 31 Display file content- cat, more, less, head, tail ......................................................................... 31 Finding a file – find ............................................................................................................................. 32 Searching the Contents of a File .................................................................................................... 33 Determine file type ............................................................................................................................. 34 Entering more than one command .................................................................................................................... 34 Redirecting standard input and output ........................................................................................................... 34 2 | P a g e Access Permissions .................................................................................................................................................. 35 Understanding Access Permissions ............................................................................................. 35 Displaying Access Permissions ...................................................................................................... 35 Default Access Permissions ............................................................................................................. 36 Changing Access Permissions......................................................................................................... 36 Process related commands ................................................................................................................................... 37 What is a Process? ............................................................................................................................... 37 Monitoring processes ........................................................................................................................ 37 Managing Jobs and Processes ......................................................................................................... 39 Placing a foreground process in the background ...................................................................... 39 Miscellaneous Command ....................................................................................................................................... 41 Excersices ..................................................................................................................................................................... 42 Laboratory 5, 6: Shell Programming ..................................................................................................................... 43 Overview of Shell ...................................................................................................................................................... 43 User defined variables ............................................................................................................................................ 44 Reading Values into User-defined Variables (Reading user input) ................................. 44 Command Substitution ..................................................................................................................... 45 Computation on Shell Variables .................................................................................................... 45 Pre-defined shell variables ................................................................................................................................... 46 Passing arguments to the shell ...................................................................................................... 47 Shift command .......................................................................................................................... 47 Conditional Execution Operators ....................................................................................................................... 49 Conditional statements .......................................................................................................................................... 49 The if statement ................................................................................................................................... 50 Nested if statement .................................................................................................................. 50 test Command ........................................................................................................................... 50 The case statement ............................................................................................................................. 53 Flow of control statements ................................................................................................................................... 55 The for statement ................................................................................................................................ 55 The while and until statements ..................................................................................................... 56 The break and continue statements ............................................................................................. 56 Excersices ..................................................................................................................................................................... 59 Laboratory7: UNIX and Advance topics in C Programming ......................................................................... 60 A Simple C Program ................................................................................................................................................. 60 Compile and Execute a C program under Unix System ............................................................................. 60 UNIX Library Functions .......................................................................................................................................... 61 3 | P a g e C Functions .................................................................................................................................................................. 62 Command line arguments in C ............................................................................................................................ 63 Running UNIX Commands From C ..................................................................................................................... 64 laboratory8: Major File Structure Related System Calls ............................................................................... 65 What is a System Call? ............................................................................................................................................ 65 Use of System Calls ................................................................................................................................................... 65 creat( ) System Call .................................................................................................................................................. 67 close( ) System call ................................................................................................................................................... 70 read() write()System calls .................................................................................................................................... 70 lseek() system call .................................................................................................................................................... 71 Excersices ..................................................................................................................................................................... 73 laboratory9, 10: Process Creation and Execution ............................................................................................ 74 The death of a parent or child process ............................................................................................................. 77 Parent process dies before child process .................................................................................. 77 Child process dies before parent process .................................................................................. 78 Excersices ..................................................................................................................................................................... 79 Laboratory11: Inter-Process Communication: Pipes & Signals ................................................................. 83 Pipes ............................................................................................................................................................................... 83 pipe System Call ................................................................................................................................... 83 I/O with a pipe .......................................................................................................................... 84 Signals ............................................................................................................................................................................ 90 SIGHUP .................................................................................................................................................... 91 SIGINT ...................................................................................................................................................... 91 SIGTSTP ................................................................................................................................................... 91 SIGQUIT ................................................................................................................................................... 91 SIGILL ....................................................................................................................................................... 92 SIGTRAP .................................................................................................................................................. 92 SIGIOT ...................................................................................................................................................... 92 SIGEMT .................................................................................................................................................... 92 SIGFPE ..................................................................................................................................................... 92 SIGKILL .................................................................................................................................................... 92 SIGBUS ..................................................................................................................................................... 92 SIGSEGV................................................................................................................................................... 92 SIGPIPE .................................................................................................................................................... 92 SIGALARM .............................................................................................................................................. 93 SIGTERM ................................................................................................................................................. 93 4 | P a g e
no reviews yet
Please Login to review.