Difference between revisions of "DT 8025 2016 Practical 2"

From CERES
Jump to: navigation, search
(Created page with "jdsfjdshjf")
 
Line 1: Line 1:
jdsfjdshjf
+
== Objectives ==
 +
 
 +
There are three objectives for this practical:
 +
 
 +
* Learn about and implement the basic ingredients for concurrency,
 +
* Implement the mutual exclusion primitives,
 +
* Use them in implementing a simple access control protocol
 +
 
 +
== Instructions ==
 +
 
 +
Submit a single .zip file on blackboard with separate folders, each containing the solutions to the below-specified parts.
 +
 
 +
For each function in the code, you need to write evidence of test-driven development, both in terms of comments (description, pre- and post-condition and properties) and unit testing test suites (e.g., in CUnit, see below).
 +
To show the successful execution of your test suite, also include the XML file resulting from its execution.
 +
Include a report document (preferably with PDF format) which explains the details about the implementation of each part of the assignment (including details of the implemented functions and what they do).
 +
 
 +
=== Part 1: Yield and Context ===
 +
 
 +
Download the Libtask library and run the sample program primes on the Raspberry Pi. This is a simple example with only one thread to execute. There is no way of switching context because there is no invocation to taskyield() which is a function in the library used for changing control between threads. Hence, to be able to switch the control between threads using this library you need to implement two functions. The first function is:
 +
 
 +
taskyield()
 +
 
 +
This is the main function used for cooperative control switch. Implement the function such that:

Revision as of 19:36, 3 October 2016

Objectives

There are three objectives for this practical:

  • Learn about and implement the basic ingredients for concurrency,
  • Implement the mutual exclusion primitives,
  • Use them in implementing a simple access control protocol

Instructions

Submit a single .zip file on blackboard with separate folders, each containing the solutions to the below-specified parts.

For each function in the code, you need to write evidence of test-driven development, both in terms of comments (description, pre- and post-condition and properties) and unit testing test suites (e.g., in CUnit, see below). To show the successful execution of your test suite, also include the XML file resulting from its execution. Include a report document (preferably with PDF format) which explains the details about the implementation of each part of the assignment (including details of the implemented functions and what they do).

Part 1: Yield and Context

Download the Libtask library and run the sample program primes on the Raspberry Pi. This is a simple example with only one thread to execute. There is no way of switching context because there is no invocation to taskyield() which is a function in the library used for changing control between threads. Hence, to be able to switch the control between threads using this library you need to implement two functions. The first function is:

taskyield() 

This is the main function used for cooperative control switch. Implement the function such that: