SlideShare a Scribd company logo
1 of 48
Download to read offline
DISTRIBUTED OPERATING
SYSTEMS
Sandeep Kumar Poonia
Head of Dept. CS/IT
B.E., M.Tech., UGC-NET
LM-IAENG, LM-IACSIT,LM-CSTA, LM-AIRCC, LM-SCIEI, AM-UACEE
ISSUES IN CLIENT-SERVER COMMUNICATION
 Addressing
 Blocking versus non-blocking
 Buffered versus unbuffered
 Reliable versus unreliable
 Server architecture: concurrent versus
sequential
 Scalability
ADDRESSING ISSUES
Question: how is the server
located?
Hard-wired address
 Machine address and process
address are known a priori
Broadcast-based
 Server chooses address from a
sparse address space
 Client broadcasts request
 Can cache response for future
Locate address via name
server
user server
user server
user serverNS
BLOCKING VERSUS NON-BLOCKING
 Blocking communication (synchronous)
 Send blocks until message is actually sent
 Receive blocks until message is actually received
BLOCKING VERSUS NON-BLOCKING
 Non-blocking communication (asynchronous)
 Send returns immediately
 Return does not block
BUFFERING ISSUES
 Unbuffered communication
 Server must call receive before client can call send
BUFFERING ISSUES
 Buffered communication
 Client send to a mailbox
 Server receives from a mailbox
RELIABILITY
 Unreliable channel
 Need acknowledgements (ACKs)
 Applications handle ACKs
 ACKs for both request and reply
RELIABILITY
 Reliable channel
 Reply acts as ACK for request
 Explicit ACK for response
SERVER ARCHITECTURE
 Sequential
 Serve one request at a time
 Can service multiple requests by employing events and
asynchronous communication
 Concurrent
 Server spawns a process or thread to service each request
 Can also use a pre-spawned pool of threads/processes
(apache)
 Thus servers could be
 Pure-sequential, event-based, thread-based, process-based
SCALABILITY
 Question:How can you scale the server
capacity?
 Buy bigger machine!
 Replicate
 Distribute data and/or algorithms
 Ship code instead of data
 Cache
TO PUSH OR PULL ?
 Client-pull architecture
 Clients pull data from servers (by sending requests)
 Example: HTTP
 Pro: stateless servers, failures are each to handle
 Con: limited scalability
 Server-push architecture
 Servers push data to client
 Example: video streaming
 Pro: more scalable,
 Con: stateful servers, less resilient to failure
REMOTE PROCEDURE CALLS
 Goal: Make distributed computing look like centralized
computing
 Allow remote services to be called as procedures
 Transparency with regard to location, implementation,
language
 Issues
 How to pass parameters
 Bindings
 Semantics in face of errors
 Two classes: integrated into programming language
and separate
CONVENTIONAL PROCEDURE CALL
a) Parameter passing in a
local procedure call: the
stack before the call to
read
b) The stack while the called
procedure is active
PARAMETER PASSING
 Local procedure parameter passing
 Call-by-value
 Call-by-reference: arrays, complex data structures
 Remote procedure calls simulate this through:
 Stubs – proxies
 Flattening – marshalling
 Related issue: global variables are not allowed
in RPCs
CLIENT AND SERVER STUBS
 Principle of RPC between a client and server program.
STUBS
 Client makes procedure call (just like a local
procedure call) to the client stub
 Server is written as a standard procedure
 Stubs take care of packaging arguments and
sending messages
 Packaging parameters is called marshalling
 Stub compiler generates stub automatically
from specs in an Interface Definition Language
(IDL)
 Simplifies programmer task
A PAIR OF STUBS
 Client-side stub
 Looks like local server
function
 Same interface as local
function
 Bundles arguments into
message, sends to
server-side stub
 Waits for reply, un-
bundles results
 returns
 Server-side stub
 Looks like local client
function to server
 Listens on a socket for
message from client
stub
 Un-bundles arguments
to local variables
 Makes a local function
call to server
 Bundles result into reply
message to client stub
STEPS OF A REMOTE PROCEDURE CALL
1. Client procedure calls client stub in normal way
2. Client stub builds message, calls local OS
3. Client's OS sends message to remote OS
4. Remote OS gives message to server stub
5. Server stub unpacks parameters, calls server
6. Server does work, returns result to the stub
7. Server stub packs it in message, calls local OS
8. Server's OS sends message to client's OS
9. Client's OS gives message to client stub
10. Stub unpacks result, returns to client
EXAMPLE OF AN RPC
2-8
RPC – ISSUES
 How to make the “remote” part of RPC invisible
to the programmer?
 What are semantics of parameter passing?
 E.g., pass by reference?
 How to bind (locate & connect) to servers?
 How to handle heterogeneity?
 OS, language, architecture, …
 How to make it go fast?
RPC MODEL
 A server defines the service interface using an
