Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In the context of multithreaded algorithms, define work and span, and state the work law and the span law. Support Details for the question -

In the context of multithreaded algorithms, define work and span, and state the work law and the span law.

Support Details for the question -

(b) Prove that the performance of a greedy scheduler is optimal to within a factor of 2. (Proving all intermediate theorems is not required if you state them correctly.) [4 marks] (c) Version A of a multithreaded algorithm takes 500 seconds on a uniprocessor machine and 50 seconds on a 32-processor machine. Version B takes the same time as A on a single processor but only 24 seconds on the 32-processor machine. (i) Define the parallelism of a computation and compute the parallelism of algorithms A and B. Which of the two has higher parallelism, and by how much? (Hint: use one of the greedy scheduler theorems to derive an approximation for one of the unknowns.) [6 marks] Estimate how many bits the algorithm would use to encode a string consisting of 1000 repetitions of the character "A". [8 marks] 4 Comparative Programming Languages (a) Discuss to what extent a programmer can expect a program that conforms to a standard to generate identical results when run under different conforming compilers on different machines. [6 marks] (b) ALGOL 60 provided call by value and call by name, Pascal provided call by value and call by reference, and ALGOL-W provided a variety of calling methods including call by result and call by value-result. Briefly describe the calling mechanisms just mentioned and discuss why most modern programming languages provide only call by value. [8 marks] Java is sometimes said to be "dynamically typed" in that a variable whose type is (class) C can be assigned a value of (class) D provided that D extends C; conversely a variable of type D can be assigned a value of type C using a cast. By considering storage layouts, explain why the former assignment is always valid and the latter sometimes invalid. [4 marks] (c) A new programming language has the notion of "statically scoped exceptions" in which the program exception foo; void f() { try { void g() { raise foo; } try { g(); } except (foo) { C2 } } except (foo) { C1 } } would execute C1 rather than C2 as the former was in scope at the raise point. By analogy with statically scoped variables, or otherwise, explain how such exceptions might be implemented on a stack. [10 marks] Assign the First host IP address from Network P subnet to Sl. c. Assign the Second host IP address from Network P subnet to PCI. d. Assign the Last host IP address from Network Q subnet to GO/1 interface of R2. e. Assign the First host IP address from Network Q subnet to S2. f. Assign the Second host IP address from Network Q subnet to PC2. g. Assign the Last host IP address from Network R subnet to G0/1 interface of R3. h. Assign the First host IP address from Network R subnet to S3. i. Assign the Second host IP address from Network R subnet to PC3. j. Assign the First host IP address from Network X subnet to S0/1/0 interface of Ri. k. Assign the Last host IP address from Network X subnet to S0/1/1 interface of R2. 1. Assign the First host IP address from Network Y subnet to S0/1/0 interface of R2. m. Assign the Last host IP address from Network Y subnet to S0/1/1 interface of R3. n. Assign the First host IP address from Network Z subnet to S0/1/0 interface of R3. 0. Assign the Last host IP address from Network Z subnet to S0/1/1 interface of Ri.

(3b)

(b) A bustling web server could hope to deal with simultaneous solicitations to peruse and

update a few common information and could utilize Timestamp Ordering (TSO) to implement

separation between simultaneous exchanges.

(I) Explain how TSO upholds disconnection.

(ii) Is TSO proper for a web server application? Make sense of your thinking.

iii) Objects: Electronic health records (EHRs) in a nationwide service. Policy: The owner (patient) may read from its own EHR. A qualified and employed doctor may read and write the EHR of a patient registered with him/her. (iv) Object: The solution to online coursework. 2 ECAD Consider the following mysterious Verilog module. module mystery(c,r,a,s); input c,r,a; output [2:0] s; reg [2:0] s; always @(posedge c or posedge r) if(r) s<=0; else begin if(a && (s<7)) s<=s+1; else if(!a && (s>0)) s<=s-1; end endmodule (a) How many flip-flops will be required to implement the mystery module, and how will signals c and r be connected to these flip-flops? [5 marks] (b) What is the state transition diagram for this mystery module? [5 marks] (c) If this module were synthesised to the minimum sum of products form, what would the equations be for next state bits s[0], s[1] and s[2]? [10 marks] (d) State what happens when attempting to compile and execute the following Java fragment (explaining the origin of any error messages or exceptions which might arise). Object n = new Integer(42), o = new String("DATA");

