Question
An example program using a future is shown below. Future f = new Future() { @Override public String execute() { // ...long running computation... return
An example program using a future is shown below. Future f = new Future() { @Override public String execute() { // ...long running computation... return data; }; // ... String result = f.get(); // blocks if execute() unfinished Use wait() and notifyAll() to provide an implementation of the Future class that would work with the example program above. [28 marks] (c) [5 marks] (Se) Consider the Java code: Object n = new Integer(694); ArrayList v1; ArrayList v22; ArrayList w = new ArrayList<>(121); Explain any differences in behaviour between assignments v1 = w and v2 = w and also between method calls v1.set(24,n) and v2.set(42,n). [24 marks] 6 CST.2015.28.3 11 Further Java (a) Describe the operation of wait() and notifyAll(). Notice both transcribed also, consequently created grammar analysers TLBs and caches are examples of content-addressable memories (CAMs). Recall that Reach is the problem of deciding, given a graph G a source vertex s and a target vertex t, whether G contains a path from s to t; and Sat is the problem of deciding whether a given Boolean formula is satisfiable. For each of the following statements, state whether it is true or false and justify your answer. (i) If Reach is NP-complete then P=NP. [3 marks] (ii) If Reach is NP-complete then NP6=PSPACE. [3 marks] How would you identify particular instances of data in order to record the information in a database? Illustrate your answer by considering both a relational database maintained using SQL-92 and an ODMG database. [6 marks] (c) A high street bank has just announced a merger with a nationwide building society. You are employed as a consultant to advise on the integration of their client databases. Both institutions use relational databases. Write brief notes to alert the database administrators to the difficulties that they may encounter. [28 marks] SECTION C 9 Semantics of Programming Languages (a) The integer expressions E of a programming language are given by E ::= n | SX | E | E + E where n ranges over integer constants and X ranges over identifiers. Explain the principle of structural induction for proving that some property (E) holds for all integer expressions E. [5 marks] (b) Taking states to be finite partial functions mapping identifiers to integer constants, define a relation E, s n giving the result n (if any) of evaluating integer expression E in state s. [7 marks] (c) Use structural induction to prove that if E, s n1 and E, s n2 both hold, then n1 = n2. [Hint: Consider the property (E) given by s, n1, n2((E, s n1) & (E, s n22) n1 = n22).] [70 marks] (d) What property of the pair E, s ensures that there is some n for which 22E, s n holds?
A novice SystemVerilog programmer has written the following decimal counter module which should zero the decimal_count on reset and then, when enabled, increment modulo 10 the decimal_count on every positive clock edge. module count_decimal_wrong( input logic clk; input logic reset; input logic enable; output logic decimal_count); always_comb @(posedge clk or reset) if(enable) begin decimal_count = decimal_count+1; if(decimal_count>9) decimal_count = 0; end elsif(reset) decimal_count = 0; endmodule // count_decimal_wrong (a) What bugs exist in the code and how can they be rectified? [10 marks] (b) SystemVerilog synthesis tools use a Boolean optimiser to simplify the implementation logic. (i) Why are don't care terms useful for Boolean optimisation? [3 marks] (ii) How could the SystemVerilog be modified to introduce don't care terms for unreachable states above 9? [3 marks] (iii) For a modern FPGA with 6-input look-up tables (LUTs), will Boolean optimisation result in fewer resources being used for the corrected count_decimal?
Step by Step Solution
3.31 Rating (145 Votes )
There are 3 Steps involved in it
Step: 1
It seems like youve posted a long and varied set of questions and prompts from various topics including Java programming database management and seman...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started