interface definition language (IDL)
 the IDL specifies the names, parameters, and types
for all client-callable server procedures
 A stub compiler reads the IDL declarations and
produces two stub functions for each server
function
 Server-side and client-side
RPC MODEL (CONTINUED)
 Linking:–
 Server programmer implements the server’s
functions and links with the server-side stubs
 Client programmer implements the client program
and links it with client-side stubs
 Operation:–
 Stubs manage all of the details of remote
communication between client and server
RPC STUBS
 A client-side stub is a function that looks to the client
as if it were a callable server function
 I.e., same API as the server’s implementation of the function
 A server-side stub looks like a caller to the server
 I.e., like a hunk of code invoking the server function
 The client program thinks it’s invoking the server
 but it’s calling into the client-side stub
 The server program thinks it’s called by the client
 but it’s really called by the server-side stub
 The stubs send messages to each other to make the
RPC happen transparently
MARSHALLING ARGUMENTS
 Marshalling is the packing of function
parameters into a message packet
 the RPC stubs call type-specific functions to
marshal or unmarshal the parameters of an RPC
 Client stub marshals the arguments into a message
 Server stub unmarshals the arguments and uses them to
invoke the service function
 on return:
 the server stub marshals return values
 the client stub unmarshals return values, and returns to
the client program
MARSHALLING
 Problem: different machines have different data formats
 Intel: little endian, SPARC: big endian
 Solution: use a standard representation
 Example: external data representation (XDR)
 Problem: how do we pass pointers?
 If it points to a well-defined data structure, pass a copy and the server
stub passes a pointer to the local copy
 What about data structures containing pointers?
 Prohibit
 Chase pointers over network
 Marshalling: transform parameters/results into a byte stream
ISSUE #1 — REPRESENTATION OF DATA
 Big endian vs. little endian
Sent by Pentium Rec’d by SPARC After inversion
REPRESENTATION OF DATA (CONTINUED)
 IDL must also define representation of data on
network
 Multi-byte integers
 Strings, character codes
 Floating point, complex, …
 …
 example: Sun’s XDR (external data representation)
 Each stub converts machine representation to/from
network representation
 Clients and servers must not try to cast data!
ISSUE #2 — POINTERS AND REFERENCES
read(int fd, char* buf, int nbytes)
 Pointers are only valid within one address
space
 Cannot be interpreted by another process
 Even on same machine!
 Pointers and references are ubiquitous in C,
C++
 Even in Java implementations!
POINTERS AND REFERENCES —
RESTRICTED SEMANTICS
 Option: call by value
 Sending stub dereferences pointer, copies result to
message
 Receiving stub conjures up a new pointer
 Option: call by result
 Sending stub provides buffer, called function puts
data into it
 Receiving stub copies data to caller’s buffer as
specified by pointer
POINTERS AND REFERENCES —
RESTRICTED SEMANTICS (CONTINUED)
 Option: call by value-result
 Caller’s stub copies data to message, then copies
result back to client buffer
 Server stub keeps data in own buffer, server
updates it; server sends data back in reply
 Not allowed:–
 Call by reference
 Aliased arguments
RPC BINDING
 Binding is the process of connecting the client
to the server
 the server, when it starts up, exports its interface
 identifies itself to a network name server
 tells RPC runtime that it is alive and ready to accept calls
 the client, before issuing any calls, imports the
server
 RPC runtime uses the name server to find the location of
the server and establish a connection
 The import and export operations are explicit in
the server and client programs
BINDING: COMMENTS
 Exporting and importing incurs overheads
 Binder can be a bottleneck
 Use multiple binders
 Binder can do load balancing
RPC - BINDING
 Static binding
 hard coded stub
 Simple, efficient
 not flexible
 stub recompilation necessary if the location of the server changes
 use of redundant servers not possible
 Dynamic binding
 name and directory server
 load balancing
 IDL used for binding
 flexible
 redundant servers possible
RPC - DYNAMIC BINDING
client
procedure call
client stub
bind
(un)marshal
(de)serialize
Find/bind
send
receive
communicationmodule
communicationmodule
server
procedure
server stub
register
(un)marshal
(de)serialize
receive
send
dispatcher
selects stub
client process server process
name and directory server
2
4
5 6
7
8
9
1
12
11 10
12
13
12
3
Wolfgang Gassler, Eva
FAILURE SEMANTICS
 Client unable to locate server: return error
 Lost request messages: simple timeout mechanisms
 Lost replies: timeout mechanisms
 Make operation idempotent
 Use sequence numbers, mark retransmissions
FAILURE SEMANTICS
 Server failures: did failure occur before or after
operation?
 At least once semantics- Keep trying until a reply has been
received
 At most once- Gives up immediately and report back failure
 No guarantee- RPC may have been carried out any where
from 0 to a large number of times
 Exactly once: desirable but difficult to achieve
