The Gateway to Computer Science Excellence

First time here? Checkout the FAQ!

x

+27 votes

In a packet switching network, packets are routed from source to destination along a single path having two intermediate nodes. If the message size is 24 bytes and each packet contains a header of 3 bytes, then the optimum packet size is:

- 4
- 6
- 7
- 9

+48 votes

Best answer

**Correct answer should be option (d)**

As we know in packet switching .... dividing message into packets decrease the

transmission time due to pipelined transmission.

but if there are many packets beyond some threshold then transmission time may

increase .. so we can do by option checking

**1.** packet size $=4 =\text{ packet data + header size}= 1+3$

So no. of packets will be $=\dfrac{\text{message}}{\text{packet data}}$

$=\dfrac{24\ B}{1\ B} = 24\text{ packets}$.

So time to reach at receiver for $1^{st}$ packet will be,

$=3 \text{ (source + two intermediate node)}\times \text{transmission time}$

$TT=\dfrac{L}{BW}$... Here, $L$ will be changed according to option and $BW$ will remain same ..

So time to reach at receiver for $1^{st}$ packet will be $=\dfrac{3\times 4}{BW}=\dfrac{12}{BW}$

and for remaining $23$ packets will take time $=23\times TT=\dfrac{23\times 4}{BW}=\dfrac{92}{BW}$

TOTAL TIME $=\dfrac{104}{BW}$

**2. **packet size $= 6 = 3+3\text{ ( packet data + header size)}$ so no of packets will be $8$.

Time to reach at receiver for $1^{st}$ packet will be $=\dfrac{3\times 6}{BW}=\dfrac{18}{BW}$

and for remaining $7$ packet will take time $=\dfrac{7\times 6}{BW}=\dfrac{42}{BW}$

Total time $=\dfrac{60}{BW}$

**3.** packet size $= 7 = 4+3,$ so no of packets $=\dfrac{24}{4}=6\text{ packets}$

For $1^{st}$ packet time will be $=\dfrac{3\times 7}{BW}=\dfrac{21}{BW}$

For remaining $5$ packet will take time $=\dfrac{5\times 7}{BW}=\dfrac{35}{BW}$

Total time$=\dfrac{56}{BW}$.

**4.** packet size $=9=6+3,$ so no of packet will be $4.$

For $1^{st}$ packet time will be $=\dfrac{3\times 9}{BW}=\dfrac{27}{BW}$

For remaining $3$ packets will take time $=\dfrac{3\times 9}{BW}=\dfrac{27}{BW}$

TOTAL time $=\dfrac{54}{BW}$

So, Optimal packet size will be $9\text{ byte}$ due to less total transmission time.

**Alternate method (thanks to sachin )**

In that case we can do it using minimisation of a variable.

Let, $24\text{ byte}$ data is divided into number of packets each have $x\text{ byte}$

of data.

Therefore packet size $=x+3,$ and Number of packets $(k)=\dfrac{24}{x}$.

(it is ceil, if $24$ is not multiple of $x$ )

Total time =$3(x+3)+ (k-1)(x+3)$ (assumed $BW =1,$ just to avoid writing $"BW"$

again and again)

(ignoring propagation delay as it has nothing to do with packet size, if one wish

he/she can add that too but later he will realize it will anyway become zero while differentiating. )

$\Rightarrow$ Total time $=2x+3k+kx+6$ ( $k$ is equal to $\text{24}{x}$ )

$\Rightarrow$ Total time $= 2x+\left(\dfrac{3\times 24}{x}\right)+\left(\dfrac{24}{x\times x}\right)+6$

$\Rightarrow$ Total time $=\dfrac{2x+72}{x+30}$

to minimise this time, diffrentiation should be $0.$

that gives, $2−\dfrac{72}{x^{2}} = 0$

$\Rightarrow x=6$.

including $3\text{ bytes}$ of header, packet size $=9\text{ Bytes}$.

**Option D.**

why remaining 23 packets will take time = 23 *TT

why not 23*3*TT as there are (source + two intermediate node)

PLease Explain ??

why not 23*3*TT as there are (source + two intermediate node)

PLease Explain ??

@ sonam vyas Good explanation. But what if there are no options and it is numerical answer type ? :D

In that case we can do it using minimisation of a variable.

Let 24 byte data is divided into number of packets each have $x$ byte of data.

Therefore packet size = x+3, and Number of packets (**k**) = $\frac{24}{x}$. (it is ceil, if 24 is not multiple of x)

total time = 3(x+3)+ (k-1)(x+3) (assumed BW =1, just to avoid writing "BW" again and again)

