Lab #1 Solution Part A 1.2 Help 1) manual 2) file descriptor fcntl manipulates the file descriptor by applying the cmd parameter to the fd parameter. 3) display files for reading less is similar to more except for backwards movement through the file as well as forward movement and it doesn't require a completely loaded file in order to view. 1.3 Shell Basics 1) /bin/bash 2) tcsh or sh 3) -all or -a 4) The new shell runs on top of the old bash shell. 5) gnome-terminal starts bash (init -- >gnome -- >terminal -- > bash) Or xterm (xterm -- >bash -- > pstree) 1.5 Permissions 1) root 2) staff 3) No 1.6 Environment ¨C ¡°export¡± allows the second bash process to see the environment variable - allow newly created variable available in child shell (ok) - set global variable (ok) - make variable available to all forked process environment (ok) - assign value of ¡°Hi¡± to Hello (this answer is not complete) 1.7 Dynamic Libraries 1) libncurses.so.5, libdl.so.2, libc.so.6, /lib/ld-linux.so.2 2) local-archive, libnss_compat, libnsl, libnss_nis, libnss_files 1.8 X 1) xterm is an X application, do not depend on either. 2) metacity is a gnome application Part B 2.1 Processes 1) fork creates a child process of the current process and exec replaces the current shell with the specified command without creating a new process. 2) A zombie process is a process which has finished running but has not had its return value read by the person who started it yet. A zombie process is the remains of a child process that has finished and the parent did not wait for the death of the process. It remains there until either the parent dies or until init kills it. 3) int main() { if( fork() == 0 ) { return 0; } else { sleep( 1 ); } } 4) int main() { if( fork() == 0 ) { return 0; } else { wait( NULL ); sleep( 1 ); } } 2.2 Permissions 1) read, write, execute 2) can change into the directory 3) Read: Allows files or folders to be opened as read-only and to be copied. Write: Allows the creation of files and folders; allows data to be added to or removed from files. List Folder Contents: As per Read but also allows navigation of sub-folders. Read and Execute: As per Read but also allows users to run executable files. Modify: All the above as well as the permission to delete the file or folder. Full Control: Full Control -- including the ability to change ACLs. 4) modify allows you to delete the file or folder while write only allows data to be added or removed from the file. 5) sticky bit 6) Yes. File 1 (G1-R) File 2 (G2-R) File 3 (G1-R, G2-W) 2.3 Dynamic Libraries 1) Different Versions of the DLL No standard location for the DLL No standard naming schema Hard to determine when no application is installed which uses the DLL uninstallation may remove other¡¯s dll without notice Some problems that can occur with DLL sharing include overwriting an existing DLL with a version used for something else. This can usually cause incompatability issues which cause programs to stop working. 2.4 Environment 1) PATH dictates where to look for executable programs or specifies the command search path 2) DISPLAY environment variable 2.5 X 1) shoule use same operating system under all the applications and remove network 2) common communication protocol between X server and X libraries 3) one point each for the following elements in the diagram: * A seporation between kernel and user mode * A DLL in user mode (ideally this would be a graphics dll like GDI, but any will do). * A display driver in the kernel. * A window/session manager in user mode. * A reference to where they got the diagram.