final - Final Exam CMSC 433 Programming Language...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Final Exam CMSC 433: Programming Language Technologies and Paradigms December 16, 2010 Name Instructions Important • Two times you may write Punt on any part of a question and receive five points. Thus if you punt a 10-point question, you will only receive 5 points for it. • Do not start until told to do so! Routine • This exam has 16 pages (including this one); make sure you have them all. • Pages 10 and 16 are blank, to use as scratch paper if you need it. • You have 120 minutes to complete the exam • The exam is worth 110 points. Allocate your time wisely: some hard questions are worth only a few points, and some easy questions are worth a lot of points. • If you have a question, please raise your hand and wait for the instructor. • You may use the back of the exam sheets if you need extra space. • Write neatly and clearly indicate your answers . Question Points Score Short Answer 30 Java Concurrency 30 Erlang 25 Erlang Servers & DSU 15 Parallelization 10 Total 110 Enjoy your break! 1. (Short Answer, 30 points) (a) (5 points) When writing a Java program you have the option of using one of two styles of thread-safe collection: a concurrent collection , like ConcurrentHashMap , or a synchronized collection , like one returned from Collections.synchronizedMap . Give a benefit of each. A concurrent collection allows multiple threads to be reading/modifying it in parallel, whereas a synchronized collection does not. On the other hand, it is hard to make compound operations atomic (e.g., of the flavor read-modify-write), since you cannot use client-side locking. (b) (5 points) Give one reason why it is hard to test multithreaded programs. The main problem is nondeterminism from scheduling. For example, one run of the program might reveal a data race, but subsequent runs do not, making the bug hard to track down. (c) (5 points) What problem does volatile solve? It solves the visibility problem . The Java Memory Model does not ensure sequential consistency, so an unsynchronized write to a field by one thread may not be seen by a subsequent read from that field from another thread. Using volatile restores sequential consistency for the given field. 2 (d) (5 points) MapReduce is inspired by functional programming, and the Map and Reduce are supposed to be “functional” or “not have side effects,” such as changing static fields or writing output other than via Context . Give an advantage of this restriction. The results produced by a mapper or reducer are deterministic: they are purely a func- tion of the inputs. Therefore if a node running one of these tasks crashes it is easy to restart the computation on a different node, somewhere else....
View Full Document

Page1 / 16

final - Final Exam CMSC 433 Programming Language...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online