(ignoring propagation delay as it has nothing to do with packet size, if one wish he/she can add that too but later he will realize it will anyway become zero while differentiating. )

$\implies$ total time = $2x+3k+kx+6$ (k is equal to $\frac{24}{x}$)

$\implies$ total time = $2x+\left (3\times\frac{24}{x} \right )+\left (\frac{24}{x} \times x \right ) +6$

$\implies$ total time = $2x+ \frac{72}{x} +30$

to minimise this time, diffrentiation should be 0.

that gives, $2-\frac{72}{x^2}$ = 0 $\implies x=6$

including 3 bytes of header, packet size = 9 Bytes.

Option **D**.

@sonam plz explain what do u mean by

" so time to reach at receiver for 1st packet will be = 3(source + two intermediate node)* transmission time"

" so time to reach at receiver for 1st packet will be = 3(source + two intermediate node)* transmission time"

@srestha

she means since there are 2 intermediate nodes(excluding source) means u have to transmit every packet 3 times to reach destination...so for first packet it will take this much time means 3Tt..and for remaining packets only 1 Tt(simply pipelining)...

she means since there are 2 intermediate nodes(excluding source) means u have to transmit every packet 3 times to reach destination...so for first packet it will take this much time means 3Tt..and for remaining packets only 1 Tt(simply pipelining)...

He he...thnks for compliment :)

And i am not "sir" Just an aspirant like u :)

I am also big fan of u :D :)

And i am not "sir" Just an aspirant like u :)

I am also big fan of u :D :)

Ok, dont assume it.

U will get total time = $\frac{1}{\text{ BW }}\times [3(x+3)+ (k-1)(x+3)]$

and at the end after diffrentiation, u will get this- $\frac{1}{\text{ BW }}\times [2- \frac{72}{x^2}] = 0$. It wont effect anything.

By the way, u can solve same question focusing on last packet (instead of first packet)

(we know that the moment last packet reaches destination, all other packets are already reached.)

Let Number of packets (k) = $\frac{24}{x}$ (where $x$ is size of data in single packet.)

each packet size is = $x+3$

Total Bytes needs to transmitted from source = $24+3k$ ($k$ packets and each has 3 byte of header.)

Transmission time of all packets from source = $\frac{24+3k}{\text{ BW }}$ (u can take BW =1, to avoid writing it.)

Now see the time last packet takes, it got transmitted to two intermediate notes and it takes 3 propagation delay time. (of course last packet got transmitted from source also, but this time is already included in $\frac{24+3k}{\text{ BW }}$)

Time for last packet = $2 \times \text{transmission time }+3 \times \text{propagation time }$

=$2 \times \frac{x+3}{\text{ BW }}$ (ignoring propagation time)

Total time = $\frac{24+3k}{\text{ BW }} + 2 \times \frac{x+3}{\text{ BW }}$

after putting $k=\frac{24}{x}$ and differentiating wrt $x$, u will get same equation as previous which is $2-\frac{72}{x^2}=0$

U will get total time = $\frac{1}{\text{ BW }}\times [3(x+3)+ (k-1)(x+3)]$

and at the end after diffrentiation, u will get this- $\frac{1}{\text{ BW }}\times [2- \frac{72}{x^2}] = 0$. It wont effect anything.

By the way, u can solve same question focusing on last packet (instead of first packet)

(we know that the moment last packet reaches destination, all other packets are already reached.)

Let Number of packets (k) = $\frac{24}{x}$ (where $x$ is size of data in single packet.)

each packet size is = $x+3$

Total Bytes needs to transmitted from source = $24+3k$ ($k$ packets and each has 3 byte of header.)

Transmission time of all packets from source = $\frac{24+3k}{\text{ BW }}$ (u can take BW =1, to avoid writing it.)

Now see the time last packet takes, it got transmitted to two intermediate notes and it takes 3 propagation delay time. (of course last packet got transmitted from source also, but this time is already included in $\frac{24+3k}{\text{ BW }}$)

Time for last packet = $2 \times \text{transmission time }+3 \times \text{propagation time }$

=$2 \times \frac{x+3}{\text{ BW }}$ (ignoring propagation time)

Total time = $\frac{24+3k}{\text{ BW }} + 2 \times \frac{x+3}{\text{ BW }}$

after putting $k=\frac{24}{x}$ and differentiating wrt $x$, u will get same equation as previous which is $2-\frac{72}{x^2}=0$

Thanks;You solved my BW=1 doubt..

But according to ur next approach to deal with this question i m not getting ur below quote:-

Transmission time of all packets from source =( 24+3k) /BW

I think you are not considering here pipelining . Bcoz u r giving all load of transmission to source only.

