Starting from:

$20

CSE4100-Project 1 Solved

Overview

In this project, the students will learn and become familiar with the concepts of system-level process control, process signalling, interprocess communication and running processes and jobs in the background in Linux Shell. Students will learn this by programming a simple yet customized Linux shell that supports all the aforementioned functionalities in their own programmed shell.

Linux Shell:

A shell is an interactive command-line terminal program whose primary purpose is to execute user-provided commands and run other programs. A shell repeatedly prints a prompt, waits for a command line on the terminal via stdin, and then performs action as directed by the contents of the command line.

Project Pre-requisites

Familiarity with c/c++ programming and Linux shell commands.

This project consists of three incremental phases, where each phase is must pre-requisite for the next phase, i.e., You will be extending the functionality of your shell in every project phase.

Project Phase I: Building and Testing Your Shell                              

 Task Specifications:

Your first task is to write a simple shell and starting processes is the main function of linux shells. So, writing a shell means that you need to know exactly what is going on with processes and how they start.

Your shell should be able to execute the basic internal shell commands such as,

-          cd,cd..: tonavigatethedirectoriesinyourshell

-          ls: listing the directory contents

-          mkdir, rmdir: create and remove directory using your shell

-          touch, cat, echo: creating, reading and printing the contents of a file

-          exit: exit all the child processes and shell quits

A command is always executed by the child process created via forking by the parent process except cd.

 
 Hints:

The shell mainly relies on fork( ) and exec( ) system calls. These two system calls are actually the building blocks for how most programs are executed on Linux. First, an existing process forks itself into two separate ones. Then, the child uses exec( ) to replace itself with a new program.

Your shell is constantly running loop with three functionalities inside;

do {

Shell Prompt: print your prompt printf (“CSE4100:P4-myshell >”);

Reading: Read the command from standard input. input = myshell_readinput ();

Parsing: transform the input string into command line arguments args = myshell_parseinput (input);

Execute: Execute the command by forking a child process and return to parent process myshell_execute(args);

} while{true};

 Note: Please consult the man pages for the fork(), exec(), wait() and other related system calls.

More products