Operating Systems COMP 310 – ECSE 427 McGill University
Assignment #1: Building an OS Shell
Due: October 3, 2024 at 23:59
1. Infrastructure Description
Welcome to the first OS assignment where we will build an OS Shell!
This is the first of a series of three assignments that build upon each other. By the end of the semester,
you will have a running simulation of a simple Operating System and you will get a good idea of how the
basic OS modules work.
You will use the C programming language in your implementation, since most of the practical operating
systems kernels are written in the C/C++ (e.g., including Windows, Linux, MacOS, and many others).
The assignment is presented from a Linux point of view using a server like Mimi. Our grading infrastructure
will pull your code from GitLab automatically and will run the unit tests for this assignment every day on
the Mimi server. The autograder may not run for the first few days as we take all the administrative steps
to set it up.
Starting shortly after the team registration deadline, you will receive a daily report stating whether your
code passes the unit tests. Please make sure your assignment runs on our server, as this is the reference
machine we use for grading. To get your code picked up by our grading infrastructure we will rely on
GitLab. It is mandatory to use GitLab for this coursework. For more information about GitLab and the
grading infrastructure, please refer to the tutorial posted on MyCourses as part of Lab 1.
For local development, and quicker testing turn-around, you can use the SOCS server
mimi.cs.mcgill.ca, which you can reach remotely using ssh or putty. You need a SOCS account
to access the mimi servers, and you need to either be on campus or connected to the McGill VPN. If you
do not have a SOCS account (e.g., you might not have one if you are an ECSE student) please follow the
instructions here to obtain one.
To get started, fork the following repository, which contains the starter code and the testcases for this
assignment.
https://gitlab.cs.mcgill.ca/mkopin/comp310-ecse427-coursework-f24
IMPORTANT: If you have already forked your repository before the release date of the assignment,
please make sure that your version of the starter code is up-to-date (i.e., sync your fork with the upstream
repository mkopin/comp310-ecse427-coursework-f24) before starting to work on the code.
1.1 Starter files description:
We provided you with a simple shell to start with, which you will enhance in this assignment. Take a
moment to get familiar with the code.
Kopinsky Assignment #1
This study source was downloaded by 100000901736981 from CourseHero.com on 10-15-2025 13:21:24 GMT -05:00
Page 1 of 7
https://www.coursehero.com/file/251973264/Assignment-1-Fall2024-1pdf/
, Operating Systems COMP 310 – ECSE 427 McGill University
Compiling your starter shell
• Use the following command to compile: make mysh
• Re-compiling your shell after making modifications: make clean; make mysh
• Note: The starter code compiles and runs on Mimi and on our server. If you’d like to run the code
in your own Linux virtual machine, you may need to install build essentials to be able to compile C code:
sudo apt-get install build-essential
Your code should be able to compile in any environment with a C compiler so long as you do not
hardcode assumptions about the machine into your code. For example, write `sizeof(int)` rather than
assuming that this value is 4.
Running your starter shell
• Interactive mode: From the command line prompt type: ./mysh
• Batch mode: You can also use input files to run your shell. To use an input file, from the
command line prompt type: ./mysh < testfile.txt
Starter shell interface. The starter shell supports the following commands:
COMMAND DESCRIPTION
help Displays all the commands
quit Exits / terminates the shell with “Bye!”
set VAR STRING Assigns a value to shell memory
print VAR Displays the STRING assigned to VAR
run SCRIPT.TXT Executes the file SCRIPT.TXT
More details on command behavior:
• The commands are case sensitive.
• If the user inputs an unsupported command the shell displays “Unknown command”.
• set VAR STRING first checks to see if VAR already exists. If it does exist, STRING overwrites the
previous value assigned to VAR. If VAR does not exist, then a new entry is added to the shell memory
where the variable name is VAR and the contents of the variable is STRING. For now, each value
assigned to a variable is a single alphanumeric token (i.e., no special characters, no spaces, etc.). For
example:
▪ set x 10 creates a new variable x and assigns to it the string 10.
▪ set name Bob creates a new variable called name with string value Bob.
▪ set x Mary, replaced the value 10 with Mary.
• print VAR first checks to see if VAR exists. If it does not exist, then it displays the error “Variable
does not exist”. If VAR does exist, then it displays the STRING. For example: print x from the above
example will display Mary.
• run SCRIPT.TXT assumes that a text file exists with the provided file name, in the current
directory. It opens that text file and then sends each line one at a time to the interpreter. The
Kopinsky Assignment #1
This study source was downloaded by 100000901736981 from CourseHero.com on 10-15-2025 13:21:24 GMT -05:00
Page 2 of 7
https://www.coursehero.com/file/251973264/Assignment-1-Fall2024-1pdf/
Assignment #1: Building an OS Shell
Due: October 3, 2024 at 23:59
1. Infrastructure Description
Welcome to the first OS assignment where we will build an OS Shell!
This is the first of a series of three assignments that build upon each other. By the end of the semester,
you will have a running simulation of a simple Operating System and you will get a good idea of how the
basic OS modules work.
You will use the C programming language in your implementation, since most of the practical operating
systems kernels are written in the C/C++ (e.g., including Windows, Linux, MacOS, and many others).
The assignment is presented from a Linux point of view using a server like Mimi. Our grading infrastructure
will pull your code from GitLab automatically and will run the unit tests for this assignment every day on
the Mimi server. The autograder may not run for the first few days as we take all the administrative steps
to set it up.
Starting shortly after the team registration deadline, you will receive a daily report stating whether your
code passes the unit tests. Please make sure your assignment runs on our server, as this is the reference
machine we use for grading. To get your code picked up by our grading infrastructure we will rely on
GitLab. It is mandatory to use GitLab for this coursework. For more information about GitLab and the
grading infrastructure, please refer to the tutorial posted on MyCourses as part of Lab 1.
For local development, and quicker testing turn-around, you can use the SOCS server
mimi.cs.mcgill.ca, which you can reach remotely using ssh or putty. You need a SOCS account
to access the mimi servers, and you need to either be on campus or connected to the McGill VPN. If you
do not have a SOCS account (e.g., you might not have one if you are an ECSE student) please follow the
instructions here to obtain one.
To get started, fork the following repository, which contains the starter code and the testcases for this
assignment.
https://gitlab.cs.mcgill.ca/mkopin/comp310-ecse427-coursework-f24
IMPORTANT: If you have already forked your repository before the release date of the assignment,
please make sure that your version of the starter code is up-to-date (i.e., sync your fork with the upstream
repository mkopin/comp310-ecse427-coursework-f24) before starting to work on the code.
1.1 Starter files description:
We provided you with a simple shell to start with, which you will enhance in this assignment. Take a
moment to get familiar with the code.
Kopinsky Assignment #1
This study source was downloaded by 100000901736981 from CourseHero.com on 10-15-2025 13:21:24 GMT -05:00
Page 1 of 7
https://www.coursehero.com/file/251973264/Assignment-1-Fall2024-1pdf/
, Operating Systems COMP 310 – ECSE 427 McGill University
Compiling your starter shell
• Use the following command to compile: make mysh
• Re-compiling your shell after making modifications: make clean; make mysh
• Note: The starter code compiles and runs on Mimi and on our server. If you’d like to run the code
in your own Linux virtual machine, you may need to install build essentials to be able to compile C code:
sudo apt-get install build-essential
Your code should be able to compile in any environment with a C compiler so long as you do not
hardcode assumptions about the machine into your code. For example, write `sizeof(int)` rather than
assuming that this value is 4.
Running your starter shell
• Interactive mode: From the command line prompt type: ./mysh
• Batch mode: You can also use input files to run your shell. To use an input file, from the
command line prompt type: ./mysh < testfile.txt
Starter shell interface. The starter shell supports the following commands:
COMMAND DESCRIPTION
help Displays all the commands
quit Exits / terminates the shell with “Bye!”
set VAR STRING Assigns a value to shell memory
print VAR Displays the STRING assigned to VAR
run SCRIPT.TXT Executes the file SCRIPT.TXT
More details on command behavior:
• The commands are case sensitive.
• If the user inputs an unsupported command the shell displays “Unknown command”.
• set VAR STRING first checks to see if VAR already exists. If it does exist, STRING overwrites the
previous value assigned to VAR. If VAR does not exist, then a new entry is added to the shell memory
where the variable name is VAR and the contents of the variable is STRING. For now, each value
assigned to a variable is a single alphanumeric token (i.e., no special characters, no spaces, etc.). For
example:
▪ set x 10 creates a new variable x and assigns to it the string 10.
▪ set name Bob creates a new variable called name with string value Bob.
▪ set x Mary, replaced the value 10 with Mary.
• print VAR first checks to see if VAR exists. If it does not exist, then it displays the error “Variable
does not exist”. If VAR does exist, then it displays the STRING. For example: print x from the above
example will display Mary.
• run SCRIPT.TXT assumes that a text file exists with the provided file name, in the current
directory. It opens that text file and then sends each line one at a time to the interpreter. The
Kopinsky Assignment #1
This study source was downloaded by 100000901736981 from CourseHero.com on 10-15-2025 13:21:24 GMT -05:00
Page 2 of 7
https://www.coursehero.com/file/251973264/Assignment-1-Fall2024-1pdf/