Homework #1

 

CSC 4420

Spring/Summer 2000

Up

Homework #1 – Process management

due date Wednesday, June 14, 2000 at 7:45 p.m.

Description:

Create a simple shell application. The shell will display a prompt and wait for user to enter a command. If the command has '&' as the last character on the command-line the command will be executed in parallel with the command shell, i.e., the shell prompt will be displayed immediately without waiting for termination of the command. Otherwise, the shell will wait until competetion of the command and  then the prompt will be displayed. Write another program which computes the factorial of a natural number which is passed as a command-line parameter to the program. Test that your shell application can run this command as well as other standard UNIX commands.

 

You will need some of the following system calls:

fork - creation of a new process

getpid - get process id

exec, execve, execvp - execute new program

wait - wait on child termination

exit - process termination

Files can be accessed through C++ streams.

Details on system calls can be found in the man pages.

 

Development:

The program can be written in either C or C++. Although the platform for development can be one of your choice, the program must be portable (i.e. platform independent) and its final version must run correctly on the server of the computer science department where the grading will be performed (mercury.cs.wayne.edu).

 

Compilation:

g++ <source file name> -o <executable name>

 

Submission:

  1. The shell program source code.
  2. The factorial program source code.
  3. A written description of the program and its behavior.

Your programs must contain comments. All programs (in source code) and the report should be mailed from your UNIX account to besta@cs.wayne.edu. A carbon copy of the mail has to be sent to the TA's address hcmo@cs.wayne.edu, too. Moreover, the report which describes the implementation and its behavior will be collected (in paper) during the lecture.


For problems or questions regarding this web contact besta@cs.wayne.edu.
Last updated: July 05, 2000.