sistemas centralizados
%
!
'
(
! "
%
#! $
&
'' * ( ,
)
+(
- .0
/
- . 0(
( 4
%'
1
%1
6
2%/.
% ./
1
-
3%/0
.
- %. 2 %
2.0
%
- 9 08
8 :
1
!
; 1 %< 1 =/ +
5
1
?(
-
3%40
5
2 %/.
% ./
1
7
!
"
>49
19:
>
No existe memoria común
Comunicaciones
No existe un estado global del sistema
Grado de Transparencia
EscalablesReconfigurables
?(
>
Modelos de Programación Distribuida
Modelo de Paso de Mensajes
Operaciones send y receive
Analizado en asignatura de S.O.
Modelo RPC
Stubs de cliente y servidor
Visión en Java es RMI
Modelos de Objetos Distribuidos
DCOM de Microsoft
Jini de Sun
CORBA de OMG
?(
>
Modelo de Paso de Mensajes
Mecanismo para comunicar y sincronizar entidadesconcurrentes que no pueden o no quieren compartir
memoria
Llamadas send y receive
Tipología de las llamadas:
Bloqueadas-No bloqueadas
Almacenadas-No almacenadas (en buffer)
Fiables-No Fiables
En Unix:
Pipes con y sin nombre
En Java:
Sockets.
CTJ (Communicating Threads for Java)
?(
>
Modelo General
SOLICITUD
CLIENTE
SERVIDOR
RESPUESTA
NUCLEO
NUCLEO
RED?(
>
%
%
#
>
"
%
%
B
@ A $
%
&
%
;
%
C
B
P
U
E
R
T
O
CLIENTE
SERVIDOR
TCP/UDP
?(
>
App B
App A
Port xxx
Port yyy
App C
Port zzz
PROTOCOLO TCP/UDP
0010111001100010101 Port yyy
Port kkk
P
U
E
R
T
O
CLIENTE
SERVIDOR
Solicitud de conexión
CLIENTE
?(
P
U
E
R
T
O
P
U
E
R
T
OSERVIDOR
PUERTO
>
D
A
;
%
7
%
%
1
%
%;
% %
7
%
%%
%
Accept()
Socket()
Socket creado y activo
?(
>
%
ServerSocket
"
%
%
&
"
% %
Socket
%
ServerSocket L = newServerSocket (num_puerto)
' B
%
%
L.accept();
)
%
%
%B
%
?(
C
%
>
Socket
%
%
%
%
%
"
%
Socket (dirección_IP, puerto);
?(>
%
4
/
<
E
5
G
?(
7
2
& ServerSocket
& Socket
InputStream
%
%%
OutputStream
%%
F
%
>
&
%# B
$
import java.io.*;
import java.net.*;
public class SocketServidor
{
public static final int port = 8080;
public static void main (String [] args)
throws IOException
{
ServerSocket GenSocket = new ServerSocket(port);
System.out.println("El servidoresta escuchando
en: "+ GenSocket);
try{//espera solicitud conexion desde cliente...
Socket enchufe = GenSocket.accept();
} finally { System.out.println("se cierra la
conexión...");
GenSocket.close();
}
}//main
}//SocketServidor
4
/
<
E
5
?(
7
2
& Socket
InputStream
%%
OutputStream
%%
F
%
%
>
!
import java.io.*;
import java.net.*;
public classSocketCliente
{
public static void main (String [] args)
throws IOException
{
//llamando ordenador despacho de al lado...
InetAddress dir_IP =
InetAddress.getByName("150.214.72.96");
Socket enchufe = new Socket (dir_IP, 8080);
System.out.println("Datos socket creado:
"+enchufe);
}//main
}//SocketCliente
"
A
%
!@
;
%
% %
socket
D 1
& socket
socket
getInputStream()getOutputStream()
% %
&%
!
(3
&
SocketChannel
?(
7&
%
F
% %
>
>
#
$
"
' )*+
( **
%&
%
%
8
8
%
%
">
7
#
%
"%
3
read-only
%
% %
%
%
&
! >
3 F
%
B
7
"% #
%
%
8
!$
¡SE ELIMINA LA MEMORIA COMÚN!
?(
>
2%
A
@
wait(), notify(), notifyAll()
>
% "%
3
7
%
%
%
?(
7
%
rendezvous
>Emisor Listo
;
(synchronized).
D%
3
%
%
% 3
%
Canal
;
&
Receptor Listo
>
,
send (B, mensaje)
Proceso A
rendezvous
Proceso B
receive (A, mensaje)
tiempo
?(
>
&
%
7;
!@
run()
&
&
%
%
%
Canal de Salida
public void run()
{ //codigo ejec.
}
Canal de Entrada
#-
",
Process
interfaz csp.lang.Process (análoga a...
Regístrate para leer el documento completo.