Review Questions on Chapter IV—IPC COSC 4330/6310 Summer 2013.
-
Upload
britton-hunt -
Category
Documents
-
view
217 -
download
0
Transcript of Review Questions on Chapter IV—IPC COSC 4330/6310 Summer 2013.
Review Questions onReview Questions onChapter IV—IPC Chapter IV—IPC
COSC 4330/6310COSC 4330/6310
Summer 2013Summer 2013
First QuestionFirst Question
How can you implement the How can you implement the at most at most onceonce semantics in a remote procedure semantics in a remote procedure call package?call package?
First QuestionFirst Question
How can you implement the How can you implement the at most at most onceonce semantics in a remote procedure semantics in a remote procedure call package?call package?
By adding sequence numbers to all By adding sequence numbers to all client requests and instructing the client requests and instructing the server to ignore requests with server to ignore requests with duplicate serial numbersduplicate serial numbers
First QuestionFirst Question
What is the major advantage of What is the major advantage of atomic atomic transactionstransactions? ?
First QuestionFirst Question
What is the major advantage of What is the major advantage of atomic atomic transactionstransactions??
They either execute correctly orThey either execute correctly ornot at allnot at all
• We do not have to worry about We do not have to worry about partial executions or duplicate partial executions or duplicate executions executions
First QuestionFirst Question
How can you simulate a How can you simulate a blocking receiveblocking receive primitive using a primitive using a non-blocking receivenon-blocking receive ? ?
First QuestionFirst Question
How can you simulate a How can you simulate a blocking receiveblocking receive primitive using a primitive using a non-blocking receivenon-blocking receive ? ?
By doing a By doing a busy waitbusy wait
while (receive(…) == NO_MSG);while (receive(…) == NO_MSG);
First QuestionFirst Question
What is the major advantage of streams What is the major advantage of streams over datagrams? over datagrams?
First QuestionFirst Question
What is the major advantage of streams What is the major advantage of streams over datagrams?over datagrams?
All data are transmitted in sequence All data are transmitted in sequence and no data are damaged, lost or and no data are damaged, lost or duplicatedduplicated
First QuestionFirst Question
How do you pass a linked list to a remote How do you pass a linked list to a remote procedure?procedure?
First QuestionFirst Question
How do you pass a linked list to a remote How do you pass a linked list to a remote procedure?procedure?
You send it as an array along with You send it as an array along with instructions how to rebuild itinstructions how to rebuild it
First QuestionFirst Question
When should we worry about When should we worry about big-big-endiansendians and and little-endianslittle-endians??
First QuestionFirst Question
When should we worry about When should we worry about big-big-endiansendians and and little-endianslittle-endians??
Each time we exchange numerical Each time we exchange numerical data between two different machinesdata between two different machines
• Strings are never a problemStrings are never a problem
Second Question: True or FalseSecond Question: True or False
All UNIX message passing primitives use All UNIX message passing primitives use direct naming.direct naming.
Second Question: True or FalseSecond Question: True or False
All UNIX message passing primitives use All UNIX message passing primitives use direct naming.direct naming.
FALSE, FALSE, they use sockets and sockets are private mailboxes
Second Question: True or FalseSecond Question: True or False
Most servers use Most servers use non-blockingnon-blocking receives.receives.
Second Question: True or FalseSecond Question: True or False
Most servers use Most servers use non-blockingnon-blocking receives.receives.
FALSEFALSE, they use blocking receives, they use blocking receives
Second Question: True or FalseSecond Question: True or False
Reliable datagramsReliable datagrams guarantee that no guarantee that no message will be lost or duplicated.message will be lost or duplicated.
Second Question: True or FalseSecond Question: True or False
Reliable datagramsReliable datagrams guarantee that no guarantee that no message will be lost or duplicated.message will be lost or duplicated.
FALSE, FALSE, they only guarantee that no they only guarantee that no message will be lost or damagedmessage will be lost or damaged
• Messages can still be duplicatedMessages can still be duplicated
Second Question: True or FalseSecond Question: True or False
Making all remote procedures Making all remote procedures idempotentidempotent greatly simplifies the task of greatly simplifies the task of the RPC server.the RPC server.
Second Question: True or FalseSecond Question: True or False
Making all remote procedures Making all remote procedures idempotentidempotent greatly simplifies the task of greatly simplifies the task of the RPC server.the RPC server.
TRUE, TRUE, we do not have to worry about we do not have to worry about multiple executionsmultiple executions
Second Question: True or FalseSecond Question: True or False
In a RPC, one of the tasks of the user In a RPC, one of the tasks of the user stub is to exchange messages with the stub is to exchange messages with the user program.user program.
Second Question: True or FalseSecond Question: True or False
In a RPC, one of the tasks of the user stub In a RPC, one of the tasks of the user stub is to exchange messages with the user is to exchange messages with the user program.program.
FALSE, the user stub is in the same FALSE, the user stub is in the same address space as the user programaddress space as the user program
• It exchanges messages with the It exchanges messages with the server stubserver stub
Third QuestionThird Question
What would you need to do to simulate What would you need to do to simulate streams using datagrams? (10 points) streams using datagrams? (10 points)
Third QuestionThird Question
What would you need to do to simulate What would you need to do to simulate streams using datagrams? (10 points)streams using datagrams? (10 points)
Use positive acknowledgments to ensure Use positive acknowledgments to ensure that all messages will be delivered intact.that all messages will be delivered intact.
Attach a serial number to each message Attach a serial number to each message to detect duplicate messages and reorder to detect duplicate messages and reorder messages that arrive out-of-order.messages that arrive out-of-order.
Remove message boundariesRemove message boundaries..
Fourth QuestionFourth Question
Consider the functionConsider the function
void doubletrouble(int *one, int *two) {void doubletrouble(int *one, int *two) {*one += *one; *one += *one; *two += *two;*two += *two;
} // doubletrouble`} // doubletrouble`
and assume the calling sequence:and assume the calling sequence:
alpha = 10;alpha = 10;doubletrouble (&alpha, &alpha);doubletrouble (&alpha, &alpha);
Fourth QuestionFourth Question
What will be the value of alpha What will be the value of alpha after the after the callcall assuming thatassuming that
The call was a The call was a conventional conventional procedure callprocedure call??Answer:Answer: alpha = ____________ alpha = ____________
The call was aThe call was a remote procedure remote procedure callcall??Answer:Answer: alpha = ____________ alpha = ____________
Fourth QuestionFourth Question
What will be the value of alpha What will be the value of alpha after the after the callcall assuming thatassuming that
The call was a The call was a conventional conventional procedure callprocedure call??Answer:Answer: alpha = alpha = 4040
The call was aThe call was a remote procedure remote procedure callcall??Answer:Answer: alpha = ____________ alpha = ____________
Fourth QuestionFourth Question
What will be the value of alpha What will be the value of alpha after the after the callcall assuming thatassuming that
The call was a The call was a conventional conventional procedure callprocedure call??Answer:Answer: alpha = alpha = 4040
The call was aThe call was a remote procedure remote procedure callcall??Answer:Answer: alpha = alpha = 2020
Passing by reference
Caller: … int alpha; alpha = 10; doubletrouble(&alpha, &alpha); …
alphaPass TWICE theADDRESS of variable alpha
Alpha getsincrementedTWICE
Passing by value and result
Pass twice theVALUE of alpha:10 and 10
ReturnNEW VALUES:20 and 20
Caller: … int alpha; alpha = 10; doubletrouble(&alpha, &alpha); …
alpha