The objective of this assignment is to support a simple form of background processes.

computer science

Description

The objective of this assignment is to support a simple form of background processes. The following page can help you understand what background processes are. After reading through this resource, it is highly recommended that you play around with background processes on a UNIX console. 


What you need to know - Running background processes, Listing background processes.


Your task is to allow the end user to run and list the background commands, and to kill any one of the running background commands. You do not have to provide functionality that allows to suspend a command, or to bring a command from background to foreground. Whenever an end user types the “&” ampersand at the end of a command the REPL loop does not wait for the entire command to complete but it directly prints out the “>” prompt to accept new command while the previous ones might still be running. This allows your Unix-ish system to execute commands in parallel. This is useful in cases where you have to execute long running commands and you don’t want to wait for the previous commands to finish in order to start the new ones. For example, suppose you have a big file of Amazon reviews and you would like to create a file with the reviews that contain the phrase “amazing product” and a second file with the reviews that contain the phrase “bad product”. You can accomplish that by executing the following commands:


You know that these two commands will take a while to run and so you can have them running in the background while you are still able to execute other commands. Furthermore, the user should be able to monitor what commands are still running. This could help to avoid exiting the Unix-ish system while there are still commands running. To do this you need to create a new command “repl_jobs” which checks which of the background processes are still alive and prints a list of the alive processes. For example:


Related Questions in computer science category