rensselaer polytechnic institute csci 4210 operating systems david goldschmidt ph d
Download
Skip this Video
Download Presentation
Operating Systems {week 10 }

Loading in 2 Seconds...

play fullscreen
1 / 15

Operating Systems {week 10 } - PowerPoint PPT Presentation


  • 116 Views
  • Uploaded on

Rensselaer Polytechnic Institute CSCI-4210 – Operating Systems David Goldschmidt, Ph.D. Operating Systems {week 10 }. Interprocess communication (IPC). Why is it beneficial for an operating system to enable processes to communicate with one another? Share information Cooperation

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Operating Systems {week 10 }' - svea


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
rensselaer polytechnic institute csci 4210 operating systems david goldschmidt ph d
Rensselaer Polytechnic Institute

CSCI-4210 – Operating Systems

David Goldschmidt, Ph.D.

Operating Systems{week 10}

interprocess communication ipc
Interprocess communication (IPC)
  • Why is it beneficial for an operating systemto enable processes to communicatewith one another?
    • Share information
    • Cooperation
    • Computational speed-up viaparallel programming
    • Modularity of program design
    • Convenience
ipc mechanisms
IPC mechanisms
  • Message Passing
  • Shared Memory

both IPC mechanisms

require a protocol

and synchronization

client server communication
Client-server communication
  • Processes may communicate on the same machine or across multiple machines
    • Use sockets for interprocessclient-server communication
    • Use remote procedure calls (RPCs)to call procedures across a network
    • In Java, use remote method invocation (RMI) to call a method on an object in a different virtual machine
remote procedure calls ii
Remote procedure calls (ii)
  • Using RPC, heterogeneous operating systems can interact with one another
marshaling parameters
Marshaling parameters
  • RPCs can be made across a mix ofmachines and operating systems
    • All parameters must be marshaledto ensure proper interpretation
    • Consider date representations
      • YYYY-MM-DD or MM-DD-YYYY or DD-MM-YYYY
    • Also consider big endian versus little endian integer representations
      • (see http://en.wikipedia.org/wiki/Endianness)
remote method invocation
Remote method invocation
  • RMI is a Java mechanism similar to RPCs
    • RMI enables a running Java program to call a method on a remote object running on a separate Java Virtual Machine

this requires

object serialization

sockets i

listener socket

128.113.2.9:80

server

socket

128.113.2.9:9500

client

socket

66.195.8.34:8123

Sockets (i)
  • A socket is an endpoint for communication
    • Communication takes place over a pair of sockets

<ip-address>:<port>

sockets ii
Sockets (ii)
  • Pitfalls of socket-based communication between client and server include:
    • Once a server binds to a port,no other program may listenon that port
    • If client and server do not obeythe rules of the protocol,errors occur
transmitting objects via sockets

server

client

Transmitting objects via sockets
  • In Java, we transmit primitive data types (e.g. int, double) using DataInputStreamand DataOutputStream
    • To transmit objects, use ObjectInputStreamand ObjectOutputStream instead

this requires

object serialization

serializing objects i
Serializing objects (i)
  • Objects exist in a JVM’s memory space
    • To transmit an object over a socket,we must first serialize the object
    • For an object to be serializable, its class definition must implement thejava.io.Serializable interface
    • Also useful for saving runtime objects to a file
serializing objects ii
Serializing objects (ii)
  • The Serializable interface has no methods
    • Simply identifies a class as being serializable
    • And enables the use of readObject() and writeObject() methods of ObjectInputStream and ObjectOutputStream

Student

object

Student

object

network

serialized object

writeObject()

readObject()

serializing objects iii
Serializing objects (iii)
  • Classes that are not serializable include:
    • java.lang.Thread
    • java.io.OutputStream
    • java.net.Socket
    • etc.
  • Such classes refer to operating system resources, which are not serializable
serializing objects iv
Serializing objects (iv)
  • Serialized objects are assigned a unique identifier as a means to version control
    • If you write object X to a socket or file,then modify the source code of class X andrecompile the .class file, loading object Xresults in an InvalidClassException runtime exception
    • All processes must be using the same version
ad