SmallShell:smash - PowerPoint PPT Presentation

1 / 5
About This Presentation
Title:

SmallShell:smash

Description:

Kill or suspend programs running in foreground mode using signals. ... In this mode smash' does not return the prompt until the executable file that ... – PowerPoint PPT presentation

Number of Views:21
Avg rating:3.0/5.0
Slides: 6
Provided by: ziv3
Category:
Tags: smallshell | mode | smash

less

Transcript and Presenter's Notes

Title: SmallShell:smash


1
Small-Shellsmash
  • Your assignment is to build a program smash'
    that will implement the following shell services
  • Run programs in foreground and background
  • List all processes that currently run in the
    background.
  • Kill a process running in the background.
  • Kill or suspend programs running in foreground
    mode using signals.
  • Move programs that run in foreground mode to
    background mode and vice versa.

2
There are two types of commands that
smashshould understand
  • External commands the command name is the name
    of an executable file.
  • Internal commands commands that are "built-in"
    in the smash' shell.

3
Execution mode for external commands
  • Foreground a command is given in the following
    form smashgtgt ltcommand_namegt
    ltlist_of_parametersgt. In this mode smash' does
    not return the prompt until the executable file
    that corresponds to the command finishes or it is
    interrupted by a signal.
  • Background a command is given in the same format
    as in the foreground mode, but the last parameter
    in the parameter list should be '. The can
    be attached to the last parameter.

4
List of Internal commands you are required to
implement
  • bye terminate smash'. All background processes
    should be terminated. (Note that the real shell
    does not do this).
  • jobs list of all background jobs in the
    following format ltpidgt ltcommand namegt, in the
    order they entered the background list.
  • S_jobs list of all suspended jobs in the
    following format ltpidgt ltcommand namegt, in the
    order they entered the suspended processes list.
  • kill terminate the process corresponding to the
    specified pid by sending SIGTERM signal.
  • bg passes a suspended process to run in
    back-ground mode. Incase their is no suspended
    process, a compatible message should be
    displayed.
  • fg passes the most recent process running in
    back-ground mode to run in fore-ground mode.
    Incase their is no process running in back-ground
    mode, a compatible message should be displayed.

5
Signal Catching
  • Implementation of the CTRL-C signal sending
    operation
  • smash does not terminate after a CTRL-C
    operation.
  • Back-ground running process (child) is not
    affected by a CTRL-C operation.
  • A fore-ground running process terminates after a
    CTRL-C operation (like in the Unix).
  • Implementation of the CTRL-Z signal sending
    operation
  • Back-ground running process (child) is not
    affected by a CTRL-Z operation.
  • A fore-ground running process is suspended and
    enters the suspended processes list.
  • kill  system call
  • Terminate processes in running in the
    back-ground corresponding to the specified pid.
  • Uses SIGTERM signal that is caught by the
    process.
Write a Comment
User Comments (0)
About PowerShow.com