SlideShare a Scribd company logo
1 of 28
Lecture 2
Asynchronous and Synchronous Computation & Communication
CS-423 Parallel and Distributed Computing
Agenda
• Interprocess Communication
• IPC – Unicast and Multicast
• Interprocess Communication in Distributed Computing
• Interprocess Communication in basic HTTP
• Event Synchronization
• Synchronous vs. Asynchronous Communication
• Blocking, deadlock, and timeouts
• Using threads for asynchronous IPC
• Deadlocks and Timeouts
• Indefinite blocking due to a deadlock
• Data Representation
3
Interprocess Communications
- Exchange of data between two or more separate,
independent processes/threads.
- Operating systems provide facilities/resources for inter-
process communications (IPC), such as message queues,
semaphores, and shared memory.
- Distributed computing systems make use of these
facilities/resources to provide application programming
interface (API) which allows IPC to be programmed at a
higher level of abstraction. (e.g., send and receive)
- Distributed computing requires information to be exchanged
among independent processes.
4
IPC – unicast and multicast
• In distributed computing, two or more processes engage in IPC using a protocol
agreed upon by the processes. A process may be a sender at some points during
a protocol, a receiver at other points.
• When communication is from one process to a single other process, the IPC is
said to be a unicast, e.g., Socket communication. When communication is from
one process to a group of processes, the IPC is said to be a multicast, e.g.,
Publish/Subscribe Message model.
5
Unicast vs. Multicast
P2
P1 P1
P2 P3 P4
...
unicast multicast
m
m m m
6
Process 1 Process 2
data
sender receiver
Interprocess Communications in Distributed
Computing
7
Operations provided in an archetypal
Interprocess Communications API
•Receive ( [sender], message storage object)
•Connect (sender address, receiver address), for
connection-oriented communication.
•Send ( [receiver], message)
•Disconnect (connection identifier), for
connection-oriented communication.
8
Interprocess Communication in basic HTTP
C1 C2
S3 S4
C4
Web server
Web browser
a process
an operation
data flow
operations:
S1: accept connection
S2: receive (request)
S3: send (response)
S3: disconnect
C1: make connection
C2: send (request)
C3: receive (response)
C4: disconnect
S2
C3
S1
HTTP
request
HTTP
response
S4
Processing order: C1, S1, C2, S2, S3, C3, C4, S4
9
Event Synchronization
• Interprocess communication may require that the two processes
synchronize their operations: one side sends, then the other receives
until all data has been sent and received.
• Ideally, the send operation starts before the receive operation
commences.
• In practice, the synchronization requires system support.
10
Synchronous vs. Asynchronous Communication
• The IPC operations may provide the synchronization necessary using blocking. A
blocking operation issued by a process will block further processing of the
process until the operation is fulfilled.
• Alternatively, IPC operations may be asynchronous or nonblocking. An
asynchronous operation issued by a process will not block further processing of
the process. Instead, the process is free to proceed with its processing, and may
optionally be notified by the system when the operation is fulfilled.
11
Synchronous send and receive
process 1
running on host 1
blocking send starts
blocking send returns
blocking receive starts
blocking receive ends
execution flow
suspended period
Synchronous Send and Receive
an operation
acknowledgement of data received
provided by the IPC facility
process 2
running on host 2
Client Server
Sender Receiver
Event Diagram
12
Asynchronous send and synchronous
receive
Process 1
Process 2
blocking receive starts
blocking receive returns
execution flow
suspended period
Asynchronous Send and
Synchronous Receive
nonblocking send
operation
Event Diagram
Client Server
Sender Receiver
13
Synchronous send and Async. Receive - 1
Process 1
Process 2
nonblocking receive issued
execution flow
suspended period
Synchronous Send and
Asynchronous Receive
blocking send issued
Scenario A
transparent acknowledgement
provided by the IPC facility
Data from P1 was received by P2
before issuing a non-blocking receive op in P2
14
Synchronous send and Async. Receive - 2
indefinite
blocking
Process 1
Process 2
nonblocking receive issued
and returned immediately
execution flow
suspended period
Synchronous Send and
Asynchronous Receive
blocking send issued
Scenario B
Process 1
Process 2
Data from P1 arrived to P2 after P2 issued a
non-blocking receive op
15
Synchronous send and Async. Receive - 3
Process 1
Process 2
nonblocking receive issued
and returned immediately
execution flow
suspended period
Synchronous Send and
Asynchronous Receive
blocking send issued
Scenario C
process is notified
of the arrival of
data
transparent acknowledgement
provided by the IPC facility
Data from P1 arrived to P2 before P2 issues a non-blocking
receive op. P2 is notified of the arrival of data
16
Asynchronous send and Asynchronous
receive
Process 1
Process 2
nonblocking receive issued
and returned immediately
execution flow
suspended period
Asynchronous Send and
Asynchronous Receive
blocking send issued
Scenario C
process is notified
of the arrival of
data
Does P1 need an acknowledgement from P2?
18
Event diagram
Process A
Process B
interprocess communication
execution flow
process blocked
Event diagram for a protocol
request 1
response 1
response2
request 2
time
Synchronous send and receive
19
Sequence Diagram
Process A Process B
interprocess communication
request 1
response 1
request 2
response 2
20
Sequence diagram for a HTTP session
Process A Process B
interprocess communication
request 1
response 1
request 2
response 2
21
Blocking, deadlock, and timeouts
• Blocking operations issued in the wrong sequence can cause deadlocks.
• Deadlocks should be avoided. Alternatively, timeout can be used to detect deadlocks.
receive from process 2 issued
received from process 1 issued
process 1 blocked pending data
from process 2.
process 2 blocked pending data
from process 1.
Process 1 Process 2
P1 is waiting for P2’s data; P2 is waiting for P1’s data.
22
Using threads for asynchronous IPC
• When using an IPC programming interface, it is important to note whether
the operations are synchronous or asynchronous.
• If only blocking operation is provided for send and/or receive, then it is the
programmer’s responsibility to using child processes or threads if
asynchronous operations are desired.
process
main thread
new thread issues a blocking IPC operation
thread is blocked
thread is unblocked after the operation is fulfilled
main thread continues with
other processing
23
Deadlocks and Timeouts
• Connect and receive operations can result in indefinite blocking
• For example, a blocking connect request can result in the requesting process to be
suspended indefinitely if the connection is unfulfilled or cannot be fulfilled,
perhaps as a result of a breakdown in the network .
• It is generally unacceptable for a requesting process to “hang” indefinitely.
Indefinite blocking can be avoided by using timeout.
• Indefinite blocking may also be caused by a deadlock
24
Indefinite blocking due to a deadlock
"receive from process 2" issued;
"receive from process 1" issued;
process 1 blocked pending data
from process 2.
process 2 blocked pending data
from process 1.
Process 1 Process 2
process
executing
process
blocked
an operation
P1 is waiting for P2’s data; P2 is waiting for P1’s data.
25
Data Representation
• Data transmitted on the network is a binary stream.
• An interprocess communication system may provide the capability
to allow data representation to be imposed on the raw data.
• Because different computers may have different internal storage
format for the same data type, an external representation of data
may be necessary—standard format.
• Data marshalling is the process of (I) flattening a data structure,
and (ii) converting the data to an external representation.
• Some well known external data representation schemes are:
Sun XDR (External Data Representation)
ASN.1 (Abstract Syntax Notation One)
XML (Extensible Markup Language)
26
Data Marshalling
"This is a test."
"This is a test."
1.2 7.3 -1.5
1.2
7.3
-1.5
110011 ... 10000100 ...
marshalling
unmarshalling
1. flattening of structured data items
2. converting data to external (network)
representation
1. convert data to internal representation
2. rebuild data structures.
host A
host B
External to internal representation and vice versa
is not required
- if the two sides are of the same host type;
- if the two sides negotiates at connection.
27
Text-based protocols
• Data marshalling is at its simplest when the data
exchanged is a stream of characters, or text.
• Exchanging data in text has the additional advantage that
the data can be easily parsed in a program and displayed
for human perusal. Hence it is a popular practice for
protocols to exchange requests and responses in the form
of character-strings. Such protocols are said to be text-
based.
• Many popular network protocols, including FTP (File
Transfer Protocol), HTTP, and SMTP (Simple Mail Transfer
Protocol), are text-based.
28
Protocol
• In a distributed application, two processes perform interprocess
communication in a mutually agreed upon protocol.
• The specification of a protocol should include
(i) the sequence of data exchange, which can be described using a
time event diagram.
(ii) the format of the data exchange at each step.