FAILURE SEMANTICS
 Client failure: what happens to the server
computation?
 Referred to as an orphan
 Extermination: log at client stub and explicitly kill orphans
 Overhead of maintaining disk logs
 Reincarnation: Divide time into epochs between failures
and delete computations from old epochs
 Gentle reincarnation: upon a new epoch broadcast, try to
locate owner first (delete only if no owner)
 Expiration: give each RPC a fixed quantum T; explicitly
request extensions
 Periodic checks with client during long computations
IMPLEMENTATION ISSUES
 Choice of protocol [affects communication costs]
 Use existing protocol (UDP) or design from scratch
 Packet size restrictions
 Reliability in case of multiple packet messages
 Flow control
 Copying costs are dominant overheads
 Need at least 2 copies per message
 From client to NIC and from server NIC to server
 As many as 7 copies
 Stack in stub – message buffer in stub – kernel – NIC – medium –
NIC – kernel – stub – server
 Scatter-gather operations can reduce overheads
RPC PROTOCOL
CRITICAL PATH
CASE STUDY: SUNRPC
 One of the most widely used RPC systems
 Developed for use with NFS
 Built on top of UDP or TCP
 TCP: stream is divided into records
 UDP: max packet size < 8912 bytes
 UDP: timeout plus limited number of retransmissions
 TCP: return error if connection is terminated by server
 Multiple arguments marshaled into a single structure
 At-least-once semantics if reply received, at-least-zero
semantics if no reply. With UDP tries at-most-once
 Use SUN’s eXternal Data Representation (XDR)
 Big endian order for 32 bit integers, handle arbitrarily large data
structures
BINDER: PORT MAPPER
Server start-up: create port
Server stub calls svc_register
to register prog. #, version #
with local port mapper
Port mapper stores prog #,
version #, and port
Client start-up: call
clnt_create to locate server
port
Upon return, client can call
procedures at the server
SUMMARY
 RPCs make distributed computations look like
local computations
 Issues:
 Parameter passing
 Binding
 Failure handling
 Case Study: SUN RPC
GROUP COMMUNICATION
 One-to-many communication: useful for
distributed applications
 Issues:
 Group characteristics:
 Static/dynamic, open/closed
 Group addressing
 Multicast, broadcast, application-level multicast (unicast)
 Atomicity
 Message ordering
 Scalability
PUTTING IT ALL TOGETHER: EMAIL
 User uses mail client to compose a message
 Mail client connects to mail server
 Mail server looks up address to destination
mail server
 Mail server sets up a connection and passes
the mail to destination mail server
 Destination stores mail in input buffer (user
mailbox)
 Recipient checks mail at a later time
EMAIL: DESIGN CONSIDERATIONS
 Structured or unstructured?
 Addressing?
 Blocking/non-blocking?
 Buffered or unbuffered?
 Reliable or unreliable?
 Server architecture
 Scalability
 Push or pull?
 Group communication

More Related Content

What's hot

Rpc Case Studies (Distributed computing)
Rpc Case Studies (Distributed computing)Rpc Case Studies (Distributed computing)
Rpc Case Studies (Distributed computing)Sri Prasanna
 
Interprocess Communication
Interprocess CommunicationInterprocess Communication
Interprocess CommunicationDeepak H L
 
remote procedure calls
  remote procedure calls  remote procedure calls
remote procedure callsAshish Kumar
 
Rpc (Distributed computing)
Rpc (Distributed computing)Rpc (Distributed computing)
Rpc (Distributed computing)Sri Prasanna
 
Chapter 4 communication2
Chapter 4 communication2Chapter 4 communication2
Chapter 4 communication2DBU
 
communication Mechanism in Client Server Model
communication Mechanism in Client Server Model communication Mechanism in Client Server Model
communication Mechanism in Client Server Model Junaid Lodhi
 
Group Communication (Distributed computing)
Group Communication (Distributed computing)Group Communication (Distributed computing)
Group Communication (Distributed computing)Sri Prasanna
 
Remote Procedure Call in Distributed System
Remote Procedure Call in Distributed SystemRemote Procedure Call in Distributed System
Remote Procedure Call in Distributed SystemPoojaBele1
 
Inter-Process Communication in distributed systems
Inter-Process Communication in distributed systemsInter-Process Communication in distributed systems
Inter-Process Communication in distributed systemsAya Mahmoud
 
Distributed process and scheduling
Distributed process and scheduling Distributed process and scheduling
Distributed process and scheduling SHATHAN
 
RPC: Remote procedure call
RPC: Remote procedure callRPC: Remote procedure call
RPC: Remote procedure callSunita Sahu
 
Middleware in Distributed System-RPC,RMI
Middleware in Distributed System-RPC,RMIMiddleware in Distributed System-RPC,RMI
Middleware in Distributed System-RPC,RMIPrajakta Rane
 
