DOC PREVIEW
MIT 6 826 - PROBLEM SET 3

This preview shows page 1 out of 2 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Massachusetts Institute of TechnologyDepartment of Electrical Engineering and Computer Science6.826 Principles of Computer SystemsPROBLEM SET 3Issued: Thursday, February 21, 2002 Due: Thursday, February 28, 2002The following problems explore proof techniques for showing that one module implements another module.There are two problems in this problem set; please turn in each problem on a separate sheet of paper.Also give the amount of time you spend on each problem.Problem 1. Turtle RobotA turtle robot can move freely in a two-dimensional plane. The following module specifies robot’s behavior.MODULE Turtle EXPORT Move, PositionTYPE Coord = [x: Int, y: Int]Path = SEQ CoordVAR p: Path := {}APROC Move(dx: Int, dy: Int) =<< p := p + { Coord(x:=dx, y:=dy) } >>FUNC sumdx() = + : (p * (\ coord | coord.x))FUNC sumdy() = + : (p * (\ coord | coord.y))FUNC Position() -> Cord = Coord(x:=sumdx(), y:=sumdy())The robot is controlled by an embedded processor that has limited memory.a) Write an implementation TurtleImpl that implements the Turtle specification and avoids storing theentire path of the robot.b) Prove that your TurtleImpl implements Turtle.Problem 2. Lossy MemoryConsider a memory that sometimes silently refuses to perform a write to a location. The specification ofthis memory is given by the following module, which is a modification of the Memory module on page 3 ofthe Handout 5.MODULE LMemory [A, V] EXPORT Read, Write =TYPE M = A -> VVAR m := Init()APROC Init() -> M = << VAR m’ | (ALL a | m’! a) => RET m’ >>FUNC Read(a) -> V = << RET m(a) >>APROC Write(a, v) = << m(a) := v [] SKIP >>END Memory1a) Write a write-back cache implementation LWBCache of LMemory. Assume that a write to the cachealways succeeds (provided that the cache is not full), so do not lose data when writing to the cache.Assume further that writing the data back to the underlying memory may result in writes being silentlyskipped.b) Prove that your LWBCache implements LMemory using the appropriate proof


View Full Document

MIT 6 826 - PROBLEM SET 3

Documents in this Course
Consensus

Consensus

10 pages

Load more
Download PROBLEM SET 3
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view PROBLEM SET 3 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view PROBLEM SET 3 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?