More Related Content

Similar to Lecture 2 - Asynchrnous and Synchronous Computation & Communication.pptx

Lecture 1 Network Reference Models Final.pptx
Lecture 1 Network Reference Models Final.pptxLecture 1 Network Reference Models Final.pptx
Lecture 1 Network Reference Models Final.pptxRonoh Kennedy
 
Sonali Bank Network Design Project Report
Sonali Bank Network Design Project ReportSonali Bank Network Design Project Report
Sonali Bank Network Design Project ReportHasibul Islam Nirob
 
Lecture 2 data link layer 1 v1
Lecture 2 data link layer 1 v1Lecture 2 data link layer 1 v1
Lecture 2 data link layer 1 v1Ronoh Kennedy
 
Network protocols and vulnerabilities
Network protocols and vulnerabilitiesNetwork protocols and vulnerabilities
Network protocols and vulnerabilitiesG Prachi
 
Mobile computing unit-5
Mobile computing unit-5Mobile computing unit-5
Mobile computing unit-5Ramesh Babu
 
CISSP - Chapter 4 - Network Fundamental
CISSP - Chapter 4 - Network FundamentalCISSP - Chapter 4 - Network Fundamental
CISSP - Chapter 4 - Network FundamentalKarthikeyan Dhayalan
 
Mr201304 open flow_security_eng
Mr201304 open flow_security_engMr201304 open flow_security_eng
Mr201304 open flow_security_engFFRI, Inc.
 
