Name: Basil Yusuf
Course: Operating Systems (CIS*3110)
Date: 6th February, 2021
Version: 1.0
In this assignment you are to implement a simple UNIX shell program. A shell is simply a program that conveniently allows you to run other programs. Read up on the bash shell to see what it does.
Your shell must support the functions described below. The functions are grouped into 3 sets. You may develop the functions in any order, but they are grouped in order of difficulty. It would be prudent to get the simpler functions working first. With each function there are some suggestions for POSIX system calls that may help with the construction of the function. These suggestions are not exhaustive, nor do you necessarily need to use them. They are there to stimulate your thinking.
- We are assuming that the default path is /bin/
- There's an assumption that & will always be at the end
- history command does not work with > or <
- After being in the correct directory with the "makefile" and "myShell.c".
- Type the command "make"
- And then, type "./myShell"
- You have to press enter once to set the Profile file
The application provided here is robust. To test its functionality, the following test cases can be used.
- SET 1 - Ensuring that Set 1 Functionality works properly. Test: Performing a trial run
Test
- For
exit()
type exit in the shell.
Result:
- The exit command will kill all the processes and exit.
Test
- For
no arguments like ls
typels
and press enter.
Result:
- The command uses execv and should display the list of elements.
Test
- For
commands with arguments
typels -l
and press enter.
Result:
- The command uses execv and should display the list of elements with the L Flag.
Test
- For
Background Processes
typesleep 5 &
and press enter.
Result:
- The command uses waitpid and executes the process in the background.
- SET 2 - Ensuring that Set 2 Functionality works properly. Test: Performing a trial run
Test
- For
Output redirection
typels -lt > foo.txt
and press enter.
Result:
- The command uses freopen to write the output to a file.
Test
- For
Input redirection
typesort < foo.txt
and press enter.
Result:
- The command uses freopen to read from a file.
Test
- For
Piping
typels -lt | wc
and press enter.
Result:
- The command uses pipe(), dup2() to make the pipe functionality work.
- SET 3 - Ensuring that Set 3 Functionality works properly. Test: Performing a trial run
Test
- For
Environment Variables
typeecho $myPATH
and press enter.
Result:
- The command uses execv functionality, and it reads from the profile file to save and output the environment variables.
Test
- For
Environment Variables
typeecho $myPATH
and press enter.
Result:
- The command uses execv functionality, and it reads from the profile file to save and output the environment variables.
Test
- For
Profile File
, go to the user's home directory to find all the environment variables in the file calledCIS3110_profile
.
Result:
- In the profile file, you'll find the environment variables.
Test
- For
export
, typeexport myPATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:$myHOME/bin
and press enter.
Result:
- In the profile file, you can find that the path variable has been changed, and to test it, you can type
echo $myPATH
and enter.
Test
- For
history
, typehistory
,history -c
, orhistory n
and press enter to get all the commands you have typed, to delete your history of commands, or to get the "n" number of history commands.
Result:
- In the profile file, you can find the history file named
CIS3110_history
.
Test
- For
cd
, typecd ..
and press enter to change the current working directory.
Result:
- Shell's working directory will change.
-Took reference from CodeVault Youtube Channel for piping. -Took reference from Stack Overflow. -Took reference from documentation provided by Professor Deborah Stacey
The code is modular in nature. It has the ability, however, to be built up from even smaller components in a truly modular way utilizing more powerful tools provided by the C language. As a result, in future generations of this code, little restructuring would make it more portable.
Most of the components have been broken down to simple functions. These functions can be changed, and updated to make future enhancements. It should be pretty easy to change the code without changing the overall behavior.
Name: Basil Yusuf Course: cis3110 Assignment: Scheduling Algorithms Date: 19th March, 2022
Compile using: make
Copy paste this command: ./simcpu [-d] [-v] [-r quantum] < input_file
- Make sure the file is of the correct format
Name: Basil Yusuf Course: Operating Systems (CIS*3110) Date: April 10th, 2022 Version: 1.0
- First fit: ./hole [File Name] first
- Worst fit: ./hole [File Name] worst
- Best fit: ./hole [File Name] best
- Next fit: ./hole [File Name] next