Question:
Question 1
(a) In the evolution of imperative programming languages, features have been introduced, whilst other features have been removed or deprecated in 'successor' languages.
Discuss, with critical comment, the motivations for these changes that have been made to imperative programming languages. Concentrate your discussion on issues of reliability and maintenance, both corrective and enhancement of applications that are developed in these languages.
In your discussion use a range of imperative programming languages (For example: COBOL, BCPL, C, C++, Java etc.) to illustrate points that you make. DO NOT consider any issues or constructs that directly or indirectly make use of concurrency.
(b) Discuss, using an appropriate notation, how it is possible to 'port' a compiler for a programming language to a new host machine which has a different architecture from its existing environment. The effort required to port the compiler should be considerably less that the effort required to create the original version of the compiler.
In your discussion of the process involved, describe carefully the overall structure of the compiler in relationship to the need to facilitate the 'port' of the compiler to a new machine.
Question 2:
(a) What is transactional memory? Discus, how transactional memory may be implicitly used in a Java program to improve performance in programs that consist of several concurrently executing threads that share access to common data structures.
Remember, the use of transactional memory will not require any changes to the physical source code of a program.
(b) Discuss, with critical comment, the extent to which the new features of Java 8 allow a programmer to construct a program that will make use of multiple cores without explicitly having to use threads in the solution. Use appropriate examples to illustrate the points that you make.
(c) In a computer game, a high priority thread is used to process user interactions with the system. This high priority thread accesses a shared data structure (aSDS) which is also accessed by a low priority thread in the system. To prevent corruption of the data, a lock is used to prevent more than 1 concurrent access to the shared data structure (aSDS). The low priority thread continually checks the state of the game and performs low level housekeeping tasks including the re-organisation of the shared data structure (aSDS). The re-organisation of the shared data structure (aSDS) will occur every second, however, it will take under 5 CPU milliseconds to run.
The above system will always allow a higher priority thread to run even if it has to pre-empt a running lower priority thread. Recently a medium priority thread has been introduced that adds some artificial intelligence to the game. This medium priority task takes some time to run (1-5 seconds), but can be pre-empted by the high priority thread that controls the user interactions. The medium priority thread does not access the shared data structure (aSDS). Unfortunately the observed effect by users of the new version of the game is
that they occasionally experience long pauses of several seconds when it is not possible to interact with the game.
Suggest what the most likely cause of this problem is in the new 'improved' version of the game. Propose a solution to resolve the issue and carefully comment on why it works.
Question 3:
(a) For systems that require authentication of users of the system, what steps would you advise developers and users of the system to take to ensure as far as possible that the users who are authenticated by the system really are the person that they claim to be? For each suggestion, justify your selection with critical comment about what issue or issues is being addressed. In addition, what other issues would you advise the developers to investigate, to ensure the confidentiality and security of the data stored on the system?
(b) The TCP protocol provides a reliable stream-oriented communications medium, and yet it uses the IP protocol suite, an unreliable packet-oriented medium. Explain what 'reliable' means in this context, and describe how TCP's reliable stream-oriented service is implemented. Then explain and critically comment on the performance consequences of using TCP to communicate between a client and a server when:
1) A long distance between the client and the server is involved.
2) A highly interactive program is used on the server, for example, a cloud based editor which often involves the sending of single characters from the client to the cloud based editor. In each case above explain what can be/ is done to alleviate the impact on performance.