ClientServer Communication n Sockets Remote Procedure Calls Remote

  • Slides: 18
Download presentation
Client-Server Communication n Sockets Remote Procedure Calls Remote Method Invocation (Java)

Client-Server Communication n Sockets Remote Procedure Calls Remote Method Invocation (Java)

Sockets n n n A socket is defined as an endpoint for communication Concatenation

Sockets n n n A socket is defined as an endpoint for communication Concatenation of IP address and port The socket 161. 25. 19. 8: 1625 refers to port 1625 on host 161. 25. 19. 8 Communication consists between a pair of sockets Low level: Sends/receives a stream of bytes. Sockets are either connection-oriented (i. e. , TCP) or connectionless (i. e. , UDP).

Socket Communication

Socket Communication

Remote Procedure Calls n n Remote procedure call (RPC) abstracts procedure calls between processes

Remote Procedure Calls n n Remote procedure call (RPC) abstracts procedure calls between processes on networked systems. Stubs – client-side proxy for the actual procedure on the server. The client-side stub locates the server and marshalls the parameters. The server-side stub receives this message, unpacks the marshalled parameters, and performs the procedure on the server. n Returns output of procedure (if applicable).

Remote Method Invocation n Remote Method Invocation (RMI) is a Java mechanism similar to

Remote Method Invocation n Remote Method Invocation (RMI) is a Java mechanism similar to RPCs. RMI allows a Java program on one machine to invoke a method on a remote object. Can send objects to remote JVM

Single and Multithreaded Processes

Single and Multithreaded Processes

Benefits n n Responsiveness (e. g. , Web server). Resource Sharing (several threads of

Benefits n n Responsiveness (e. g. , Web server). Resource Sharing (several threads of control within a common address space). Economy (threads are often termed lightweight processes). Much cheaper to create and manage. Utilization of MP Architectures

User vs Kernel Threads n User Threads: n n n Thread management done by

User vs Kernel Threads n User Threads: n n n Thread management done by user-level threads library. When one thread blocks, the process blocks. Kernel Threads: n n n Supported by the kernel. When one thread blocks the OS can pick another thread within the same process to execute. Allows overlapping of (for example) computation and I/O requests.

Kernel Threads n Examples n n n Windows XP/2000 Solaris Linux Tru 64 UNIX

Kernel Threads n Examples n n n Windows XP/2000 Solaris Linux Tru 64 UNIX Mac OS X

Multithreading Models n Many-to-One n One-to-One n Many-to-Many

Multithreading Models n Many-to-One n One-to-One n Many-to-Many

Many-to-One n n n Many user-level threads mapped to single kernel thread. Possible to

Many-to-One n n n Many user-level threads mapped to single kernel thread. Possible to overlap I/O computation? Examples: n Solaris Green Threads n GNU Portable Threads

Many-to-One Model

Many-to-One Model

One-to-One n n Each user-level thread maps to kernel thread Examples n n n

One-to-One n n Each user-level thread maps to kernel thread Examples n n n Windows NT/XP/2000 Linux Solaris 9 and later

One-to-one Model

One-to-one Model

Many-to-Many Model n n Allows many user level threads to be mapped to many

Many-to-Many Model n n Allows many user level threads to be mapped to many kernel threads Allows the operating system to create a sufficient number of kernel threads Solaris prior to version 9 Windows NT/2000 with the Thread. Fiber package

Many-to-Many Model

Many-to-Many Model

Two-level Model n n Similar to M: M, except that it allows a user

Two-level Model n n Similar to M: M, except that it allows a user thread to be bound to kernel thread Examples n n IRIX HP-UX Tru 64 UNIX Solaris 8 and earlier

Two-level Model

Two-level Model