CS215
Assignment #4 (First Programming Project, continued)
DUE: Thursday, 10/16/2014
Modify your shell (as developed in Assignment 2) in the following ways (appropriately modified if you are going the POSIX rather than the Java route):
- Implement the "main method" as a thread. That is, the new main method will create a "shell thread" that will do the work that your previous main method was doing.
- Wrap your external processes in threads as well. That is, a command should
be executed by creating a thread for the command, and that thread is the one that will use ProcessBuilder to carry out the external command. This will of course require
creating a different class for the command thread.
- Allow processes to run in the background, as they do in a "real" shell. Thus, for example, if you type,
xterm &
this should cause a terminal to run outside of the terminal in which you're working, and allow you to continue to interact with the shell.
- Ensure that the exit command terminates all threads (and, emphatically, external processes!) that are running, including those in the background. This is a little trickier than it may at first appear, and may require some snooping around in the Process and ProcessBuilder APIs. (It is also not standard behavior, but do it anyway!)
This does not call for much in the way of new features (outside of the background "process" feature). Rather, the main task is
to change the internal structure of the shell code so that it is multithreaded.
Back to CS215 Home Page