CS 4504 Lecture Notes - Lecture 4: Application Programming Interface, Distributed Computing

46 views2 pages
7 Sep 2016
School
Course
Page:
of 2
Distributed Computing Chapter 2
Dr. Bobbie
August 22, 2016
Interprocess Communication
Interprocess communications (IPC) is the backbone of distributed computing.
IPC – the functionality for separate processes to communicate with each other among themselves to
collaborate on a task.
Process is a runtime representation of a program.
An IPC application program interface (API) expanded to application programming interface gives a
programming knowledge and logic to create IPC:
Send – this command is issued by a process to send data.
Receive – this command is issued by a process to accept data.
Connect – there must be a connection and a protocol between sending process and accepting process.
Disconnect – a logical connection is cut off.
Example of a pc and a server communication order
1. Pc tries to makes a connection
2. Server receives the request
3. Server sends a request
4. Pc makes a connection
5. Pc receives a request from a server
6. Pc sends a response
7. Server send’s a response
8. Pc disconnects
9. Server disconnects
Event Synchronization
It is important to synchronize events in order for the system to function properly. One ways to
ensure this is blocking. Certain events will be stopped till the issued command by the process will be
completed. The blocking is being managed by os.
Blocking operations are also called Synchronous operations.
Asynchronous means a non-blocking operation.
find more resources at oneclass.com
find more resources at oneclass.com
4 Types of synchronization:
1. Synchronous send and synchronous receive
oReceive operation on pc 2 is suspended and sending process on pc 1 is suspended till pc
2 receives full data and sends acknowledgement.
2. Asynchronous send and synchronous receive
oReceive operation on pc 2 is suspended, however the send process is never stopped and
doesn’t require an acknowledgement from pc 2.
3. Synchronous send and asynchronous receive
oScenario 1. Data on the pc 2 (receive process) was already delivered and pc 2 sends
acknowledgement to process 1 to unblock it.
oScenario 2. Data for the process 2(receive) is not delivered. Process is to responsible to
send more requests for process 1 to send data again. Process 1 is suspended till prices 2
issues send command again.
oScenario 3. Process 2 is waiting for the data. The IPC of the host 2 have to notify process
2 that the data has arrived. This requires from the process 2 to provide listener methods
to perform this ability.
4. Asynchronous send and asynchronous receive
oWithout blocks data will be only received if the IPC retains the data then IPC will notify
process about data’s arrival.
Timeouts and Threading
Blocking provides a tool for IPC to synchronize events. However, blocking a process is generally not the
best solution. We have another tools problem.
Timeouts – a set break for the process to finish the command.
Spawn a child or a thread – a process may spawn a child to complete a certain task so that the main
process may finish his main task.
Deadlock – improper programming, misunderstood commands causes a permanent block of an
event/process.
find more resources at oneclass.com
find more resources at oneclass.com