1. [2 marks]

2. Define a sort or types (in C, Java, or ML) appropriate for holding a theoretical

linguistic structure tree coming about because of your solution to part (b). Which of the lookup mechanisms in part (b) is usually used for a TLB and why aren't the other mechanisms usually used? [6 marks] 2 ECAD Consider the following mysterious Verilog module. module mystery(c,r,a,s); input c,r,a; output [2:0] s; reg [2:0] s; always @(posedge c or posedge r) if(r) s<=0; else begin if(a && (s<7)) s<=s+1; else if(!a && (s>0)) s<=s-1; end endmodule (a) How many flip-flops will be required to implement the mystery module, and how will signals c and r be connected to these flip-flops? [5 marks] (b) What is the state transition diagram for this mystery module? [5 marks] (c) If this module were synthesised to the minimum sum of products form, what would the equations be for next state bits s[0], s[1] and s[2]? [180 marks] Suppose that the following rules are proposed as possible optimizations to be implemented in your compiler. expression simplifies to expression (fst e, snd e) e fst (e1, e2) e1 snd (e1, e2) e2 Describe how you could implement these rules so that the simplifications are made only when the program's semantics is correctly preserved. [5 marks] 5 (TURN OVER) CST.2016.3.6 5 Concepts in Programming Languages (a) Explain what is meant by a monad in a programming language, giving the two fundamental operations of a monad along with their types. [3 marks] (b) Consider the use of a monad for input-output. For the purposes of this question,

Consider different versions of an optimising compiler, each of which uses IEEE standard representation for all variables. Give two reasons why they might compile a floating-point program into code that, when run, produces differing results. [2 marks] 6 CST.2016.1.7 6 Numerical Methods A picnicker brings hot black coffee and cold milk in two identical insulated flasks and then mixes them for his drink. His friend claims that the drink would have ended up the same temperature if he had mixed the two at home and brought one flask. Note: The temperature of an object is the heat energy within it divided by its heat capacity. The rate of heat energy flow from a hotter to a cooler object is their temperature difference divided by their insulation resistance. When two fluids are mixed the resultant temperature is the sum of their initial temperatures weighted by their proportions. (a) Give a suitable state vector for a simple, finite-difference, time domain simulation of the drink system. [3 marks] (b) List the initial values and any other parameters that are needed for the simulationtake the IO monad as including two operations readint and writeint which respectively read integers from stdin and write integers to stdout. Explain any differences in behaviour between assignments v1 = w and v2 = w and also between method calls v1.set(4,n) and v2.set(4,n). [4 marks] 6 CST.2016.3.7 6 Further Java (a) Describe the operation of wait() and notifyAll(). Ensure that your answer explains when locks are acquired and released. [5 marks] (ii) Estimate the running times of algorithms A and B on a 4-processor and on a 1024-processor machine, explaining how you obtain them. [3 marks] (iii) Sketch possible computation DAGs for algorithms A and B and use them to discuss the results obtained. As the number of processors in the host machine varies, is AX or BX faster?

"plain salt", and that "12/120 lb" and "142oz" are the same thing and equal to "10023g"

(and not 112213g). It would be great if once I've chosen this week's menu, it could

Show how four negative edge triggered QT-type flip-flops (FFs) with outputs

labelled QQA , QQAAC and QAD can be used to implement a ripple counter having

the specified state sequence. Show any combinational logic necessary assuming

that the FFs have asynchronous reset inputs available.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Computer Networking A Top-Down Approach

Authors: James F. Kurose, Keith W. Ross

5th edition

136079679, 978-0136079675

More Books

Students also viewed these Computer Network questions