Question
Many instruction set architectures have been augmented with SIMD (Single Instruction Multiple Data) instructions to enhance processors' performance when dealing with packed arrays such as
Many instruction set architectures have been augmented with SIMD (Single Instruction Multiple Data) instructions to enhance processors' performance when dealing with packed arrays such as those used by this application. Demonstrate how SIMD instructions could be used to optimise the loop. Assuming that 50% of the running time of the application was spent executing your previous loop implementation, estimate the program's speedup when using the SIMD optimised loop. [5 marks] 8 CST.2001.8.9 11 Numerical Analysis II (a) A cubic spline over knots x1, x2, . . . xn is defined by (x) = (x xj )yj+1 + (xj+1 x)yj dj (x xj )(xj+1 x){(dj + xj+1 x)j + (dj + x xj )j+1} 6dj for x [xj , xj+1] where dj = xj+1 xj . The spline is continuous in its first and second derivatives. (i) Find (xj ). [2 marks] (ii) Find formulae for 0 (xj ) and 0 (xj+1) for x [xj , xj+1]. [4 marks] (iii) What is 00(xj )? [2 marks] (b) Form a set of equations for computing the unknowns {j}, specifying suitable end conditions to simplify these equations. [10 marks] (c) What are the important properties of these equations with respect to their numerical solution? [2 marks] 12 Specification and Verification I (a) Describe the axioms and rules of Floyd-Hoare logic for reasoning about FOR-commands. Carefully explain any side conditions. [8 marks] (b) Let n! be the factorial of n (0! = 1 and (n + 1)! = (n + 1) n!). Give a proof of {N > 0} X := 1; FOR Y := 2 UNTIL N DO X := X Y {X = N!} [12 marks] 9 [TURN OVER CST.2001.8.10 13 Computer Vision Understanding, classifying, and identifying human faces has been a longstanding goal in computer vision. Yet because the face is an expressive social organ, as well as an object whose image depends on identity, age, pose and viewing angle, and illumination geometry, many forms of variability are all confounded together, and the performance of algorithms on these problems remains very poor. Discuss how the different kinds and states of variability (e.g. same face, different expressions; or same identity and expression but different lighting geometry) might best be handled in a statistical framework for generating categories, making classification decisions, and recognising identity. In such a framework, what are some of the advantages and disadvantages of wavelet codes for facial structure and its variability? [20 marks] 14 Computer Systems Modelling Two servers operate with different performance characteristics at mean rates 1 and 2. You wish to combine them into a single system by associating each server with a separate FIFO queue and dispatching incoming work items to the first queue with probability p1 and to the other queue with probability p2. Incoming items arrive at a rate and none are discarded from the system. You may assume that the inter-arrival-time distribution and both service-time distributions are exponential, that there is no limit on the queue lengths and that the population size is infinite. (a) Using Kendall notation, describe the first server and its queue. Construct a Markov-chain model for this part of the system.
(a) Show that the problem 3-SAT is at least as hard to solve as n-SAT. [5 marks] (b) Show that the task of finding a minimum cost closed circuit in a weighted directed graph (a Travelling Salesman Problem of the minimization variety) is at least as hard as the Hamiltonian Circuit Problem. [5 marks] (c) Show that the class NP-complete is contained in the class P-space. [5 marks] (d) Show that the class P-space is contained in the class EXP-time. [5 marks] In each case ensure that your answer makes it clear what the problems and classes involved are. Standard results do not need to be proved provided they are clearly stated. 7 CST.96.5.8 12 Semantics The abstract syntax of commands in a simple parallel programming language P is given by C ::= skip X := ie C1 ; C2 if be then C1 else C2 while be do C C1 k C2 where ie, be and X range over the syntactic categories of integer expressions, boolean expressions and program variables, respectively. The intended behaviour of C1 k C2 is that C1 and C2 are executed in parallel until they have both terminated. Hence atomic execution steps from C1 and C2 may be arbitrarily interleaved. The other command forms behave as usual. (a) Give a small-step transition semantics for P which derives statements of the form hC, Si hC 0 , S0 i, where S and S 0 are states. You may assume that rules for the evaluation of expressions have already been given. Comment briefly on your choice of what constitutes an atomic execution step. [9 marks] (b) The binary relation on commands is defined by C1 C2 S, S0 . hC1, Si hskip, S0 i hC2, Si hskip, S0 i. Show that is not a congruence. [5 marks] (c) Assuming that S(X) = S(Y ) = 0, describe the set of possible execution traces which are derivable in your semantics starting from the configuration hC, Si, where C is (X := 1) k (while X = 0 do Y := Y + 1). Why might one argue that this does not accurately reflect the behaviour of a reasonable implementation of the language?
import java.util.*;
public class ShortestJobFirst { public int process, burst, arrival;
public ShortestJobFirst(int pro, int burs, int arriv){ this.process=pro; this.burst=burs; this.arrival=arriv; } public static void Waiting_Time (ShortestJobFirst proces[], int i, int wait[]){ int rule[]= new int[i]; for (int o=0; o
int shortest=0, fTime, c=0, t=0, min=Integer.MAX_VALUE; boolean check=false;
while (c !=i) { for (int p=0; p 0)){ min=rule[p]; shortest=p; check=true; }
}
if (check != true){ t++; continue; }
rule[shortest]-- ; min=rule[shortest];
if (min ==0){ min=Integer.MAX_VALUE;
}
if (rule[shortest]== 0){ c++; check=false; fTime= t+1; wait [shortest] = fTime- proces[shortest].burst- proces[shortest].arrival;
if (wait[shortest] < 0){ wait[shortest]=0; } } t++; } }
public static void TurnAround (ShortestJobFirst proces[], int i, int wait[], int turnT[]){ for (int n=0; n< i; n++) turnT[n]= proces[n].burst + wait[n];
} public static void AverageTime(ShortestJobFirst proces [], int i){ int wait[]= new int[i], turnT[]=new int[i], totalWait=0, totalturn=0;
Waiting_Time (proces, i, wait);
TurnAround(proces, i, wait, turnT);
for (int n=0; n
totalturn = totalturn + turnT[n]; int b=0;
System.out.println("Process #" + "\t " + proces[n].process + "\t"+ proces[n].burst + "\t" + wait[n] + "\t" + turnT[n]); }
System.out.println("Average waiting time = " + (float)totalWait / (float)i);
System.out.println("Average turn around time = " +(float)totalturn / (float)i);
}
public static void main(String[] args)
{
ShortestJobFirst proc[] = { new ShortestJobFirst(1, 1, 1),new ShortestJobFirst(2, 3, 1), new ShortestJobFirst(3,8, 1), new ShortestJobFirst(7, 2, 9)};
AverageTime(proc, proc.length);
}
}
edit code and ensure that it's able to be animated
answer every question
Write method named printReverse() that accepts an int array as its parameter and prints that array in reverse order.
program to reverse an integer number by using a function called reverse. The program reads in an integer number and prints its reverse order.
Write program that prompts the user for a positive integer number and output whether the number is a palindrome or not.
Write program that reads a sequence of integers into an array and that computes the alternating sum of all elements in the array.
program that prompts the user to enter two integers and displays their sum. If the input is incorrect, prompt the user again.
I want comments on the code What are the difficulties that may be encountered when writing this program
import java.util.*;
public class Main { public static final String ALP="abcdefghijklmnopqrstuvwxyz"; public static String encryption(String ptext,int skey) { ptext=ptext.toLowerCase(); String ctext=""; for(int i=0;i
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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