It nv51 instructor_ppt_ch9
It nv51 instructor_ppt_ch9It nv51 instructor_ppt_ch9
It nv51 instructor_ppt_ch9newbie2019
 
Protocol layer,OSI model & POP3
Protocol layer,OSI model & POP3Protocol layer,OSI model & POP3
Protocol layer,OSI model & POP3Zakirul Islam
 
Unit 4-Transport Layer Protocols-3.pptx
Unit 4-Transport Layer Protocols-3.pptxUnit 4-Transport Layer Protocols-3.pptx
Unit 4-Transport Layer Protocols-3.pptxDESTROYER39
 
Unit 4-Transport Layer Protocols.pptx
Unit 4-Transport Layer Protocols.pptxUnit 4-Transport Layer Protocols.pptx
Unit 4-Transport Layer Protocols.pptxsarosh32
 
CN Unit 2 - cs8591.pptx
CN Unit 2 - cs8591.pptxCN Unit 2 - cs8591.pptx
CN Unit 2 - cs8591.pptxPondinesh2
 
Guarding Fast Data Delivery in Cloud: an Effective Approach to Isolating Perf...
Guarding Fast Data Delivery in Cloud: an Effective Approach to Isolating Perf...Guarding Fast Data Delivery in Cloud: an Effective Approach to Isolating Perf...
Guarding Fast Data Delivery in Cloud: an Effective Approach to Isolating Perf...Zhenyun Zhuang
 
Group 3 Presen.pptx
Group 3 Presen.pptxGroup 3 Presen.pptx
Group 3 Presen.pptxStudyvAbhi
 
20180717 Introduction of Seamless BLE Connection Migration System (SeamBlue)
20180717 Introduction of Seamless BLE Connection Migration System (SeamBlue)20180717 Introduction of Seamless BLE Connection Migration System (SeamBlue)
20180717 Introduction of Seamless BLE Connection Migration System (SeamBlue)Will Shen
 

Similar to Lecture 2 - Asynchrnous and Synchronous Computation & Communication.pptx (20)

