Fall 2009 CSE Qualifying Exam Core Subjects. September 19, 2009

Similar documents
CSE Qualifying Exam, Spring February 2, 2008

Fall 2015 CSE Qualifying Exam Core Subjects

Spring 2014 CSE Qualifying Exam Core Subjects

Spring 2013 CSE Qualifying Exam Core Subjects. March 23, 2013

CSCE 212: FINAL EXAM Spring 2009

Spring 2010 CSE Qualifying Exam Core Subjects. March 6, 2010

Spring 2011 CSE Qualifying Exam Core Subjects. February 26, 2011

Fall 2016 CSE Qualifying Exam CSCE 531, Compilers

CS 433 Homework 4. Assigned on 10/17/2017 Due in class on 11/7/ Please write your name and NetID clearly on the first page.

8.1 Polynomial-Time Reductions

CS/ECE 374 Fall Homework 1. Due Tuesday, September 6, 2016 at 8pm

4.1 Introduction 4.3 Datapath 4.4 Control 4.5 Pipeline overview 4.6 Pipeline control * 4.7 Data hazard & forwarding * 4.

The levels of a memory hierarchy. Main. Memory. 500 By 1MB 4GB 500GB 0.25 ns 1ns 20ns 5ms

CSCE 531 Spring 2009 Final Exam

RYERSON POLYTECHNIC UNIVERSITY DEPARTMENT OF MATH, PHYSICS, AND COMPUTER SCIENCE CPS 710 FINAL EXAM FALL 96 INSTRUCTIONS

Computer Architecture CS372 Exam 3

2068 (I) Attempt all questions.

Question Bank. 10CS63:Compiler Design

Chapter 8. NP and Computational Intractability. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

CSE P 501 Exam 8/5/04

The Memory Hierarchy. Cache, Main Memory, and Virtual Memory (Part 2)

CS232 Final Exam May 5, 2001

CSE Computer Architecture I Fall 2011 Homework 07 Memory Hierarchies Assigned: November 8, 2011, Due: November 22, 2011, Total Points: 100

Write only as much as necessary. Be brief!

ECE 3055: Final Exam

Final Exam Fall 2007

Exercises Computational Complexity

University of Nevada, Las Vegas Computer Science 456/656 Fall 2016

! Greed. O(n log n) interval scheduling. ! Divide-and-conquer. O(n log n) FFT. ! Dynamic programming. O(n 2 ) edit distance.

ALGORITHMS EXAMINATION Department of Computer Science New York University December 17, 2007

CSE 582 Autumn 2002 Exam 11/26/02

Problems and Solutions to the January 1994 Core Examination

1. [5 points each] True or False. If the question is currently open, write O or Open.

Cache Optimization. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

CPSC 313, Summer 2013 Final Exam Date: June 24, 2013; Instructor: Mike Feeley

UNIT I (Two Marks Questions & Answers)

ECE331: Hardware Organization and Design

R10 SET a) Construct a DFA that accepts an identifier of a C programming language. b) Differentiate between NFA and DFA?

EECS 470 Midterm Exam Fall 2006

(VERSION WITH ANSWERS) CORE EXAMINATION Department of Computer Science New York University September 26, 2008

Theory of Computations Spring 2016 Practice Final Exam Solutions

Example of a Demonstration that a Problem is NP-Complete by reduction from CNF-SAT

Theory Bridge Exam Example Questions Version of June 6, 2008

ECE 411, Exam 1. Good luck!

! Greed. O(n log n) interval scheduling. ! Divide-and-conquer. O(n log n) FFT. ! Dynamic programming. O(n 2 ) edit distance.

CMPUT 101 with Solutions Quiz 2 (50 minutes) November 16, 2000

Cache Memory and Performance

Chapter 5. Large and Fast: Exploiting Memory Hierarchy

ELE 375 Final Exam Fall, 2000 Prof. Martonosi

3Introduction. Memory Hierarchy. Chapter 2. Memory Hierarchy Design. Computer Architecture A Quantitative Approach, Fifth Edition

MidTerm Papers Solved MCQS with Reference (1 to 22 lectures)

CS 406/534 Compiler Construction Putting It All Together