Communication in Distributed Systems
Communication in Distributed SystemsCommunication in Distributed Systems
Communication in Distributed SystemsDilum Bandara
 
Data Replication in Distributed System
Data Replication in  Distributed SystemData Replication in  Distributed System
Data Replication in Distributed SystemEhsan Hessami
 

What's hot (20)

Rpc Case Studies (Distributed computing)
Rpc Case Studies (Distributed computing)Rpc Case Studies (Distributed computing)
Rpc Case Studies (Distributed computing)
 
Interprocess Communication
Interprocess CommunicationInterprocess Communication
Interprocess Communication
 
1.intro. to distributed system
1.intro. to distributed system1.intro. to distributed system
1.intro. to distributed system
 
remote procedure calls
  remote procedure calls  remote procedure calls
remote procedure calls
 
message passing
 message passing message passing
message passing
 
Message passing in Distributed Computing Systems
Message passing in Distributed Computing SystemsMessage passing in Distributed Computing Systems
Message passing in Distributed Computing Systems
 
Rpc (Distributed computing)
Rpc (Distributed computing)Rpc (Distributed computing)
Rpc (Distributed computing)
 
Chapter 4 communication2
Chapter 4 communication2Chapter 4 communication2
Chapter 4 communication2
 
communication Mechanism in Client Server Model
communication Mechanism in Client Server Model communication Mechanism in Client Server Model
communication Mechanism in Client Server Model
 
Group Communication (Distributed computing)
Group Communication (Distributed computing)Group Communication (Distributed computing)
Group Communication (Distributed computing)
 
Remote Procedure Call in Distributed System
Remote Procedure Call in Distributed SystemRemote Procedure Call in Distributed System
Remote Procedure Call in Distributed System
 
4. system models
4. system models4. system models
4. system models
 
Inter-Process Communication in distributed systems
Inter-Process Communication in distributed systemsInter-Process Communication in distributed systems
Inter-Process Communication in distributed systems
 
Distributed process and scheduling
Distributed process and scheduling Distributed process and scheduling
Distributed process and scheduling
 
RPC: Remote procedure call
RPC: Remote procedure callRPC: Remote procedure call
RPC: Remote procedure call
 
Middleware in Distributed System-RPC,RMI
Middleware in Distributed System-RPC,RMIMiddleware in Distributed System-RPC,RMI
Middleware in Distributed System-RPC,RMI
 
Chapter 11
Chapter 11Chapter 11
Chapter 11
 
Communication in Distributed Systems
Communication in Distributed SystemsCommunication in Distributed Systems
Communication in Distributed Systems
 
Data Replication in Distributed System
Data Replication in  Distributed SystemData Replication in  Distributed System
Data Replication in Distributed System
 
Cs 704 d rpc
Cs 704 d rpcCs 704 d rpc
Cs 704 d rpc
 

Similar to 5. Distributed Operating Systems

Similar to 5. Distributed Operating Systems (20)

Rpc
RpcRpc
Rpc
 
Dos(rpc)avishek130650107020
Dos(rpc)avishek130650107020Dos(rpc)avishek130650107020
Dos(rpc)avishek130650107020
 
MSB-Remote procedure call
MSB-Remote procedure callMSB-Remote procedure call
MSB-Remote procedure call
 
Rpc
RpcRpc
Rpc
 
Cs556 section3
Cs556 section3Cs556 section3
Cs556 section3
 
Cs556 section3
Cs556 section3Cs556 section3
Cs556 section3
 
CHP-4.pptx
CHP-4.pptxCHP-4.pptx
CHP-4.pptx
 
High volume real time contiguous etl and audit
High volume real time contiguous etl and auditHigh volume real time contiguous etl and audit
High volume real time contiguous etl and audit
 
Lecture9
Lecture9Lecture9
Lecture9
 
Rpc
RpcRpc
Rpc
 
Remote procedure call on client server computing
Remote procedure call on client server computingRemote procedure call on client server computing
Remote procedure call on client server computing
 
Ch 8 Client Server
Ch 8  Client  ServerCh 8  Client  Server
Ch 8 Client Server
 
Remote procedure call
Remote procedure callRemote procedure call
Remote procedure call
 
Communication in Distributed System.ppt
Communication in Distributed System.pptCommunication in Distributed System.ppt
Communication in Distributed System.ppt
 
Microservice Powered Orchestration
Microservice Powered OrchestrationMicroservice Powered Orchestration
Microservice Powered Orchestration
 
Overview usage of ProudNet
Overview usage of ProudNetOverview usage of ProudNet
Overview usage of ProudNet
 
Distributed System by Pratik Tambekar
Distributed System by Pratik TambekarDistributed System by Pratik Tambekar
Distributed System by Pratik Tambekar
 
