This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: CSE4/586 (Spring 2009): Final Closed books and notes. There are 10 questions. The duration is for 2 hours. Good luck. Name: 1. Predicate logic (10 points) Mark the following predicates as True or False. • T [ P ⇒ Q ≡ ¬ P ∨ Q ] • T [ ¬ P ∧ ¬ Q ≡ ¬ ( P ∨ Q ) ] • F [ P ⇒ Q ≡ ¬ P ⇒ ¬ Q ] • T [ ¬ P ∨ Q ≡ P ∧ Q ≡ P ] • T [ P ∧ Q ⇒ P ∨ Q ] • T [ ( P ⇒ R ) ∧ ( ¬ P ⇒ R ) ≡ R ] • T [ P ∨ ( Q ∧ R ) ⇒ P ∨ Q ] • T [ ( ∀ x : R : P ) ≡ ( ∀ x : R ⇒ P ) ] • T [ ¬ ( ∃ x : R : P ) ≡ ( ∀ x : R : ¬ P ) ] • T [ ( ∃ x : R : ¬ P ) ≡ ¬ ( ∀ x : R : ¬ P ) ] 2. Program properties (10 points) Mark the following as True or False. • T P next R ∧ Q next R ⇒ ( P ∧ Q ) next R • T invariant.P ∧ transient. ( P ∧ ¬ Q ) ⇒ P ( P ∧ Q ) • F stable.P ∧ stable.Q ∧ ( R ⇒ P ∧ Q ) ⇒ stable.R • F stable. ¬ P ⇒ stable.P • T P Q ∧ Q R ⇒ P R • F ( P ¬ P ) ≡ transient.P • F A state is an invariant state of a program iff no program action is enabled in that state. 1 P1 P2 P3 P1.1 P1.2 P1.3 P1.4 P2.1 P2.2 P2.3 P2.4 P2.5 P3.1 P3.2 P3.3 P3.4 P3.5 Figure 1: Timeline for P1, P2, and P3 3. Logical time (10 points) Answer the following questions using Figure 1. 1. (3 points) List all the events e such that P2.1 “happened before” e . Then, list all the events f that are “concurrent” with P2.1. { P2.2, P2.3, P2.4, P2.5, P3.4, P3.5, P1.3, P1.4 } { P1.1, P1.2, P3.2, P3.3 } 2. (3 points) Assign timestamps to all the events in accordance with the vector clock algorithm. Initially, all the local clocks begin with 0. (Scribe on the figure.) 3. (2 points) Show all the transitless (no message in transit) consistentcuts that pass through P1.3. To show a cut just list the events on the consistentcut. { P1.3, P2.4, P3.4 } { P1.3, P2.5, P3.5 } 4. (2 points) Show a consistent cut that passes through P1.3 and P3.3. None, because P3.3 happenedbefore P1.3 4. Reasoning about programs (15 points) Consider line segments l 1 ,l 2 ,l 3 ,...,l n on the Xaxis. Each line segment has two variables a and b to denote the two endpoints of the line. (So, for line segment l j , l j .a and l j .b denote the endpoints of lj on the Xaxis.) Assume all 2 * n endpoints are unique, and initially for all line segments l j , l j .a < l j .b . You are asked to perform the following action repeatedly (i.e., over and over as long as possible): Pick two line segments, say l j and l k . If l j and l k overlap with each other, then swap any one endpoint of l j with any one endpoint of l k , thus making l j and l k nonoverlapping....
View
Full
Document
This note was uploaded on 01/04/2010 for the course CSE 123 taught by Professor Qwerty during the Spring '09 term at École Normale Supérieure.
 Spring '09
 qwerty

Click to edit the document details