Principles of Operating Systems

CMSC 421 - Fall 2018


Homework 1

50 points total

Due by 11:59PM EDT on Friday, September 28th

Part I

25 points

Please provide written responses to the following questions. Each response should be about a paragraph in length — there is no need to write us a book for each, just be sure to answer the question thoroughly.

  1. What are the two main functions of an operating system. Be sure to explain these two functions in your own words. (3 points)
  2. Explain the concept of Interprocess Communication (IPC). Compare and contrast the two main methods of IPC: shared memory and message passing. (5 points)
  3. What is the role of sockets in IPC? Which of the two methods of IPC in question #2 could sockets be considered. Differentiate between datagram sockets and stream sockets. (5 points)
  4. Compare and contrast named pipes, ordinary pipes, and sockets. (5 points)
  5. Explain the concept of system calls and how they work in an OS. Give a concrete example of a task that requires multiple system calls to be called to complete in a modern computer system and identify which system calls would need to be called (potential tasks you could use include things like copying a file or reading a web page from a remote server). (7 points)

You must submit a PDF file of the answers to these questions on the Homework 1 assignment on Blackboard. You may prepare your responses in any word processing application of your choosing, but you must submit a PDF file. Do not submit Microsoft Word/Apple Pages/LibreOffice documents with your responses. You must convert to a PDF file before submitting or you will lose points.

Part II

25 points

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).

Throughout this semester, you will be building a shell for a Linux system as part of your homework assignments. While this shell will start out extremely basic in this assignment, you will be extending your shell program throughout the semester to give it more interesting capabilities. Please write the code this in mind as you proceed (extensibility is key). Also, keep in mind that you will need to use this code as a base for all future homework assignments — it is in your best interest to ensure that the base you write for this assignment works well and completely fulfills the requirements set herein.

For the first 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-FA2018/shell-username.git
git push -u origin master

git tag hw1
git push origin --tags

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