Chapter 2B-Communication.ppt
Chapter 2B-Communication.pptChapter 2B-Communication.ppt
Chapter 2B-Communication.ppt
 
Java Networking
Java NetworkingJava Networking
Java Networking
 
Remote Procedure Call
Remote Procedure CallRemote Procedure Call
Remote Procedure Call
 

More from Dr Sandeep Kumar Poonia

An improved memetic search in artificial bee colony algorithm
An improved memetic search in artificial bee colony algorithmAn improved memetic search in artificial bee colony algorithm
An improved memetic search in artificial bee colony algorithmDr Sandeep Kumar Poonia
 
Modified position update in spider monkey optimization algorithm
Modified position update in spider monkey optimization algorithmModified position update in spider monkey optimization algorithm
Modified position update in spider monkey optimization algorithmDr Sandeep Kumar Poonia
 
Enhanced local search in artificial bee colony algorithm
Enhanced local search in artificial bee colony algorithmEnhanced local search in artificial bee colony algorithm
Enhanced local search in artificial bee colony algorithmDr Sandeep Kumar Poonia
 
Memetic search in differential evolution algorithm
Memetic search in differential evolution algorithmMemetic search in differential evolution algorithm
Memetic search in differential evolution algorithmDr Sandeep Kumar Poonia
 
Improved onlooker bee phase in artificial bee colony algorithm
Improved onlooker bee phase in artificial bee colony algorithmImproved onlooker bee phase in artificial bee colony algorithm
Improved onlooker bee phase in artificial bee colony algorithmDr Sandeep Kumar Poonia
 
Comparative study of_hybrids_of_artificial_bee_colony_algorithm
Comparative study of_hybrids_of_artificial_bee_colony_algorithmComparative study of_hybrids_of_artificial_bee_colony_algorithm
Comparative study of_hybrids_of_artificial_bee_colony_algorithmDr Sandeep Kumar Poonia
 
A novel hybrid crossover based abc algorithm
A novel hybrid crossover based abc algorithmA novel hybrid crossover based abc algorithm
A novel hybrid crossover based abc algorithmDr Sandeep Kumar Poonia
 
Multiplication of two 3 d sparse matrices using 1d arrays and linked lists
Multiplication of two 3 d sparse matrices using 1d arrays and linked listsMultiplication of two 3 d sparse matrices using 1d arrays and linked lists
Multiplication of two 3 d sparse matrices using 1d arrays and linked listsDr Sandeep Kumar Poonia
 
Sunzip user tool for data reduction using huffman algorithm
Sunzip user tool for data reduction using huffman algorithmSunzip user tool for data reduction using huffman algorithm
Sunzip user tool for data reduction using huffman algorithmDr Sandeep Kumar Poonia
 
New Local Search Strategy in Artificial Bee Colony Algorithm
New Local Search Strategy in Artificial Bee Colony Algorithm New Local Search Strategy in Artificial Bee Colony Algorithm
New Local Search Strategy in Artificial Bee Colony Algorithm Dr Sandeep Kumar Poonia
 
Performance evaluation of different routing protocols in wsn using different ...
Performance evaluation of different routing protocols in wsn using different ...Performance evaluation of different routing protocols in wsn using different ...
Performance evaluation of different routing protocols in wsn using different ...Dr Sandeep Kumar Poonia
 
Performance evaluation of diff routing protocols in wsn using difft network p...
Performance evaluation of diff routing protocols in wsn using difft network p...Performance evaluation of diff routing protocols in wsn using difft network p...
Performance evaluation of diff routing protocols in wsn using difft network p...Dr Sandeep Kumar Poonia
 

More from Dr Sandeep Kumar Poonia (20)

Soft computing
Soft computingSoft computing
Soft computing
 
An improved memetic search in artificial bee colony algorithm
An improved memetic search in artificial bee colony algorithmAn improved memetic search in artificial bee colony algorithm
An improved memetic search in artificial bee colony algorithm
 
Modified position update in spider monkey optimization algorithm
Modified position update in spider monkey optimization algorithmModified position update in spider monkey optimization algorithm
Modified position update in spider monkey optimization algorithm
 
Enhanced local search in artificial bee colony algorithm
Enhanced local search in artificial bee colony algorithmEnhanced local search in artificial bee colony algorithm
Enhanced local search in artificial bee colony algorithm
 
RMABC
RMABCRMABC
RMABC
 
Memetic search in differential evolution algorithm
Memetic search in differential evolution algorithmMemetic search in differential evolution algorithm
Memetic search in differential evolution algorithm
 
Improved onlooker bee phase in artificial bee colony algorithm
Improved onlooker bee phase in artificial bee colony algorithmImproved onlooker bee phase in artificial bee colony algorithm
Improved onlooker bee phase in artificial bee colony algorithm
 
