




















| |
Lab 13
(Chapter 13)
Learning Objectives
- To learn
about attributes of UNIX processes
- To learn
about foreground and background UNIX processes, including daemons
- To learn
about sequential and parallel execution of UNIX commands
- To learn
about suspending and terminating processes
- To learn
about UNIX signals
- To learn
about the UNIX process hierarchy on your system
Lab Work
- Log on to your UNIX system.
- How many
processes are running on your system when you log on? What are the process IDs
of the following processes and daemons: init, sched, cron, inetd. Show the
session that you used to get the required information.
- Who are
the parents of the sched, init, cron, and inetd processes? What are the
process IDs of the parent processes? What are the priority numbers of sched,
init, cron, and inetd? List these processes according to their priorities,
with the highest priority process first. Show your session.
- How many
HTTP server processes are running on your system? What are their process IDs?
Use one command each for obtaining the above information. Show your session.
- How many
sh, bash, csh, and tcsh processes are running on your system? Show your
session.
- Monitor
the CPU activity of your UNIX machine by using the
top command. What
kind of information does top
display periodically and how often does it display this information? How many
processes are running on your system at this time and how many of them are
sleeping? Display information about all the processes belonging to a user on
your system who is currently logged on? What are the priority numbers of these
processes?
- Run the
sessions shown in Section 13.6.1 on your system to practice foreground and
background process creation, process suspension (with
<Ctrl-Z>), switching
processes from the foreground to the background (with the
bg command) and vice
versa (with the fg
command). Use the jobs
command to display job IDs of the active and suspended processes.
- Run a
command that would remind you to leave for lunch after one hour by displaying
the message “Time for Lunch!”. Show your command.
- Give a
command line for running the
find and sort command in parallel. The
find command should
display the pathname of the foobar file in your home directory and the
sort command should
sort data in smallFile (used in Chapter 10) by using GPA as the sort key.
Ignore the leading white spaces between fields. For both
find and
sort, redirect errors
to /dev/null. Output of the
find command should go to find.out and that of the
sort command should be redirected to the
sort.out file. When the command line terminates, display the contents of
find.out and sort.out. Show your session.
- Give one
command each for terminating a process with ID 12345 and a job with ID 2.
- Execute
command groups date
and uname –a and
who and
ps in parallel. Show your session.
- You have
a find command
executing in the background looking for a file with inode number 123456 in the
system. Right after executing the command, you realize that you actually
wanted to look for a file with this inode number in your home directory and
not in the whole system. How would you terminate this command? Show your work.
- Display
the process hierarchy for your processes. Show your work.
- Log out.
|