In a separate file (use a text editor) cut and paste the commands that you typed (including the prompt) and the complete output of these commands. (show output screenshots also)
Note: The output of the commands should not contain more than six lines.
Please get these 3 files in this assignment which is down below:
A. Standard Directories and Files
Directory: contains the names of files and/or sub-directories. Standard directories contain some special files.
Root Directory (/)
The root directory is the top of the file system. It is the master cabinet that contains all folders and files.
/bin
The binary directory: contains executable files and most Unix commands.
/dev
Device directory.
/etc
Contains commands and files for system administration. Usually a user is not allowed to change these files.
/lib
Contains a collection of related files for a given language in a single file called an archive.
/tmp
Contains temporary files.
/etc/passwd
Contains one line for every user on the system and describes that user.
B. Determine the absolute pathname for your home directory
10. Type:
echo $HOME
11. Type:
Pwd
C. Shell(s) and Shell Environment variables
Shell Environment variables
Bourne, Korn shell C shell
CDPATH cdpath alias names for directories accessed with cd
ENV path along which Unix looks to find config. files
PS1 prompt shell prompt that appears in the command line
PWD cwd name of current directory
HOME home the name of the user’s home directory when the user logs
TERM type of console terminal being used
D. Processes
Check the Unix Handout and go over the section about Processes -section 17.
The action of each shell, the mechanism of how it executes commands and programs, how it handles the command and program I/O and how it is programmed, are affected by the settings of certain environment variables.
Part E
Note: upload first the 3 files in your venus home directory.
child and parent:
- compile the child and parent:
gcc parent.c –o parent
gcc child.c –o child
- run the parent in the current directory (the parent after the fork will call the child)
Don’t worry about warning messages.
./parent
orphan:
- compile and run the orphan:
gcc orphan.c –o orphan
./orphan
Observe and understand the programs’ execution output.
Extensively comment the output of the programs by relating the theory discussed in class, the meaning of the covered commands and the program listings.
Write a program named zombie.c
The main process will create a child.
The child prints something like: “I am the child with pid ….. and my parent has ppid ….”
Next, the child will sleep for 1 second.
Child exits.
The parent will print: I am the parent and my id is… Next, the parent sleeps for 30 seconds. Since the child ends first, and the parent didn’t do wait( ), the child will be for a while in the zombie state. Run the parent in the background, so you can use the top command and identify the zombie, before the parent terminates.
Note: even if the parent terminates, the child is still a zombie. However the the init process reaps the zombies frequently.