Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Faculty of Arts, Computing, Engineering & Sciences

Sheffield Hallam University


16-7212 Operating Systems (MSc)

Resit Coursework 2009-2010: Multitasking and Scheduling Systems

Outline of the Task

You are required to develop a multi-tasking/multi-threaded C/C++ program that simulates a control
system for assembly lines.

The assembly line consists of three parts: line 1, line 2 and line 3. Blue and red objects are transported
down line 1 and are sorted onto lines 2 (blue) and 3 (red). Lines 2 and 3 may run at a slower speed
than line 1.

In your simulation you will need to create separate processes for each of the three lines. You will also
require a separate I/O process that accepts inputs from the PC keyboard and provide a display for the
control system. The keys of the PC keyboard will be used to simulate commands and are made up of a
two character key sequence. The first key always identifies the line, while the second key, a letter
indicating the command itself. These commands are outlined below:
 W – increase speed of line
 Q – reduce speed of line
 S – stop line
The sequence XX should be use to shutdown the whole system gracefully.

The line speed will be measured in objects/second, i.e. the number of objects that it can transport in
one second. You will have to provide an indicator of the number of objects on each line. The number
of objects on each line and the speed of each line should be simulated and displayed. Your system
may automatically increase or decrease the speeds of lines 2 and 3 in order to cope with either
increasing or decreasing production observed on line 1.

Typical Command Sequence

All key sequences are entered through the single I/O process. The key sequence 1W would increase
the speed of line 1. If line 2 and 3 are not running fast enough then the speed of these lines can be
increased accordingly by the controller. Pressing 2Q would now reduce the speed of line 2 but it
should not decrease below a minimum amount due to objects arriving from line 1. Pressing 3S should
stop line 3. When this happens, the speed of line 1 and 2 must also drop to zero. Pressing XX should
stop all lines, and close the child processes, followed by the parent processes. Shutting down must be
performed gracefully.

Scheduling

Modify the objects passing down the line so that they now carry a processing time element t. E.g. if a
blue object has a processing time element t=1.2 seconds, it will have to stay on line 2 for 1.2 seconds
before it is completed. The value for t is to be randomly generated for each object. Lines 2 and 3 will
now need to maintain a queue of objects coming in. Before the next object is accepted by either lines,
the process will have to run a scheduling algorithm to determine which object should be shifted from

16-7212 Coursework 2009-10 Page 1 of 4


the queue onto the line. The most basic system will run a first come first serve (FCFS) method. You
are expected to build other schedulers as well.

Hints and Guidelines

Implement the simulation using multiple processes and/or threads, and appropriate inter-process/inter-
task communication methods, e.g. data pools, pipeline, messages etc. The shared information can be
simulated with a data pool. The lines will need to have their access to the data pool controlled by
semaphores. Remember that the display screen is a shared resource and will need protection with a
semaphore. You may wish to simulate any extra features that you can identify in order to gain extra
marks.

Extras

You will receive bonus marks for the following extras and any other items that you can identify in
your report and implement using the RT libraries.
1. Is your solution scalable to more than 3 lines?
2. Can you dynamically switch between scheduling algorithms on your lines?
3. Design a mechanism to manually input objects in line 1.
4. Optimize your simulation from the point of view of a concurrent solution.
5. Introduce the concept of priorities into you system by first modifying the job structure.
6. Provide appropriate display/front-ends to show how objects are being scheduled.
7. Identify any other extra features that would be useful

Assignment Part A:

The programs for this simulation are to be written in C/C++ using the RT libraries. Make sure that
you write your name at the top of each C++ file you implement. Marks will be given for
completeness, reliability and fault-tolerance. You are required to submit the compressed (zipped)
folder of your Visual Studio project so you need to make sure that your solution has been pre-
compiled and ready to run and that you include a README file with simple instructions on how to
run the programs – i.e. where is the starting point.

Assignment Part B:

You are also required to submit a report describing the work done that includes the following
sections: Analysis, Design, Implementation and Testing, Conclusion, References. Appropriate use of
diagrams are expected together with illustrative screen shots. You need to make sure that in the
Conclusions section you provide a critical appraisal of the work done and indicate (with justification)
any extra feature that could have been implemented. The report should not be larger than 10 single-
sided A4 pages. Make sure that you include your name in the first page of the report.

Submission

Only ONE single zipped folder should be submitted. Create a folder with your name and place three
items in this folder:

1. The top level Visual Studio folder containing you project


2. A README file with simple useful instructions
3. Your report as specified in Part B of the assignment.

E-mail the zipped folder to m.rodrigues@shu.ac.uk by the set deadline. Please note that no hard
copies will be accepted and no extensions can be given.

16-7212 Coursework 2009-10 Page 2 of 4


Note About Plagiarism

The work submitted must be your own work. Plagiarism/copying will be identified and action will be
taken. Plagiarism either from your fellow students or directly from the internet is strictly prohibited.
Remember also that the University regards any student who allows their work to be copied, to be just
as guilty as the student who copies it. For guidelines regarding what constitutes plagiarism, please
refer to the document entitled ``An Introduction to Academic Integrity for Sheffield Hallam
University Students''.

16-7212 Coursework 2009-10 Page 3 of 4


Unit Assessment Criteria:

Indicative
Feature (0-39%) (40%-49%) (50%-59%) (60%-69%) (70+%) Weighting
F/E D C B A
Use of concurrent Unable to identify and Able to select and use a Able to select and use Able to select and use Able to select and use
programming structures. use concurrent few of the concurrent correctly some correctly most correctly all concurrent 40%
(Tasks/Processes, data programming structures. programming concurrent programming concurrent programming programming structures.
pools. pipeline, structures.. structures. structures
semaphores etc.
Program design, Poor design and process Adequate design and Good design and process Very good design and Excellent program
structure and structures. Little or no process structures. structures Appropriate process structures design and professional 20%
documentation useful user Satisfactory documentation and Detailed documentation documentation and
documentation and poor documentation and format/layout of and format/layout of format/layout of
program format/layout. format/layout of program. program. program.
program.
Working state, and Little or no evidence of a Program performs Program satisfies basic Program satisfies basic Program performs all
features working system. minimum system system requirements system requirements and system requirements and 40%
requirements. some user additions. extended in an
appropriate and
innovative direction.

You might also like