Professional Documents
Culture Documents
Reason:
Events are asynchronous which means code subscribing has to deal with concurrency
issues.
Q2. Suppose you are designing a security system for your home. One aspect of the system is that
whenever the door is opened a camera takes the picture of the person who enters and gives it to a
module which does the job of face recognition that whether the person is a resident or an
intruder. There are three components of the system: a switch which is closed when door is
opened: a camera: and a face recognition module. What would be the communication
infrastructure between the following (please explain your answers) (2 + 2 )
Explanation:
Since people entering and leaving is an infrequent operation with no pre determined
cycles which means events are best suited for this scenario.
Explanation:
Once the camera has received the event it can invoke the face recognition module using
ordinary rpc calls
Q3. While evaluating two network file systems for a project your team member runs the
following code for both file systems
Code = CreateFile(“test.txt”)
If(Code == Success) then
DeleteFile(“test.txt”)
Code = FileExists(“test.txt”)
If(Code == Success ) then
// What ?? The file should be deleted
Endif
Endif
After running the code several times for each file system your team member is confused and
turns to you, the wise one, to explain some unexpected results from his tests (2 + 2)
a. For file system 1 sometimes the call to DeleteFile throws an exception that the file does
not exist. What is going on?
The rpc mechanism used to access file system 1 uses at least once semantics
b. For file system 2 sometimes FileExists returns success even after the DeleteFile call
completed without exceptions
The rpc mechanism used to access file system 2 uses at most once semantics
Q4. It was Gamma’s big day, his third interview at Foogle Inc. Sheikhupura! He was feeling
confident till put forward the following question, after which he strongly wished that he had paid
more attention in class. Can you help him with the question?
Which consistency scheme would you use in the following distributed applications.( 1 + 1 + 1 +
1)