1 / 40

Sistem

Sistem. terdistribusi. 3. Interprocess Communication. Prinsip B erkomunikasi. • Source. – generates data (text/binary) to be transmitted Transmitter. •. – Converts data Transmission – Carries data – Ex: TCP/IP Receiver. into transmittable signals System. •. •.

teness
Download Presentation

Sistem

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Sistem terdistribusi 3 InterprocessCommunication

  2. Prinsip Berkomunikasi • Source –generatesdata (text/binary)to be transmitted Transmitter • –Convertsdata Transmission –Carriesdata –Ex:TCP/IP Receiver intotransmittablesignals System • • –Convertsreceivedsignal Destination –Takes incomingdata into data •

  3. Interprocess Communication Processeswithin a system may be independent or cooperating • • independent cooperating • Processondifferentcomputer? • Reasonsforcooperatingprocesses: • Informationsharing • Computationspeedup Modularity Convenience • • Cooperatingprocessesneedinterprocesscommunication(IPC) TwomodelsofIPC • • Sharedmemor • Sharedmemory • Messagepassing

  4. Communications in local

  5. Karakteristik IPC A h i ti •SynchronizationdanAsynchronizationof messages. • Messagedestination: onInternet, addressdanlocalport. using • http://192.168.1.2:8081 • Reliabilitydata:validitydanintegrity. • • Orderingdata: urutanpaketyangdikirim Differentdataprocessing: marshalling/unmarshalling

  6. Kategori IPC : merupakanfasilitasyangmenyediakan • Pipes: merupakanfasilitasyangmenyediakan sistem atau disebuthalf-duplex, yaitu data mengalir • FIFO: fasilitaskomunikasisecaraFIFO(first infirst out). • MiripdenganPipes • Messagediantrikan • Terjadidilocalcomputer • Shared memory : suatuprosesberbagiruangdalam wilayahmemoryakanmampumenulisdan • Dalamsingleprocessing(localcomputer) komunikasisatu arahantarprosesdalam sebuah hanya terjadisatu arah.(localcomputer) h t jdi t h virtual address,sehinggaprosesmanapun akanberbagi wilayahmemoryakanmampumenulisdan membacanya.

  7. Kategori IPC • Mappedmemory : berhubungandengan mapping sebuah file dalam file systemsesuai denganmemoryyangada. Konsepvirtualmemory Localcomputer – – • MessageQueues:mengirim pesansecara asynchronous. – Asynchronousberartiprosespengirimandata berlanjutdisertaisebuaheksekusitanpaharus menunggupenerimamenerimaataumengenal informasitersebut.

  8. Kategori IPC t kt d t di h k • Semaphore : struktur data yang di share ke • Socket : sebagaiendpointdari komunikasidua • RPC (RemoteProcedure Call): adalahsebuah berjalan pada satu host dan mengakibatkan beberapaprosesuntuk sinkronisasi Socket proses pada dua buah sistem komputer. protokol yangmemungkinkanprogramkomputer kode dapat dieksekusi padahost yang laintanpa kebutuhan koneksi secara eksplisit.

  9. Ordinary Pipes Ordinary Pipes allow communication in • Ordinary Pipes standard parent-child style • Producer (parent) writes to one end (the write- • Consumer (child)reads from the other end (the • Require parent-child relationship between end of the pipe) read-end of the pipe) d fh i communicating processes A parent program opens anonymous pipes, and • creates a new processand communicateusing these pipes, or creates several new processes and arranges them

  10. Pipe UsingFIFOas queuescheme l Examplein UNIX ls -l |less

  11. Message Passing z Maybeprovidelatency,incompatibilities latencyincompatibilities

  12. Message Passing BasicOperations –Send > kirim message • R i –Receive> terimamessage • Variations –Connection-orientedvs Connectionless –Buffered vs Unbuffered C –Reliablevs Unreliable • Data representation & hlli f t –Marshalling& unmarshalling> pemformatanmessage

  13. Communication Link Propertiesof communicationlink –Links are established automatically • –A link usually is associated with exactlyone pair of communicatingprocesses –Between each pair there existsexactly one link –The link may be unidirectional, but is usually bi-directional link di i l

  14. Direct Communication Processesmustnameeachotherexplicitly: • send(P,message)–sendamessageto processP • i Q i f Q • receive(Q,message)–receiveamessagefromprocessQ • Propertiesof directcommunication • Linksareestablishedautomatically • Alinkisassociatedwithexactlyonepairofcommunicating processes • Betweeneachpairthereexistsexactlyonelink • Thelinkmaybeunidirectional,butisusuallybi-directional Li k

  15. Indirect Communication Messagesaredirectedandreceivedfromports • Eachporthasauniqueid • Wellknownports:0-1023 Recommended:> 1024-65535 • • Processescancommunicateonlyif theyshareaport • • shareaport • Propertiesof indirectcommunicationlink • Linkestablishedonlyif processesshareacommonport • Alinkmaybeassociatedwithmanyprocesses • Eachpairofprocessesmayshareseveralcommunicationlinks • Linkmaybeunidirectional orbi-directional Linkestablishedonlyifprocesses acommonport

  16. Indirect Communication • Operations createanew/openport send andreceivemessagesthroughport destroya port • • • • Primitivesare definedas: • send(A, message)– senda messageto portA • receive(A,message)– receiveamessagefrom port A

  17. Indirect Communication • Port sharing P1,P2, and P3share portA • P P P • P1,sends; P2andP3receive • Who gets themessage? • Solutions • Allowa linkto be associatedwith at most twoprocesses • Allowonlyoneprocess ata time to execute areceive operation • Allowallprocesses receive the message • Allowthesystemtoselectarbitrarily the receiver. • Senderis notifiedwho thereceiver was. S l i l Allow processes receive the message

  18. Model comm: Syn & Asyn S h • Synchronouscommunication –Acknowledgemust bereceived –Blockingcommunication –Sender/Recipientmustbothactive –Example:Registrationsystem / Chatting • Asynchronouscommunication –No acknowledgeneeded –Non-blockingcommunication Bl ki i ti / Chatting N k l d dd –Messagemaybe queued –Example: Email/ Instant Messenger

  19. Transient & Persistent Comm. • TransientCommunication – Message discardedif failed to delivered immediately –Example: HTTP Request •PersistentCommunication – – Message Example: stored until receiver can accept Email, Messenger it

  20. Group Communications z Multicast:sentto specificgroup :sentto specific z Sender tidak tahu identitas penerima dan berapa yang menerima z Broadcast:sentto everyone z Usedfor z Replication of services/data z Service discovery f / z Eventnotification

  21. Group Communications

  22. Komunikasi Jaringan

  23. Remember: OSI

  24. OSI Layers (1) Ph i l • Physical –Physicalinterfacebetweendevices • Mechanical • • Electrical Functional •Procedural – Contoh:EthernetCARD • Data Link –Meansof activating, maintaining anddeactivating a li bl lik reliablelink –Error detection –Contoh:PPP,Router Contoh:PPP

  25. OSI Layers (2) N t k • Network –Transportofinformation –Contoh:VirtualCircuit&InternetProtocol • Transport –Exchangeof databetweenendsystems –Error free –In sequence/ No sequence –No losses / losses No duplicates/duplicates –No duplicates/duplicates –Quality of service –Contoh: TCP danUDP

  26. OSI Layers (3) S i • Session –Controlof dialoguesbetweenapplications –Recovery • Presentation –Data formatsandcoding –Data compression –Encryption –Contoh:SSL Application • M f li i OSI i –Meansfor applicationsto accessOSIenvironment –Contoh:HTTP,FTP,SMTP

  27. The Message

  28. Konsep Pengiriman Data • • Datadikirimdalambentukpaket Setiap paketmemilikiheaderuntuk keperluanadministrasirouting •Datadisimpandalambodysebuahpaket •Ukuranpaketsangatbervariasi –Ethernet:64 – 1518 byte •BisadikirimkandenganTCP/UDP b d Bi dikii k d

  29. TCP dan UDP • • Duaprotokolpadatransport layer Menggunakankonsepport(16bit) untuk membedakanaplikasi –HTTP: 80, HTTPS: 443, FTP: 21, ...... –Port1-1023: well-knownport HTTP 80 HTTPS 443FTP21 –Port1024-49151:registered port –Portlainbisa digunaka secarabebas –Di Linux: /etc/services

  30. TCP TransmissionControlProtocol, –Reliableconnection Adanyapengecekanerror • pada transport layer • • Dijagaurutanmessage • Komunikasiduplex– duaarah • Segmentasi- TCP PDU –CalledTCPsegment –Includessourceanddestination • Identifyapplications port • Connectionrefersto pairofports • TCPtrackssegmentsbetweenentitiesoneach connection

  31. UDP UserDatagramProtocol Notguaranteeddelivery • • •Nopreservationof sequence • • Noprotectionagainstduplication Minimumoverhead •Addsportaddressingto IP • Contoh:DNS, streaming

  32. Request / Reply

  33. Review Failure model • Processfailure: crash • Deteksi dgn timeout •Communicationfailure: messagedrop • Karena: transmission error, buffer overflow • Arbitraryfailure: prosesmelewatkanstep yangharusdilakukanataumembawadata ygsalah •Data korup, data double

  34. Mekanisme handle failure dapat Timeout, method jika tidak balasan, mengirim • doOperation akan terusrequestmessagesampaitimeout. • Duplicaterequestmessage,server menerimalebihdarisekalirequest • server messagesehinggamemprosesnya berulangkali. solusi : request identifier & filter out duplicate. –

  35. Failure Model of IPC Lostreply message, serverdapat menyimpan hasilproses requestmessage,jikaadarequest message yangsama tidak perlu diproses ulang,servermengirimreplymessage berupahasilprosesdarirequest • • tl hdii message yangtelahdisimpan. • History, server menyimpan struktur rekamanreplymessageyangtelah dikirim.

  36. Sockets Menyediakanjembatankomunikasiantar proses • K ik i t ii k •Komunikasiantarproses:mengirimkan pesanantarsocketpadasatuproses menujusebuahsocketpadaproseslain • BisamenggunakanTCP/UDP C i i dd i l • Connection orienteddan connectionless •Melakukanbindingkesebuahport oriented bi di tertentu

  37. Sockets and ports socket client socket message server anyport agreedport otherports Internetaddress= 138.37.94.248 Internetaddress= 138.37.88.249

  38. Operasi Socket • Socketdapat melakukan operasi: – – – – – Di Koneksikemesinremote Mengirimdata Menerimadata Mentutupkoneksi Bind to a port • tiap mesin yang saling berinterkoneksi, harus terpasang socket. • Hard coded

  39. Masalah Socket t kt dt •Informasipadaprogram : strukturdata •Informasipadamessage: urutanbyte • Dataharusdikonversi sebelumdan sesudahpengirimanagarbisadiproses duapihak • Masalah: representasipadasistem bisa berbeda-beda –ASCIIvsUnicode

  40. Marshalling / Unmarshalling • Marshalling: proseskonversidatamenjadi bentukyangcocok/tepatuntuk transmisi pesanantarhost –Unmarshalling: proseskebalikannya •Pendekatanyangumumdigunakan: Unmarshalling: proses kebalikannya –CORBA dan RMI Marshalling –Java serialization –XML – XML RPC, Web Services

More Related