Course 20026 Advanced Programming Concepts

Homework course module 2


Assignment 1 (8 points)

With regard to the breakfast-example (s. figure), please specify at least 1 sequential and 1 not sequential process. Both processes should consider all actions of the four activities and must not be congruent to the figure below.

Assignment 2 (12 points)

Please develop a Java program, consisting both concurrent threads 'readletter' and 'lettersequenceoutput' with the following functionality:

  • The thread readletter waits for the input of a letter by using the keybord.
  • The thread lettersequenceoutput displays all letters of the alphabet up to the final letter of those, which were entered by the thread 'readletter'.
  • The thread 'readletter' waits as long as all letters were displayed and asks for a new end letter, immediately after the display of the last letter.
  • The thread 'lettersequenceoutput' waits one second between the display of each letter, before the next letter will be displayed.
  • When using the keybord five times, the program ends.

 

Assignment 3 (4 points)

a) Please specify two advantages and two disadvantages of non sequential programming. (2 points)

b) Why the methods Thread.stop(), Thread.suspend() und Thread.resume() shall not become invoked? In what way the functionality of the mentioned methods can become achieved without using the above mentioned methods? (2 points)