Principles of Operating Systems

CMSC 421-01 and 421-02 - Spring 2019


Homework 1

50 points

Due by 11:59PM EST on Friday, February 22nd

Complete the following programming assigment and submit your code using the GitHub repository that you will have created for this assignment. This assignment must be completed in the C programming language (you can choose to use C89/C90/ANSI C, C99, or C11 as you see fit).

The projects assigned in this class all involve programming within the Linux kernel in the C programming language. Many students in this class have expressed over the years that their experience with the C language is unfortunately somewhat lacking and have run into issues in completing their projects successfully. To that end, this homework assignment includes a small programming assignment that is designed as a warm up for Project 1 and Project 2. This assignment is to be completed in user-space (not within the Linux kernel), and does not involve compiling the kernel itself at all. However, you must ensure that the code that you submit compiles, links, and runs properly within the VM you have set up for your projects (as the TAs will be grading your assignment within a VM set up in the same way).

You may be expected to revisit this programming assignment in one or more future homework assignments in this semester. Please write the code this in mind as you proceed (extensibility is key). As you may end up using this code as a base for future assignments, it is in your best interest to ensure that the code you write for this assignment works well and fulfills the requirmenets set herein.

For the this iteration of your shell program, you will only need to support a few very basic features of a full-fledged *nix shell. Specifically, you will need to have support for all of the following:

You are not expected to support any of the following features, however these may or may not be added in a future homework assignment.

Your shell program is not allowed to use any external libraries other than the system's C library. Do not try to use libraries like Readline. You will lose points for using external libraries to implement shell functionality! You are not allowed to use any of the following functions in the C library to implement your shell:

On the other hand, the following list of functions may prove to be very useful to you, depending on how you you implement your shell:

You are not allowed to implement any of your shell's functionality by calling on another shell to do the work. You must do the argument parsing and calling of programs in your own code!

When submitting your shell program, please be sure to include the source code of the shell program (in one or more C source code files), as well as a Makefile that can be used to build the shell. Your shell must be able to be built and run on a VM as has been set up for this course in your projects. Also, you should include a README file describing your approach to each of the requirements outlined above.

If you would like a template for use as a Makefile for your shell, I have provided one here.

An example of a command file that you can use is included below:

ls
gcc --version
/bin/ls
/bin/echo Hello World
uname -a
With this command file, I should see something similar to the following as output from your shell (based on my VM):
hello  hello.c
gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
hello  hello.c
Hello World
Linux ryuujou-vm 4.18.6-cmsc421project0-lsebald1+ #1 SMP Thu Sep 6 15:21:54 EDT
2018 x86_64 GNU/Linux

To submit your project, you must first accept the assignment on GitHub. The link to do so is posted on the course Piazza page. Once you have done that, make sure that your project files (any source files and your Makefile) are in their own directory, then run the following commands in that directory (substituting the list of files you need to commit for your_files_go_here and your GitHub username for username, of course):

git init
git add your_files_go_here
git commit
git remote add origin git@github.com:UMBC-CMSC421-SP2019/shell-username.git
git push -u origin master

git tag hw1
git push origin --tags

Last modified Tuesday, 01-Sep-2020 18:43:34 EDT