20191202045751p3_documentation_2_.pdf - CS 367 Project#3 Fall 2019 Shell Due Friday December 4th 6th 2019 11:59pm This is to be an individual effort No

20191202045751p3_documentation_2_.pdf - CS 367 Project#3...

This preview shows page 1 - 3 out of 12 pages.

1 CS 367 Project #3 - Fall 2019: Shell Due: Friday, December4th6th, 2019 11:59pm This is to be an individual effort. No partners. No late work allowed after 48 hours; each day late automatically uses up one of your tokens. 1. Introduction For this assignment, you are going to use C to implement a simple shell program called GMSH (GMU Shell). Once running, GMSH would be able to accept/execute commands from user and perform basic job management. This assignment will help you to get familiar with the principles of process management and job control in a Unix-like operating system. Our lectures on processes, signals, and Unix-IO as well as Textbook Ch8 (in particular 8.4 and 8.5) and 10.3 will provide good references to this project. 2. Project Overview A typical shell program receives line-by-line command input by the user from a terminal. The shell would support a set of built-in commands which will be executed directly by the shell. If the user input is not a built-in command, however, the shell will interpret the input as the name of a program to be executed, along with arguments to be passed to it. In that case, the shell will fork a new child process and execute the program in the context of the child. A shell program typically also provides job control. Normally, a user command (built-in or not) is executed as a foreground job, which means the shell will wait for the command to complete before reading the next command. But if the user command ends with an ampersand ‘&’, the command will be started in the background and the shell will return to the prompt immediately to accept the next command. Some built-in commands are usually provided by the shell for the user to view the list of background jobs or to switch a job between background and foreground. For this assignment, your shell implementation should be able to perform the following: Accept a single line of command from user; Execute a built-in command (detailed list of supported commands below); Load and run the user specified program with the provided arguments; Perform basic job control; Support basic file redirection. We will describe each of them in more details with some examples below. 2.0 Use of the Logging Functions In order to keep the output format consistent, you must call provided logging functions at the appropriate times to generate the right output from your shell program. The generated output will also be used for grading. The files logging.cand logging.hprovide the functions for you to call. Most of the log functions require you to provide a process ID (pid) and the relevant
Background image
2 command line (cmd) to make the call. We will explain more details and specify how to use them below. 2.1 Parsing User Commands Once start, the shell would print a prompt and wait for the user to input commands. Each line from the user is considered as a command. Logging Requirements:You must call log_prompt()to print out the prompt.
Background image
Image of page 3

You've reached the end of your free preview.

Want to read all 12 pages?

  • Fall '19
  • oyuga

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors