Assignment title: Information
CPSC 503 Operating Systems Spring 2016
Project 1 – Online Q and A system
Objectives:
1. Become familiar with Programming Assignment
2. Work with multiple processes
3. Gain experience with process communication
Due: Sunday June 26 2016. 11:59:59 PM (EST)
These will be individual projects. The main purpose of this programming assignment, i.e.
Project 1, is to become familiar with the programming of creating processes using system
call (library) and inter-process communication.
For Project 1, you may choose any programming language, such as .NET, Visual C++, C,
etc. as long as the programming language provides library or function to create a process
such as fork() and exec() in C (C++). Because of this reason, Java is not allowed. Also,
other OS, such as Unix or Linux, are possible. In any case, your final program should be
compiled and running on GA's computer. To do that, you need to provide all materials
as well as source code, such as run time module, integrated development environment
(Visual Studio, .NET or C#), and any other program to run your program.
You are to implement a simple Question and Answer system for a teacher and students
like online chatting. This program does not require GUI, nor user interactions. Your
program should consist of at least four processes as seen in the Figure 1. The main
process is the 'Manager (i.e., teacher)'. It should create three other processes (children
processes as students) and manage the discussion.
Manager Process
(Teacher)
Child 1 Process
(#1 Student)
Child 2 Process
(#2 Student)
Figure 1 Hierarchy of Processes
(#N Student) . . . .
Child 2 Process
The desired output sequence is as follows:
1. Start your program (Manager process for a teacher)
2. Display PID of Manager process
3. Input the number of students (i.e., how many child processes). It should be equal
or greater than 3.
4. Create children processes as students.
5. Display PIDs of children processes: for example
# 1st student's PID is 123
# 2nd student's PID is 234
# 3rd student's PID is 345
. . .
6. Manager sends message "Start Q and A" to each student (i.e., each child process)
7. Each child process (student) send their PID as student ID to a manager process.
8. Manager process display each student ID.
9. Each child process (student) sends a question to manager process
(This should be standard input using keyboard typing)
10. Manager process display each question: for example
# 1st student asks "What is 1 + 1?"
# 2nd student asks "What is CS?"
# 3rd student asks "What year is this?"
11. Any child process can answer for the question.
12. Manager process judges if the answer is correct or wrong: for example
# 1st student answer is correct (go to Step 13)
Or # answer is wrong (go to Step 10)
13. If all students' questions are answered correctly, manager process sends kill signal
to all children processes.
14. Finally, exit manger process.
The procedure mentioned above is just simple one. You can add or modify the procedure
as long as your program does not disobey the main requirements.
Two important things that should be decided before you code:
• Which language I use.
• Which communication method I use.
Write-up
You should submit a write-up as well as your program. Your write-up should include any
known bugs, limitations, and assumptions in your program. This write-up should be in
text-format and titled as 'README'. It should be submitted along with your code. GA
will use the 'README' file to compile (or install) and run your program. If the GA has
trouble with your program then he will contact you to makeup it.
Submission
You will submit your program to Canvas.
You should zip your source files and write-up (README) into a single file and submit it.
Be sure that you include everything necessary to unzip this file on another machine and
compile and run it. This might includes forms, modules, classes, configuration file, etc.
DO NOT include the executable file itself, we will recompile it. The name of your
submitted zip file should be your UB account + ID. For example, "jelee000000.zip".
Make sure your name and UB ID are listed in both your write-up and source code. You
may resubmit your program at any time. However, please do not ask the GA to grade
your program and then resubmit it. The submission time of the latest submission will be
used for determining whether the assignment is on time or not. Late submissions will be
accepted at a penalty of 10 points per day. In other words, it may pay you to do this
project early on the off chance that something prohibits your submitting it in a timely
way. If your program is not working by the deadline, submit it anyway and review it
together with GA for partial credit. Do not take a zero on any lab just because the
program isn't working yet. If you have trouble getting started, ask the professor or the
Grading
20 Multiple processes started successfully
20 Successful process control and communication
20 Termination of processes before exit
10 Logic and rule
15 Comments in code
15 Write-up
To receive full credit for comments in the code you should have headers at the start of
every module, subroutine, or function explaining the inputs, outputs and function of the
module. You should have a comment on every data item explaining what it is about.
(Almost) every line of code should have a comment explaining what is going on. A
comment such as /* add 1 to counter */ will not be sufficient. The comment should
explain what is being counted.