Comparative study of_hybrids_of_artificial_bee_colony_algorithm
Comparative study of_hybrids_of_artificial_bee_colony_algorithmComparative study of_hybrids_of_artificial_bee_colony_algorithm
Comparative study of_hybrids_of_artificial_bee_colony_algorithm
 
A novel hybrid crossover based abc algorithm
A novel hybrid crossover based abc algorithmA novel hybrid crossover based abc algorithm
A novel hybrid crossover based abc algorithm
 
Multiplication of two 3 d sparse matrices using 1d arrays and linked lists
Multiplication of two 3 d sparse matrices using 1d arrays and linked listsMultiplication of two 3 d sparse matrices using 1d arrays and linked lists
Multiplication of two 3 d sparse matrices using 1d arrays and linked lists
 
Sunzip user tool for data reduction using huffman algorithm
Sunzip user tool for data reduction using huffman algorithmSunzip user tool for data reduction using huffman algorithm
Sunzip user tool for data reduction using huffman algorithm
 
New Local Search Strategy in Artificial Bee Colony Algorithm
New Local Search Strategy in Artificial Bee Colony Algorithm New Local Search Strategy in Artificial Bee Colony Algorithm
New Local Search Strategy in Artificial Bee Colony Algorithm
 
A new approach of program slicing
A new approach of program slicingA new approach of program slicing
A new approach of program slicing
 
Performance evaluation of different routing protocols in wsn using different ...
Performance evaluation of different routing protocols in wsn using different ...Performance evaluation of different routing protocols in wsn using different ...
Performance evaluation of different routing protocols in wsn using different ...
 
Enhanced abc algo for tsp
Enhanced abc algo for tspEnhanced abc algo for tsp
Enhanced abc algo for tsp
 
Database aggregation using metadata
Database aggregation using metadataDatabase aggregation using metadata
Database aggregation using metadata
 
Performance evaluation of diff routing protocols in wsn using difft network p...
Performance evaluation of diff routing protocols in wsn using difft network p...Performance evaluation of diff routing protocols in wsn using difft network p...
Performance evaluation of diff routing protocols in wsn using difft network p...
 
Lecture28 tsp
Lecture28 tspLecture28 tsp
Lecture28 tsp
 
Lecture27 linear programming
Lecture27 linear programmingLecture27 linear programming
Lecture27 linear programming
 
Lecture26
Lecture26Lecture26
Lecture26
 

Recently uploaded

Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 

Recently uploaded (20)

Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 