Transport layer
Transport layerTransport layer
Transport layer
 
Lecture 1 Network Reference Models Final.pptx
Lecture 1 Network Reference Models Final.pptxLecture 1 Network Reference Models Final.pptx
Lecture 1 Network Reference Models Final.pptx
 
Sonali Bank Network Design Project Report
Sonali Bank Network Design Project ReportSonali Bank Network Design Project Report
Sonali Bank Network Design Project Report
 
Lecture 2 data link layer 1 v1
Lecture 2 data link layer 1 v1Lecture 2 data link layer 1 v1
Lecture 2 data link layer 1 v1
 
Network protocols and vulnerabilities
Network protocols and vulnerabilitiesNetwork protocols and vulnerabilities
Network protocols and vulnerabilities
 
Mobile computing unit-5
Mobile computing unit-5Mobile computing unit-5
Mobile computing unit-5
 
I2C
I2CI2C
I2C
 
CISSP - Chapter 4 - Network Fundamental
CISSP - Chapter 4 - Network FundamentalCISSP - Chapter 4 - Network Fundamental
CISSP - Chapter 4 - Network Fundamental
 
TCP/IP(networking)
TCP/IP(networking)TCP/IP(networking)
TCP/IP(networking)
 
Tcp3 wayhandshakeprocess
Tcp3 wayhandshakeprocessTcp3 wayhandshakeprocess
Tcp3 wayhandshakeprocess
 
Mr201304 open flow_security_eng
Mr201304 open flow_security_engMr201304 open flow_security_eng
Mr201304 open flow_security_eng
 
It nv51 instructor_ppt_ch9
It nv51 instructor_ppt_ch9It nv51 instructor_ppt_ch9
It nv51 instructor_ppt_ch9
 
Protocol layer,OSI model & POP3
Protocol layer,OSI model & POP3Protocol layer,OSI model & POP3
Protocol layer,OSI model & POP3
 
Unit 4-Transport Layer Protocols-3.pptx
Unit 4-Transport Layer Protocols-3.pptxUnit 4-Transport Layer Protocols-3.pptx
Unit 4-Transport Layer Protocols-3.pptx
 
Unit 4-Transport Layer Protocols.pptx
Unit 4-Transport Layer Protocols.pptxUnit 4-Transport Layer Protocols.pptx
Unit 4-Transport Layer Protocols.pptx
 
CN Unit 2 - cs8591.pptx
CN Unit 2 - cs8591.pptxCN Unit 2 - cs8591.pptx
CN Unit 2 - cs8591.pptx
 
Guarding Fast Data Delivery in Cloud: an Effective Approach to Isolating Perf...
Guarding Fast Data Delivery in Cloud: an Effective Approach to Isolating Perf...Guarding Fast Data Delivery in Cloud: an Effective Approach to Isolating Perf...
Guarding Fast Data Delivery in Cloud: an Effective Approach to Isolating Perf...
 
Group 3 Presen.pptx
Group 3 Presen.pptxGroup 3 Presen.pptx
Group 3 Presen.pptx
 
20180717 Introduction of Seamless BLE Connection Migration System (SeamBlue)
20180717 Introduction of Seamless BLE Connection Migration System (SeamBlue)20180717 Introduction of Seamless BLE Connection Migration System (SeamBlue)
20180717 Introduction of Seamless BLE Connection Migration System (SeamBlue)
 
Transport layer protocol
Transport layer protocolTransport layer protocol
Transport layer protocol
 

More from IrsaAamir1

Week 10 (2).pptx
Week 10 (2).pptxWeek 10 (2).pptx
Week 10 (2).pptxIrsaAamir1
 
Week 14 (2).pptx
Week 14 (2).pptxWeek 14 (2).pptx
Week 14 (2).pptxIrsaAamir1
 
Social Services_L03 (1).pptx
Social Services_L03 (1).pptxSocial Services_L03 (1).pptx
Social Services_L03 (1).pptxIrsaAamir1
 
