Sei sulla pagina 1di 5

AACS5164 Distributed Computer Systems

Tutorial 3

Tutorial 3
Instructions
1. Read through Chapter 3 when you answer these questions. 2. You must try to answer all the questions before or during your tutorial class. 3. If you have any problems, ask the tutor or discuss with your classmates. 4. Attempting these questions yourself will help you learn the material. IF YOU JUST COPY ANSWERS, YOU WILL NOT LEARN ANYTHING.

Q1. Describe an application scenario where a program requires synchronous communication and asynchronous communication respectively.
Synchronous Blocking is mean direct communication, where all parties involved in the communication are present at the same time Eg: chess box game Asynchronous non-blocking is meaning the communication does not require all parties available at the same time. Eg: MSN Application Scenario Communication by Using MSN (Window Live Messenger) Synchronous communication If person A send a message to B by using MSN and B is online and direct response to A. Asynchronous communication If person A send a message to B by using MSN, but B is not online, then the message will be delivered to B when B is online. B may online when A is offline.

Q2. Describe how you might simulate nonblocking message passing with blocking primitives.
MSN both party can write message as the same time and send to each other. We use MSN Messenger as example. The scenario is when a sender wants to send a file to his friend (receiver). Firstly, the sender sent a request message to receiver to request for permission to send the file to the receiver. The sender cannot perform the next process without receiving the return message from the receiver. After the receiver accepted his request to send file, then only the sender can perform the sending process. This is so called the blocking primitives. So, the sender sends the file, byte by byte to the receiver. He does not need to wait till the bytes of data of that file are completely transferred. He can keep on sending byte by byte of data through the internet to the receiver. The process can known as non-blocking message passing with blocking primitives. Another example, we can use phone call to simulate non-blocking message passing with blocking primitives. Firstly, the caller dials the phone to talk with receiver. He cannot start talking until the receiver pick up the phone to answer the call. After receiver pick up the phone, then only he can talk to the receiver. He can talk as long as he wants no matter the receiver is still listening or not. This process also can be called non-blocking message passing with blocking primitives.

Q3. Describe a use for each of the following message-passing address categories. a) One-to-one addressing - SMS, phone call, one sender one receiver b) One-to-many addressing SMS, EMAIL c) Many-to-one addressing file sharing(safe assign) d) Many-to-many addressing Chat room, online game, social network

-sh-

AACS5164 Distributed Computer Systems

Tutorial 3

Q4. Discuss the relative pros and cons of pipes versus sockets.

-sh-

AACS5164 Distributed Computer Systems

Tutorial 3

Pipes
Allow two processes to communicate through a finite size buffer implemented by the kernel. Data communication is stored in first-in-first-out (FIFO) order. Provide one-to-one communication. Are considered synchronous.

Interprocess Communication using Pipes Example: Unix Command Shell

Keyboard

Terminal Screen LS WC Sender

Synchronous

Receiver

Sockets
Managed by a transport service. Exists until every process referring to it dies or a process closes the socket.

O O O
Computer Process Communication Using Sockets Pipes Pros: - Half duplex one way - More faster - No network delay Cons: - Smaller range in one machine - Can not work across to another system. - cannot connect over the network Sockets Pros: - Full duplex two way - Wider range - can over the network Cons: - Encounter network will be delay. - Slower compare to Pipes.

Server

-sh-

AACS5164 Distributed Computer Systems

Tutorial 3

Q5. There are TWO (2) methods for a process to realize that it should no longer be blocked in a blocking primitive, which one is not desirable for real time system? Discuss it. Polling and interrupt. Polling is not suitable to use because polling need to do checking on the
buffer. The response time not suitable to us in less than 1 minute because polling will delay to keep checking the buffer see whether the buffer have data or not.

Q6. In the world of computers, which type of Interprocess Communications (IPCs) is perhaps the most powerful mechanism for interprocess communication due to the level of control provided to the programmer? Discuss all the related steps to perform it based on your choice above mentioned. Socket- create socket, binding socket, listen, and accept communication 7)(a) Remote Procedure Calls (RPCs) call semantics determine what happens to a repeat procedure call. Describe the FOUR (4) popular RPCs call semantics.
1. At-Most-once Client sends many times to call, maybe got delay, but server only can execute one time that request client call.

2. At-least-once Server accepts many the call, cannot guarantee server receive all, but server can guarantee the system consistence of the (return value must same) of the request. But does not know which of the client send request. 3. Last-of-many-call The client can make many call to server, server also can run many call by client. Server may reply different result back to client, client will choose the last result because is most update based on identified. Each of the RPC call have unique identifier, the server execute it and return the value to the particular clients requested. The server knows each of the requests is belong to which client base on the identifier. 4. Idempotent Guess type, server cannot guarantee how many RPC call can make by the client and server cannot guarantee have many call it can execute, but the result return back to client must guarantee in the correct result.

(8 marks) (b)For efficient communication to take place, the 3 basic parameters and larger data structures must employ RPCs marshalling. (i)What are the THREE (3) basic parameters? (3 marks) Input only (similar to call-by-value) -The values pass in from client to server. Output only (pass information from server to client) -The result return from server to client.

-sh-

AACS5164 Distributed Computer Systems

Tutorial 3

Input and output (client pass information to server, server use same parameter to pass info. to client. Similar to call-by-value. ) - input value in the server, server return result to client (ii) What is marshalling? (2 marks) Marshalling is a process involves flattening or packing the information in a compact manner to minimize the amount of information sent across the network. More simple to send out to receiver. Process of, minimize size of the data to let server easily send data through the faster speed of translation.

(iii) How is marshalling utilized in a Remote Procedure Calls stubs? Support your answer with an aid of diagram.

Almost similarity to pack and unpack format during client send to server. Client pack the data and send to server, server do for unpack data to read data. Same process for server send back data after done process and read through the data, it pack and send to client back. Client will unpack again get the result.

(8 marks)

-sh-

Potrebbero piacerti anche