TOPICS FOR THE COP 4020 EXAM on The Message Passing Model $Date: 2013/04/14 01:08:00 $ This exam covers topics from homework 6, including the the message passing model, and related programming techniques in Erlang. This exam is related to all the course objectives. REMINDERS The exam will be open book, open notes. (Warning: don't expect to learn the material during the exam, you won't have time! A good idea for studying is to condense your notes to a few pages of ready reference materials. We suggest that you memorize the Oz syntax you'll need.) If you need more space, use the back of a page. Note when you do that on the front. Before you begin, please take a moment to look over the entire test so that you can budget your time. Clarity is important; if your programs are sloppy and hard to read, you may lose some points. Correct syntax also makes a difference for programming questions. We will take some points off for duplicated code, code with extra unnecessary cases, or code that is excessively hard to follow. You will lose points if you do not follow the grammar when writing programs! You should always assume that the inputs given will follow the grammar for the types specified, and so your code should not have extra cases for inputs that do not follow the grammar. When you write Erlang code on this test, you may use anything that is built-in to Erlang and the modules lists and ets. You are encouraged to define functions not specifically asked for if they are useful to your programming; however, if they are not built-in to Erlang/OTP, then you must write them into your test. (Note that you can use built-in functions such as lists:map/2, lists:foldr/3, lists:filter/2, etc.) READINGS See the readings recommended in homework 6. If you have time, study the relevant examples form the Code examples Web page. Also if you have time, and try the old exams (but note that some problems that are relevant to this exam (especially those related to homework 6) were on exam 4 in semesters that had 4 exams). TOPICS In the following, I use + to denote relatively more important topics, and - to denote relatively less important topics. Topics marked with ++ are almost certain to be on the exam. All of these are fair game, but if you have limited time, concentrate on the ones that are more important first (and in those, the ones you are most uncertain about). SKILLS [UseModels] [Concepts] [MapToLanguages] + Functional programming ++ Be able to write functional programs in Erlang (HW6: filterInside, newaddress, eventdetector) + Give the output of an Erlang expression involving processes + process communication and synchronization: ++ Implement an RPC style protocol to communicate between 2 processes (HW6: future, box, ebay) ++ Use asynchronous message passing in Erlang to implement servers (HW6: eventdetector) + message passing and ports: + How do you create and use a process? (HW6: future, box, ebay, eventdetector) + How can you get information out of a process? (HW6: future, box, ebay, eventdetector) ++ Write a stateless server. (HW6: future) ++ Write a server that has its own state. (HW6: box, ebay, eventdetector) TERMS AND CONCEPTS [Concepts] [MapToLanguages] [EvaluateModels] You should be able to explain and use (in problems or essays) the following concepts (with appropriate comparisons to related concepts). You should be able to give examples of these concepts. + processes: + What features in Erlang create and work with processes? - Given a sample program, say what possible orders of execution it has. - What happens when there is an unhandled exception in a process? (HW6: future) + Semantic concepts + What is interleaving? - What is a race condition? + What is message passing? What about it is asynchronous? - How would you explain the semantics of mailboxes in Erlang? + How does Erlang's receive work? How do after timeouts work? + Can processes and message passing be used to simulate mutable storage? + Can process have time-varying state in Erlang? + Are message executed concurrently by an Erlang server? - What is an agent? + What is a protocol? COMPARISONS [Concepts] [MapToLanguages] [EvaluateModels]: - Comparison among programming models: - What makes a model or style of programming declarative? - What does declarativeness have to do with determinism (or referential transparency)? - Is programming with state declarative? Why or why not? - Can a program that uses state be declarative? - What are two ways to read a declarative program? - What are the advantages of declarative programming? - Can we do everything efficiently with the declarative model? What can't be done efficiently? - What problems are hard to modularize in the declarative model? - Is the real world declarative? - What is the difference between declarative and imperative programming? - message passing model: - Explain what can be programmed with message passing that cannot be programmed in the delcarative model - Why is message passing important? - Why can't we program servers in pure Haskell? - How and when should message passing and processes be used? - Explain what can be programmed with message passing that cannot be programmed in the declarative model. - What are the relative advantages and disadvantages of using the message passing vs. the declarative model for solving problems? - What are the features of Erlang that make it interesting? - What is useful about Erlang's combination of features? +general + What programming style is best suited for what kinds of problems? + What are the advantages of each style of programming for making programming easier? + What is the difference between declarative and imperative programming? - What are the advantages of explicit state? - How does explicit state help abstraction? Encapsulation? + What are the goals of declarative programming? + What are the goals of message passing programming? + What makes a model or style of programming declarative? + What does declarativeness have to do with referential transparency? - Is programming with state declarative? Why or why not?