Social Services_L02.pptx
Social Services_L02.pptxSocial Services_L02.pptx
Social Services_L02.pptxIrsaAamir1
 
Process_Concepts.pdf
Process_Concepts.pdfProcess_Concepts.pdf
Process_Concepts.pdfIrsaAamir1
 

More from IrsaAamir1 (6)

Week 10 (2).pptx
Week 10 (2).pptxWeek 10 (2).pptx
Week 10 (2).pptx
 
Week 9.pptx
Week 9.pptxWeek 9.pptx
Week 9.pptx
 
Week 14 (2).pptx
Week 14 (2).pptxWeek 14 (2).pptx
Week 14 (2).pptx
 
Social Services_L03 (1).pptx
Social Services_L03 (1).pptxSocial Services_L03 (1).pptx
Social Services_L03 (1).pptx
 
Social Services_L02.pptx
Social Services_L02.pptxSocial Services_L02.pptx
Social Services_L02.pptx
 
Process_Concepts.pdf
Process_Concepts.pdfProcess_Concepts.pdf
Process_Concepts.pdf
 

Recently uploaded

RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998YohFuh
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptxAnupama Kate
 
20240419 - Measurecamp Amsterdam - SAM.pdf
20240419 - Measurecamp Amsterdam - SAM.pdf20240419 - Measurecamp Amsterdam - SAM.pdf
20240419 - Measurecamp Amsterdam - SAM.pdfHuman37
 
Ukraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSUkraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSAishani27
 
Unveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystUnveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystSamantha Rae Coolbeth
 
RadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfRadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfgstagge
 
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...Pooja Nehwal
 
04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationshipsccctableauusergroup
 
Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...
Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...
Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...shivangimorya083
 
Call Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts Service
Call Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts ServiceCall Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts Service
Call Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts Servicejennyeacort
 
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Callshivangimorya083
 
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls DubaiDubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls Dubaihf8803863
 
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...Suhani Kapoor
 
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...soniya singh
 
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...Suhani Kapoor
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfLars Albertsson
 
Customer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptxCustomer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptxEmmanuel Dauda
 

Recently uploaded (20)

RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998RA-11058_IRR-COMPRESS Do 198 series of 1998
RA-11058_IRR-COMPRESS Do 198 series of 1998
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx
 
20240419 - Measurecamp Amsterdam - SAM.pdf
20240419 - Measurecamp Amsterdam - SAM.pdf20240419 - Measurecamp Amsterdam - SAM.pdf
20240419 - Measurecamp Amsterdam - SAM.pdf
 
Ukraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSUkraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICS
 
Unveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data AnalystUnveiling Insights: The Role of a Data Analyst
Unveiling Insights: The Role of a Data Analyst
 
RadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfRadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdf
 
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
 
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...{Pooja:  9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
{Pooja: 9892124323 } Call Girl in Mumbai | Jas Kaur Rate 4500 Free Hotel Del...
 
04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships
 
Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...
Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...
Full night 🥵 Call Girls Delhi New Friends Colony {9711199171} Sanya Reddy ✌️o...
 
Call Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts Service
Call Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts ServiceCall Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts Service
Call Girls In Noida City Center Metro 24/7✡️9711147426✡️ Escorts Service
 
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
 
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls DubaiDubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
 
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
 
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
High Class Call Girls Noida Sector 39 Aarushi 🔝8264348440🔝 Independent Escort...
 
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
VIP High Profile Call Girls Amravati Aarushi 8250192130 Independent Escort Se...
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdf
 
Customer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptxCustomer Service Analytics - Make Sense of All Your Data.pptx
Customer Service Analytics - Make Sense of All Your Data.pptx
 

Lecture 2 - Asynchrnous and Synchronous Computation & Communication.pptx

  • 1. Lecture 2 Asynchronous and Synchronous Computation & Communication CS-423 Parallel and Distributed Computing
  • 2. Agenda • Interprocess Communication • IPC – Unicast and Multicast • Interprocess Communication in Distributed Computing • Interprocess Communication in basic HTTP • Event Synchronization • Synchronous vs. Asynchronous Communication • Blocking, deadlock, and timeouts • Using threads for asynchronous IPC • Deadlocks and Timeouts • Indefinite blocking due to a deadlock • Data Representation
  • 3. 3 Interprocess Communications - Exchange of data between two or more separate, independent processes/threads. - Operating systems provide facilities/resources for inter- process communications (IPC), such as message queues, semaphores, and shared memory. - Distributed computing systems make use of these facilities/resources to provide application programming interface (API) which allows IPC to be programmed at a higher level of abstraction. (e.g., send and receive) - Distributed computing requires information to be exchanged among independent processes.
  • 4. 4 IPC – unicast and multicast • In distributed computing, two or more processes engage in IPC using a protocol agreed upon by the processes. A process may be a sender at some points during a protocol, a receiver at other points. • When communication is from one process to a single other process, the IPC is said to be a unicast, e.g., Socket communication. When communication is from one process to a group of processes, the IPC is said to be a multicast, e.g., Publish/Subscribe Message model.
  • 5. 5 Unicast vs. Multicast P2 P1 P1 P2 P3 P4 ... unicast multicast m m m m
  • 6. 6 Process 1 Process 2 data sender receiver Interprocess Communications in Distributed Computing
  • 7. 7 Operations provided in an archetypal Interprocess Communications API •Receive ( [sender], message storage object) •Connect (sender address, receiver address), for connection-oriented communication. •Send ( [receiver], message) •Disconnect (connection identifier), for connection-oriented communication.
  • 8. 8 Interprocess Communication in basic HTTP C1 C2 S3 S4 C4 Web server Web browser a process an operation data flow operations: S1: accept connection S2: receive (request) S3: send (response) S3: disconnect C1: make connection C2: send (request) C3: receive (response) C4: disconnect S2 C3 S1 HTTP request HTTP response S4 Processing order: C1, S1, C2, S2, S3, C3, C4, S4
  • 9. 9 Event Synchronization • Interprocess communication may require that the two processes synchronize their operations: one side sends, then the other receives until all data has been sent and received. • Ideally, the send operation starts before the receive operation commences. • In practice, the synchronization requires system support.
  • 10. 10 Synchronous vs. Asynchronous Communication • The IPC operations may provide the synchronization necessary using blocking. A blocking operation issued by a process will block further processing of the process until the operation is fulfilled. • Alternatively, IPC operations may be asynchronous or nonblocking. An asynchronous operation issued by a process will not block further processing of the process. Instead, the process is free to proceed with its processing, and may optionally be notified by the system when the operation is fulfilled.
  • 11. 11 Synchronous send and receive process 1 running on host 1 blocking send starts blocking send returns blocking receive starts blocking receive ends execution flow suspended period Synchronous Send and Receive an operation acknowledgement of data received provided by the IPC facility process 2 running on host 2 Client Server Sender Receiver Event Diagram
  • 12. 12 Asynchronous send and synchronous receive Process 1 Process 2 blocking receive starts blocking receive returns execution flow suspended period Asynchronous Send and Synchronous Receive nonblocking send operation Event Diagram Client Server Sender Receiver
  • 13. 13 Synchronous send and Async. Receive - 1 Process 1 Process 2 nonblocking receive issued execution flow suspended period Synchronous Send and Asynchronous Receive blocking send issued Scenario A transparent acknowledgement provided by the IPC facility Data from P1 was received by P2 before issuing a non-blocking receive op in P2
  • 14. 14 Synchronous send and Async. Receive - 2 indefinite blocking Process 1 Process 2 nonblocking receive issued and returned immediately execution flow suspended period Synchronous Send and Asynchronous Receive blocking send issued Scenario B Process 1 Process 2 Data from P1 arrived to P2 after P2 issued a non-blocking receive op
  • 15. 15 Synchronous send and Async. Receive - 3 Process 1 Process 2 nonblocking receive issued and returned immediately execution flow suspended period Synchronous Send and Asynchronous Receive blocking send issued Scenario C process is notified of the arrival of data transparent acknowledgement provided by the IPC facility Data from P1 arrived to P2 before P2 issues a non-blocking receive op. P2 is notified of the arrival of data
  • 16. 16 Asynchronous send and Asynchronous receive Process 1 Process 2 nonblocking receive issued and returned immediately execution flow suspended period Asynchronous Send and Asynchronous Receive blocking send issued Scenario C process is notified of the arrival of data Does P1 need an acknowledgement from P2?
  • 17.
  • 18. 18 Event diagram Process A Process B interprocess communication execution flow process blocked Event diagram for a protocol request 1 response 1 response2 request 2 time Synchronous send and receive
  • 19. 19 Sequence Diagram Process A Process B interprocess communication request 1 response 1 request 2 response 2
  • 20. 20 Sequence diagram for a HTTP session Process A Process B interprocess communication request 1 response 1 request 2 response 2
  • 21. 21 Blocking, deadlock, and timeouts • Blocking operations issued in the wrong sequence can cause deadlocks. • Deadlocks should be avoided. Alternatively, timeout can be used to detect deadlocks. receive from process 2 issued received from process 1 issued process 1 blocked pending data from process 2. process 2 blocked pending data from process 1. Process 1 Process 2 P1 is waiting for P2’s data; P2 is waiting for P1’s data.
  • 22. 22 Using threads for asynchronous IPC • When using an IPC programming interface, it is important to note whether the operations are synchronous or asynchronous. • If only blocking operation is provided for send and/or receive, then it is the programmer’s responsibility to using child processes or threads if asynchronous operations are desired. process main thread new thread issues a blocking IPC operation thread is blocked thread is unblocked after the operation is fulfilled main thread continues with other processing
  • 23. 23 Deadlocks and Timeouts • Connect and receive operations can result in indefinite blocking • For example, a blocking connect request can result in the requesting process to be suspended indefinitely if the connection is unfulfilled or cannot be fulfilled, perhaps as a result of a breakdown in the network . • It is generally unacceptable for a requesting process to “hang” indefinitely. Indefinite blocking can be avoided by using timeout. • Indefinite blocking may also be caused by a deadlock
  • 24. 24 Indefinite blocking due to a deadlock "receive from process 2" issued; "receive from process 1" issued; process 1 blocked pending data from process 2. process 2 blocked pending data from process 1. Process 1 Process 2 process executing process blocked an operation P1 is waiting for P2’s data; P2 is waiting for P1’s data.
  • 25. 25 Data Representation • Data transmitted on the network is a binary stream. • An interprocess communication system may provide the capability to allow data representation to be imposed on the raw data. • Because different computers may have different internal storage format for the same data type, an external representation of data may be necessary—standard format. • Data marshalling is the process of (I) flattening a data structure, and (ii) converting the data to an external representation. • Some well known external data representation schemes are: Sun XDR (External Data Representation) ASN.1 (Abstract Syntax Notation One) XML (Extensible Markup Language)
  • 26. 26 Data Marshalling "This is a test." "This is a test." 1.2 7.3 -1.5 1.2 7.3 -1.5 110011 ... 10000100 ... marshalling unmarshalling 1. flattening of structured data items 2. converting data to external (network) representation 1. convert data to internal representation 2. rebuild data structures. host A host B External to internal representation and vice versa is not required - if the two sides are of the same host type; - if the two sides negotiates at connection.
  • 27. 27 Text-based protocols • Data marshalling is at its simplest when the data exchanged is a stream of characters, or text. • Exchanging data in text has the additional advantage that the data can be easily parsed in a program and displayed for human perusal. Hence it is a popular practice for protocols to exchange requests and responses in the form of character-strings. Such protocols are said to be text- based. • Many popular network protocols, including FTP (File Transfer Protocol), HTTP, and SMTP (Simple Mail Transfer Protocol), are text-based.
  • 28. 28 Protocol • In a distributed application, two processes perform interprocess communication in a mutually agreed upon protocol. • The specification of a protocol should include (i) the sequence of data exchange, which can be described using a time event diagram. (ii) the format of the data exchange at each step.