CSE 141 Spring 2016 Homework 5 PID: Name: 1. Consider the following matrix transpose code int i, j,k; double *A, *B, *C; A = (double

COSC 6385 Computer Architecture - Memory Hierarchy Design (III)

Final Exam Fall 2008

Main Memory and the CPU Cache

ECE 468/573 Midterm 1 September 30, 2015

OPEN BOOK, OPEN NOTES. NO COMPUTERS, OR SOLVING PROBLEMS DIRECTLY USING CALCULATORS.

/ : Computer Architecture and Design Fall Final Exam December 4, Name: ID #:

registers data 1 registers MEMORY ADDRESS on-chip cache off-chip cache main memory: real address space part of virtual addr. sp.

HW1 Solutions. Type Old Mix New Mix Cost CPI

NP-Completeness. Algorithms

ECE 468/573 Midterm 1 October 1, 2014

W4231: Analysis of Algorithms

Boolean Representations and Combinatorial Equivalence

CSC-461 Exam #2 April 16, 2014

Lecture 7: Counting classes

CSCI Compiler Design

c. What are the machine cycle times (in nanoseconds) of the non-pipelined and the pipelined implementations?

Memory Hierarchies. Instructor: Dmitri A. Gusev. Fall Lecture 10, October 8, CS 502: Computers and Communications Technology

CS 374 Fall 2014 Homework 2 Due Tuesday, September 16, 2014 at noon

Reducing Hit Times. Critical Influence on cycle-time or CPI. small is always faster and can be put on chip

1. Consider the following program in a PCAT-like language.

RYERSON POLYTECHNIC UNIVERSITY DEPARTMENT OF MATH, PHYSICS, AND COMPUTER SCIENCE CPS 710 FINAL EXAM FALL 97 INSTRUCTIONS

Searching Algorithms/Time Analysis

Q1: Finite State Machine (8 points)

CS/CoE 1541 Exam 2 (Spring 2019).

Algorithm Performance Factors. Memory Performance of Algorithms. Processor-Memory Performance Gap. Moore s Law. Program Model of Memory I

Decision Procedures. An Algorithmic Point of View. Decision Procedures for Propositional Logic. D. Kroening O. Strichman.

COSC 6385 Computer Architecture - Memory Hierarchies (II)

(DMTCS 01) Answer Question No.1 is compulsory (15) Answer One question from each unit (4 15=60) 1) a) State whether the following is True/False:

Chapter 5A. Large and Fast: Exploiting Memory Hierarchy

ECEN/CSCI 4593 Computer Organization and Design Exam-2

Main Memory Supporting Caches

Reductions. Linear Time Reductions. Desiderata. Reduction. Desiderata. Classify problems according to their computational requirements.

CT32 COMPUTER NETWORKS DEC 2015

LRU. Pseudo LRU A B C D E F G H A B C D E F G H H H C. Copyright 2012, Elsevier Inc. All rights reserved.

Computer Systems Architecture I. CSE 560M Lecture 18 Guest Lecturer: Shakir James

THE HONG KONG UNIVERSITY OF SCIENCE & TECHNOLOGY Computer Organization (COMP 2611) Spring Semester, 2014 Final Examination

CS161 Design and Architecture of Computer Systems. Cache $$$$$

SAT-CNF Is N P-complete

Memory Technology. Caches 1. Static RAM (SRAM) Dynamic RAM (DRAM) Magnetic disk. Ideal memory. 0.5ns 2.5ns, $2000 $5000 per GB

CSE 401 Midterm Exam 11/5/10

Parsing III. (Top-down parsing: recursive descent & LL(1) )

Itanium 2 Processor Microarchitecture Overview

NP Completeness. Andreas Klappenecker [partially based on slides by Jennifer Welch]

Computer Architecture EE 4720 Final Examination

COSC 6385 Computer Architecture. - Memory Hierarchies (II)

MODEL ANSWERS COMP36512, May 2016

9.1 Cook-Levin Theorem

Transcription:

Fall 2009 CSE Qualifying Exam Core Subjects September 19, 2009 1

Architecture 1. It s 1997 and you re a graduate student at Stanford named Larry Page. You re trying to build a new Internet search engine and your strategy is to optimize its performance by ensuring that during a search, neither the CPU nor its disk array is idle. The search database is logically divided into 100 MB contiguous blocks. After the first block is read, the engine reads subsequent blocks while using the CPU to search the previously read block. It takes 100 ms for the CPU to search each block. You decide to use disks that each rotates at 170 revolutions/sec, has an average seek time of 8 ms, has a transfer rate of 50 MB/sec, and has a controller overhead of 2 ms. How many disks do you need in your disk array? 2. Determine the total branch penalty for a branch-target buffer assuming the penalty cycles for individual mispredictions shown below: Instruction in buffer Prediction Actual Branch Penalty cycles yes taken taken 0 yes taken not taken 2 no taken 2 no not taken 0 Make the following assumptions about the prediction accuracy and hit rate: Prediction accuracy is 90% (for instructions in the buffer) Hit rate in the buffer is 90% (for branches predicted taken) 3. You are building a system around a processor with in-order execution that runs at 4 GHz and has a CPI of 0.7 excluding memory accesses. The only instructions that read or write data from memory are loads (20% of all instructions) and stores (5% of all instructions). The memory system for this computer is composed of a split L1 cache that imposes no penalty on hits. Both the I-cache and D-cache are direct-mapped and hold 64 KB each. The I-cache has a 1% miss rate and 64-byte blocks and the D-cache is write-through with a 7% miss rate and 16-byte blocks. There is a write buffer on the D-cache that eliminates stalls for 95% of all writes. The 12 MB write-back, unified L2 cache has 64-byte blocks and an access time of 15 ns. It is connected to the L1 cache by a 128-bit data bus that runs at 266 MHz and can transfer one 128-bit word per bus cycle. Of all memory references sent to the L2 cache in this system, 80% are satisfied without going to main memory. Also, 50% of all blocks replaced are dirty. The 128-bit-wide main memory has an access latency of 30 ns, after which any number of bus words may be transferred at the rate of one per cycle on the 128-bit-wide 133 MHz main memory bus. 2