Plz correct me !

Of course, i am considering pipeline here, just to get a shorthand calculation, I wrote directly.

U can do like this-

I want to calculate transmission time of all packets from the source.

Transmission time for one packet = $\frac{x+3}{BW}$.

there are such $k$(=$\frac{24}{x}$) packets, so toal transmission time from source = $k \times \frac{x+3}{BW}$ = $\frac{kx+3k}{BW} = \frac{24+3k}{BW}$

But it sould be preferable to write directly $\frac{24+3k}{BW}$, because i know that, this is total data that needs to transmissted from source.

U can do like this-

I want to calculate transmission time of all packets from the source.

Transmission time for one packet = $\frac{x+3}{BW}$.

there are such $k$(=$\frac{24}{x}$) packets, so toal transmission time from source = $k \times \frac{x+3}{BW}$ = $\frac{kx+3k}{BW} = \frac{24+3k}{BW}$

But it sould be preferable to write directly $\frac{24+3k}{BW}$, because i know that, this is total data that needs to transmissted from source.

Thanks Understood.

Just need confirmation of below to points.

And suppose they will give propagation time in question:-

1.If they ask abt optimal packet size then ignore it.

2.if they ask total time from source to destination then include it.

is n't it?

Just need confirmation of below to points.

And suppose they will give propagation time in question:-

1.If they ask abt optimal packet size then ignore it.

2.if they ask total time from source to destination then include it.

is n't it?

Yes u r right.

For 2nd statement, u can check this GATE question- https://gateoverflow.in/2153/gate2012_44

I commented there also.

For 2nd statement, u can check this GATE question- https://gateoverflow.in/2153/gate2012_44

I commented there also.

+19 votes

**option D**

packet size $P = p+h$. where, $h$ is header size and

$p=\sqrt{\dfrac{hx}{k-1}}$ where, $x$ is message size and $k$ is no. of hopes.

so $p=\sqrt{\dfrac{3\times 24}{2}}=\sqrt{\dfrac{72}{2}}=\sqrt{36}= 6$

so Optimum packet size is $ 6 + 3 = 9.$

+6 votes

suppose x=message size, h=header size, p=payload/packet date size ,assume bandwidth is b bps,no of hopes=k

total no of packets= x/p

--->> when message is packetized then these are send in a pipelined manner to reduce transmission time but thereis a threshold on packet size p hence it may not be more large or more small it must be optimum (??)

now we first derive transmission time ("ist packet takes transmissioon delay by all the intermediate nodes and source or transmission delay on all hopes and rest all packets take onle one hope transmission delay due to pipeline ")

transmission time =tt=

(p+h)*k / b +(x/p - 1)*(p+h)/b

=1/b( (p+h)*k + 1/p (x-p) (h+p))

// so resultantely we want to find minimum transmission delay at optimum packet size so differentiate tt w.r.t. p we get //

dtt/dp= 1/b(k*p^{2 }-p^{2}-xh)=0

so p^{2 }=(xh/k-1) or p=√(xh/k-1)

here h=3 x=24 k=3

p=√(24*3)/2 =6

so packet size =p+h=6+3=9 bytes

+2 votes

Dividing a message into packets may decrease the transmission time due to parallelism as shown in the following figure. But after a certain limit reducing the packet size may increase the transmission time also. Following figure shows the situation given in question. Let transmission time to transfer 1 byte for all nodes be t. The first packet will take time = (packet size)*3*t. After the first packet reaches the destination, remaining packets will take time equal to (packet size)*t due to parallelism.

If we use 4 bytes as packet size, there will be 24 packets Total Transmission time = Time taken by first packet + Time taken by remaining packets = 3*4*t + 23*4*t = 104t If we use 6 bytes as packet size, there will be 8 packets Total Transmission time = 3*6*t + 7*6*t = 60t If we use 7 bytes as packet size, there will be 6 packets Total Transmission time = 3*7*t + 5*7*t = 56t If we use 9 bytes as packet size, there will be 4 packets Total Transmission time = 3*9*t + 3*9*t = 54t

- All categories
- General Aptitude 1.2k
- Engineering Mathematics 4.7k
- Digital Logic 1.9k
- Programming & DS 3.5k
- Algorithms 3k
- Theory of Computation 3.7k
- Compiler Design 1.5k
- Databases 2.8k
- CO & Architecture 2.5k
- Computer Networks 2.9k
- Non GATE 837
- Others 1.2k
- Admissions 278
- Exam Queries 396
- Tier 1 Placement Questions 17
- Job Queries 50
- Projects 7

33,687 questions

40,230 answers

114,269 comments

38,798 users