Posted: February 12th, 2022

The xv6 shell has “$” and the delenn shell has “[username@delenn] $” or similar.

Place your order now for a similar assignment and have exceptional work written by our team of experts, At affordable rates

For This or a Similar Paper Click To Order Now

Learning Goal:

I’m working on a operating systems exercise and need support to help me learn.

Read chapters 4 and 5 in the OSTEP book.

Write a simple shell, which is a program that waits for you to type a command, and once you type it, runs that command (that program).

Your shell should have a “prompt”, which is a symbol or message that indicates it’s ready to receive commands.

The xv6 shell has “$” and the delenn shell has “[username@delenn] $” or similar.

Choose your own prompt.

Make sure your shell can run programs with or without arguments, like “ls” or “cat README” and so on.

Print an error message if the command the user types cannot be executed.Shells also often have some builtin commands that are not programs (they don’t cause a fork/exec). Support the following builtin commands:help – shows a simple message about how to use your shell
pid – shows the shell’s process id
cd – changes shell’s current directory
pwd – shows the shell’s current directory
Avoid all zombies.Turn in your .c file. You can name it whatever you want.Hints:When creating argv (probably with strsplit), make sure you add another slot at the end that you fill with a 0 (null). This is what exec() expects.
To support “cd” (change directory), first, don’t do a fork/exec since cd needs to change the directory of the shell process; instead, run the function chdir(new_dir_name) which is defined by xv6. This will change the directory the shell is running in, so if the shell tries to open/save files, run programs, etc., it will look in this “current working directory” to do so.
Outline of code:Start a loop (we are going to loop forever so users can type commands over and over again).Get the input
Check some cases that handled inside the shell (no forking, “built-in” commands):change directory
print directory
help
get process id
Otherwise (not “built-in” command):Split the command into argv array
Fork
Child runs exec
Parent waits
Requirements: full requirements

For This or a Similar Paper Click To Order Now

Expert paper writers are just a few clicks away

Place an order in 3 easy steps. Takes less than 5 mins.

Calculate the price of your order

You will get a personal manager and a discount.
We'll send you the first draft for approval by at
Total price:
$0.00