(a) What is the average memory access time for instruction accesses? (b) What is the average memory access time for data reads? (c) What is the average memory access time for data writes? (d) What is the overall CPI, including memory accesses? 3

Compilers 1. LR-Parsing (a) Give definitions of FIRST(α) and FOLLOW(X). (b) Consider the following grammar G: S S S V = E S E S V V id V E E V For the grammar G above generate six of the LR(1) sets of items. (c) Using the partial Sets-of-Items constructed in part (b) construct as much as you can of the parse table. (d) Describe in detail how the LR Parsing Algorithm will proceed when the state is s, the next token is t and the stack contents is X 0, X 1,..., X top1, X top. 2. Middle exit loop Provide semantic actions for the middle break loop, which has the following syntax: S loop L 1 until B L 2 endloop ; When the loop is entered, statement list L 1 is executed before the termination test B. If B evaluates to true, then the loop exits. If not, execution proceeds with statement list L 2 and then with L 1 before testing B again. 4

3. The following fragment of intermediate code was generated by a compiler: 1 LabelA: i = 1000 2 sum = 0 3 LabelB: j = 1000 4 k = 1000 5 LabelC: t1 = j * 4000 6 t2 = i * 4 7 t3 = t1 + t2 8 t4 = a[t3] 9 if t4 < 0 goto LabelE 10 sum = sum + t4 11 goto LabelF 12 LabelD: k = k - 1 13 if k > 0 goto LabelC 14 LabelE: sum = sum - t4 15 LabelF: j = j - 1 16 if j > 0 goto LabelC 17 i = i - 1 18 if i > 0 goto LabelB 19 LabelG: no op Assume that the only entry point is at LabelA. (a) Decompose the code into basic blocks. (b) Draw the control flow graph and identify any unreachable code if there is any. (c) Describe the liveness of each variable just before each line in the block containing statement 9 assuming that only i, j, k, t4, and sum are live after 9. (d) Describe any simplifying tranformations that can be performed on the code (i.e., transformations that preserve the semantics but improve the code). 5

Algorithms 1. Suppose T (n) is a positive-valued function defined for all positive integers n and satisfying the recurrence ( ) ( ) 2 3 T (n) = T 3 n + T 4 n + n 2. Using the tree method, show that T (n) = Ω(n t ) for some real constant t > 2. (Note: floors or ceilings in the recursive arguments don t affect the asymptotics.) [Hint: You may find the following fact useful at some point: a log b c = c log b a for any a, b, c > 0 such that b 1.] 2. Describe Breadth First Search (BFS) precisely. Show that running BFS starting at a node v V in a digraph G = (V, E) visits nodes in ascending order of (unweighted) distance from v. 3. We will say that a Boolean formula ϕ in conjunctive normal form is majority satisfiable if there is a truth assignment to the variables of ϕ so that at least half of the literals in each clause are true. Show that the MAJORITY SATISFIABILITY problem ( Given ϕ in CNF, is it majority satisfiable? ) is NP-hard by giving a polynomial reduction (Karp reduction) from the problem 3-CNF-SAT. Is this problem in NP? Explain. 6

Theory 1. Let x and y be any two strings. A merge of x and y is any string obtained by merging the symbols of x with those of y in some arbitrary way, maintaining the order of the symbols from each string. More exactly, if x = m and y = n, then a string z = z 1 z k is a merge of x and y if and only if k = m + n, there exist 1 i 1 < i 2 < < i m k such that x = z i1 z i2 z im, there exist 1 j 1 < j 2 < < j n k such that y = z j1 z j2 z jn, and {i 1,..., i m } {j 1,..., j n } =. For example, there are five different merges of the strings ab and bc: abbc abcb babc bacb bcab Let A and B be any languages over the same input alphabet Σ. Define A merge B := {z Σ z is a merge of some x A and some y B}. Show that if A and B are regular, then so is A merge B. [Hint: Given a DFA for A with r many states and an DFA for B with s many states, you can construct an NFA for A merge B with rs many states.] 2. Let A and B be any Turing-recognizable languages. Show that there exist languages  and ˆB such that  and ˆB are both Turing-recognizable,  A, ˆB B,  ˆB = A B, and  ˆB =. (Notice that setting  := A and ˆB := B A satisfies the last four criteria above but not the first, because B A might not be Turing-recognizable.) [Hint: Take a TM for A and a TM for B and run them simultaneously on the same input.] 3. Show that if a Turing machine M runs using space O(n) on inputs of length n and halts on all inputs, then M runs in time 2 O(n). 7