You are on page 1of 5

DATA TRANSFER AND MULTIPLEXING

Types of communication : 1) connectionless

2) connecton oriented

>> stream of data is usually multiplexed with

1. Idleness periods

2. control characters

3.data stream

multiplexing data with data:

>> data[i] array are to be transferred to array rcvd[i].

>> 2 methods for transferring the data:

1) asynchronous multiplexing

2) synchronous multiplexing

Asynchronous multiplexing :

 Data[i] sent along with the identifier I of its array.


 message format : asyn ( I, d)
 advantage: flexibility
 disadvantage: low efficiency

2. synchronous multiplexing:

 data array are sent according to fixed order.


 message format: syn(null,d)
 advantage:efficiency
 disadvantage:null character and flexibility.

order of data array:

var order : array [0…..n-1] of boolean

order can be changed arbitrarily:


var data : array[0……n-1,integer] of 0…r-1

index: array[0……n-1] of integer

index[i] represent the next character to be sent

format of next data character to be sent

data[i] is data [I, index[i]]

protocol: 1) for process p

process p

const r,n {r is character range , n is index range}

var data : array[0……n-1,integer] of 0…r-1,

indx: array[0……n-1] of integer ,{index of data}

i: 0….n-1, { index of index}

order: array[0 …n-1] of Boolean,

nxt: 0…..n-1 ,{index of order}

null: Boolean,

d: 0…r-1

begin { action-1:arbitrary values for range 0 to n-1}

true→{send an asynchronous message}

i:= any

d, index[i]:= data[I, index[i]],index[i]+1;

send asyn(I,d) to q

 order [nxt]→{send a synchronous message}

null,i:=any,nxt

if ~null→ d, index[i]:=data[I,inde[i]],index[i]+1
 null→ d:=0

fi; send syn(null,d) to q

nxt:=nxt+n 1;

do nxt ≠ n-1^ ~ order[nxt]→ nxt:=nxt+ n1

od

 true →{ send a new order message}

order, nxt :=any 0;

do nxt ≠ n-1^ ~ order[nxt]→ nxt:=nxt+ n1

od

send new ord (order, nxt) to q

end

2. For process q:.

process q

const r,n {r is character range , n is index range}

var rcvd: array [0……n-1,integer] of 0…r-1,

indx: array[0……n-1] of integer ,{index of rcvd}

i: 0….n-1, { index of index}

order: array[0 …n-1] of boolean,

nxt: 0…..n-1 ,{index of order}

null: boolean,

d: 0…r-1
begin

rcv asyn(I,d) from p→ rcvd[i, index[i]], index[i] := d, index[i]+1

 rcv syn (null, d) from p →

if null→ skip

 ~null → rcvd[nxt, index[next]],index[nxt] := d, index[nxt]+1

fi;

i , nxt := nxt,nxt +n1;

do nxt ≠I ^~order[nxt] → nxt:= nxt+ n1

od

 rcv new ord(order, nxt) from p→ skip

end

3. encapsulation of data:

source array scr[ I,0….n-1], destination array dst[I,0…n-1]

protocol:

process p

var seq ,txt : integer

par i : 0…n-1

begin

rcv data(txt) from src[i] → send encp(seq,I,txt) to q;

seq :=seq+1
end

process q

var seq ,txt : integer

par i : 0…n-1

begin

rcv encp (seq, i ,txt) from p → { use seq for recording purpose}

send data(txt) to dst[i]

end

You might also like