5. Distributed Operating Systems

  • 1. DISTRIBUTED OPERATING SYSTEMS Sandeep Kumar Poonia Head of Dept. CS/IT B.E., M.Tech., UGC-NET LM-IAENG, LM-IACSIT,LM-CSTA, LM-AIRCC, LM-SCIEI, AM-UACEE
  • 2. ISSUES IN CLIENT-SERVER COMMUNICATION  Addressing  Blocking versus non-blocking  Buffered versus unbuffered  Reliable versus unreliable  Server architecture: concurrent versus sequential  Scalability
  • 3. ADDRESSING ISSUES Question: how is the server located? Hard-wired address  Machine address and process address are known a priori Broadcast-based  Server chooses address from a sparse address space  Client broadcasts request  Can cache response for future Locate address via name server user server user server user serverNS
  • 4. BLOCKING VERSUS NON-BLOCKING  Blocking communication (synchronous)  Send blocks until message is actually sent  Receive blocks until message is actually received
  • 5. BLOCKING VERSUS NON-BLOCKING  Non-blocking communication (asynchronous)  Send returns immediately  Return does not block
  • 6. BUFFERING ISSUES  Unbuffered communication  Server must call receive before client can call send
  • 7. BUFFERING ISSUES  Buffered communication  Client send to a mailbox  Server receives from a mailbox
  • 8. RELIABILITY  Unreliable channel  Need acknowledgements (ACKs)  Applications handle ACKs  ACKs for both request and reply
  • 9. RELIABILITY  Reliable channel  Reply acts as ACK for request  Explicit ACK for response
  • 10. SERVER ARCHITECTURE  Sequential  Serve one request at a time  Can service multiple requests by employing events and asynchronous communication  Concurrent  Server spawns a process or thread to service each request  Can also use a pre-spawned pool of threads/processes (apache)  Thus servers could be  Pure-sequential, event-based, thread-based, process-based
  • 11. SCALABILITY  Question:How can you scale the server capacity?  Buy bigger machine!  Replicate  Distribute data and/or algorithms  Ship code instead of data  Cache
  • 12. TO PUSH OR PULL ?  Client-pull architecture  Clients pull data from servers (by sending requests)  Example: HTTP  Pro: stateless servers, failures are each to handle  Con: limited scalability  Server-push architecture  Servers push data to client  Example: video streaming  Pro: more scalable,  Con: stateful servers, less resilient to failure
  • 13. REMOTE PROCEDURE CALLS  Goal: Make distributed computing look like centralized computing  Allow remote services to be called as procedures  Transparency with regard to location, implementation, language  Issues  How to pass parameters  Bindings  Semantics in face of errors  Two classes: integrated into programming language and separate
  • 14. CONVENTIONAL PROCEDURE CALL a) Parameter passing in a local procedure call: the stack before the call to read b) The stack while the called procedure is active
  • 15. PARAMETER PASSING  Local procedure parameter passing  Call-by-value  Call-by-reference: arrays, complex data structures  Remote procedure calls simulate this through:  Stubs – proxies  Flattening – marshalling  Related issue: global variables are not allowed in RPCs
  • 16. CLIENT AND SERVER STUBS  Principle of RPC between a client and server program.
  • 17. STUBS  Client makes procedure call (just like a local procedure call) to the client stub  Server is written as a standard procedure  Stubs take care of packaging arguments and sending messages  Packaging parameters is called marshalling  Stub compiler generates stub automatically from specs in an Interface Definition Language (IDL)  Simplifies programmer task
  • 18. A PAIR OF STUBS  Client-side stub  Looks like local server function  Same interface as local function  Bundles arguments into message, sends to server-side stub  Waits for reply, un- bundles results  returns  Server-side stub  Looks like local client function to server  Listens on a socket for message from client stub  Un-bundles arguments to local variables  Makes a local function call to server  Bundles result into reply message to client stub
  • 19.
  • 20. STEPS OF A REMOTE PROCEDURE CALL 1. Client procedure calls client stub in normal way 2. Client stub builds message, calls local OS 3. Client's OS sends message to remote OS 4. Remote OS gives message to server stub 5. Server stub unpacks parameters, calls server 6. Server does work, returns result to the stub 7. Server stub packs it in message, calls local OS 8. Server's OS sends message to client's OS 9. Client's OS gives message to client stub 10. Stub unpacks result, returns to client
  • 21. EXAMPLE OF AN RPC 2-8
  • 22. RPC – ISSUES  How to make the “remote” part of RPC invisible to the programmer?  What are semantics of parameter passing?  E.g., pass by reference?  How to bind (locate & connect) to servers?  How to handle heterogeneity?  OS, language, architecture, …  How to make it go fast?
  • 23. RPC MODEL  A server defines the service interface using an interface definition language (IDL)  the IDL specifies the names, parameters, and types for all client-callable server procedures  A stub compiler reads the IDL declarations and produces two stub functions for each server function  Server-side and client-side
  • 24. RPC MODEL (CONTINUED)  Linking:–  Server programmer implements the server’s functions and links with the server-side stubs  Client programmer implements the client program and links it with client-side stubs  Operation:–  Stubs manage all of the details of remote communication between client and server
  • 25. RPC STUBS  A client-side stub is a function that looks to the client as if it were a callable server function  I.e., same API as the server’s implementation of the function  A server-side stub looks like a caller to the server  I.e., like a hunk of code invoking the server function  The client program thinks it’s invoking the server  but it’s calling into the client-side stub  The server program thinks it’s called by the client  but it’s really called by the server-side stub  The stubs send messages to each other to make the RPC happen transparently
  • 26. MARSHALLING ARGUMENTS  Marshalling is the packing of function parameters into a message packet  the RPC stubs call type-specific functions to marshal or unmarshal the parameters of an RPC  Client stub marshals the arguments into a message  Server stub unmarshals the arguments and uses them to invoke the service function  on return:  the server stub marshals return values  the client stub unmarshals return values, and returns to the client program
  • 27. MARSHALLING  Problem: different machines have different data formats  Intel: little endian, SPARC: big endian  Solution: use a standard representation  Example: external data representation (XDR)  Problem: how do we pass pointers?  If it points to a well-defined data structure, pass a copy and the server stub passes a pointer to the local copy  What about data structures containing pointers?  Prohibit  Chase pointers over network  Marshalling: transform parameters/results into a byte stream
  • 28. ISSUE #1 — REPRESENTATION OF DATA  Big endian vs. little endian Sent by Pentium Rec’d by SPARC After inversion
  • 29. REPRESENTATION OF DATA (CONTINUED)  IDL must also define representation of data on network  Multi-byte integers  Strings, character codes  Floating point, complex, …  …  example: Sun’s XDR (external data representation)  Each stub converts machine representation to/from network representation  Clients and servers must not try to cast data!
  • 30. ISSUE #2 — POINTERS AND REFERENCES read(int fd, char* buf, int nbytes)  Pointers are only valid within one address space  Cannot be interpreted by another process  Even on same machine!  Pointers and references are ubiquitous in C, C++  Even in Java implementations!
  • 31. POINTERS AND REFERENCES — RESTRICTED SEMANTICS  Option: call by value  Sending stub dereferences pointer, copies result to message  Receiving stub conjures up a new pointer  Option: call by result  Sending stub provides buffer, called function puts data into it  Receiving stub copies data to caller’s buffer as specified by pointer
  • 32. POINTERS AND REFERENCES — RESTRICTED SEMANTICS (CONTINUED)  Option: call by value-result  Caller’s stub copies data to message, then copies result back to client buffer  Server stub keeps data in own buffer, server updates it; server sends data back in reply  Not allowed:–  Call by reference  Aliased arguments
  • 33. RPC BINDING  Binding is the process of connecting the client to the server  the server, when it starts up, exports its interface  identifies itself to a network name server  tells RPC runtime that it is alive and ready to accept calls  the client, before issuing any calls, imports the server  RPC runtime uses the name server to find the location of the server and establish a connection  The import and export operations are explicit in the server and client programs
  • 34. BINDING: COMMENTS  Exporting and importing incurs overheads  Binder can be a bottleneck  Use multiple binders  Binder can do load balancing
  • 35. RPC - BINDING  Static binding  hard coded stub  Simple, efficient  not flexible  stub recompilation necessary if the location of the server changes  use of redundant servers not possible  Dynamic binding  name and directory server  load balancing  IDL used for binding  flexible  redundant servers possible
  • 36. RPC - DYNAMIC BINDING client procedure call client stub bind (un)marshal (de)serialize Find/bind send receive communicationmodule communicationmodule server procedure server stub register (un)marshal (de)serialize receive send dispatcher selects stub client process server process name and directory server 2 4 5 6 7 8 9 1 12 11 10 12 13 12 3 Wolfgang Gassler, Eva
  • 37. FAILURE SEMANTICS  Client unable to locate server: return error  Lost request messages: simple timeout mechanisms  Lost replies: timeout mechanisms  Make operation idempotent  Use sequence numbers, mark retransmissions
  • 38. FAILURE SEMANTICS  Server failures: did failure occur before or after operation?  At least once semantics- Keep trying until a reply has been received  At most once- Gives up immediately and report back failure  No guarantee- RPC may have been carried out any where from 0 to a large number of times  Exactly once: desirable but difficult to achieve
  • 39. FAILURE SEMANTICS  Client failure: what happens to the server computation?  Referred to as an orphan  Extermination: log at client stub and explicitly kill orphans  Overhead of maintaining disk logs  Reincarnation: Divide time into epochs between failures and delete computations from old epochs  Gentle reincarnation: upon a new epoch broadcast, try to locate owner first (delete only if no owner)  Expiration: give each RPC a fixed quantum T; explicitly request extensions  Periodic checks with client during long computations
  • 40. IMPLEMENTATION ISSUES  Choice of protocol [affects communication costs]  Use existing protocol (UDP) or design from scratch  Packet size restrictions  Reliability in case of multiple packet messages  Flow control  Copying costs are dominant overheads  Need at least 2 copies per message  From client to NIC and from server NIC to server  As many as 7 copies  Stack in stub – message buffer in stub – kernel – NIC – medium – NIC – kernel – stub – server  Scatter-gather operations can reduce overheads
  • 43. CASE STUDY: SUNRPC  One of the most widely used RPC systems  Developed for use with NFS  Built on top of UDP or TCP  TCP: stream is divided into records  UDP: max packet size < 8912 bytes  UDP: timeout plus limited number of retransmissions  TCP: return error if connection is terminated by server  Multiple arguments marshaled into a single structure  At-least-once semantics if reply received, at-least-zero semantics if no reply. With UDP tries at-most-once  Use SUN’s eXternal Data Representation (XDR)  Big endian order for 32 bit integers, handle arbitrarily large data structures
  • 44. BINDER: PORT MAPPER Server start-up: create port Server stub calls svc_register to register prog. #, version # with local port mapper Port mapper stores prog #, version #, and port Client start-up: call clnt_create to locate server port Upon return, client can call procedures at the server
  • 45. SUMMARY  RPCs make distributed computations look like local computations  Issues:  Parameter passing  Binding  Failure handling  Case Study: SUN RPC
  • 46. GROUP COMMUNICATION  One-to-many communication: useful for distributed applications  Issues:  Group characteristics:  Static/dynamic, open/closed  Group addressing  Multicast, broadcast, application-level multicast (unicast)  Atomicity  Message ordering  Scalability
  • 47. PUTTING IT ALL TOGETHER: EMAIL  User uses mail client to compose a message  Mail client connects to mail server  Mail server looks up address to destination mail server  Mail server sets up a connection and passes the mail to destination mail server  Destination stores mail in input buffer (user mailbox)  Recipient checks mail at a later time
  • 48. EMAIL: DESIGN CONSIDERATIONS  Structured or unstructured?  Addressing?  Blocking/non-blocking?  Buffered or unbuffered?  Reliable or unreliable?  Server architecture  Scalability  Push or pull?  Group communication