State the pseudo code of the Txside logic for the following

State the pseudo -code of the Tx-side logic for the following protocols. 1-persistent CSMA. Non-persistent CSMA. P-persistent CSMA. No text explanations are required. Just provide the pseudo-code.

Solution

Pseudo code:

Pseudo means imitation or false and code means instructions that written in programming language.

Pseudocode is another programming analysis tool that is used for a planning a program.

Pseudocode is also called the Program Design Language(PDL).

Pseudo code is a compact and informal high-level description of a computer programming alogorithm that uses the structural conventions of programming languGE,BUT is intended for human reading rather than machine reading.

For writing a pseudo code program,there are some lodic structures:

In sequence logic Pseudo code instructions are written in an order in which they are performed and lodic flow is from top to bottom.

Pseudo code:

statement 1

ststement 2

......

ststement n

Im selection logic it is depicted as either an IF..THEN or an IF..THEN..ELSE.

And also known as decision logic.

IF condition THEN

sequence 1

ELSE

sequence 2

ENDIF

In iteration ,it uses structures called DO-WHILE,FOR and the REPEAT-UNTIL.

WHILE condition

sequence

ENDWHILE.

Example for pseudo code:

TASL LIST

Read name,hourly rate,hours worked,deduction rate

Compute gross,deduction,net pay

is gross >=100?

YES : calculate deduction

NO:no deduction

Write name,gross,deduction,net pay

PSEUDO CODE:
READ name,hourlyRate,hoursWorked

grossPay = hourlyRate *hoursWorked

IF grossPay >= 100

deduction = grossPay *deductionrate

ELSE

deduction = 0

ENDIF

netPay = grossPay-deduction

WRITE name,grossPay,deduction,netPay

In the same way we are writing a pseudo code persistent CSMA:

#p- persistent CSMA

N = 1

While N <=max:

Wait(channel_beacuse_free)

send(frame)

wait(timeout)

IF ack:

break # transmission was successful

ELSE:

# timeout

N=N-1

# END.

# there are many transmission attempts.

The pseudo code is often called as persistent CSMA,as the above code describes as the trminal will continously listen to the channel and transmit its frame as the channel becomes free.

NON-PERSISTENT CSMA:

# Non persistenT CSMA

N-1

while N<=max:

IF free (channel):

send(frame)

wait (timeout)

IF received :

break

# transimission was successful

ELSE:

# timeout

N = N+1

ELSE:

wait (random time)

# END

# too many transmissions attempts.

When non-persistent csma terminal senses the transmission channel is to busy ,it waits for a random time before sensing the channel again.

And this improves the channel untilization as soon as the channel becomes free.

 State the pseudo -code of the Tx-side logic for the following protocols. 1-persistent CSMA. Non-persistent CSMA. P-persistent CSMA. No text explanations are re
 State the pseudo -code of the Tx-side logic for the following protocols. 1-persistent CSMA. Non-persistent CSMA. P-persistent CSMA. No text explanations are re
 State the pseudo -code of the Tx-side logic for the following protocols. 1-persistent CSMA. Non-persistent CSMA. P-persistent CSMA. No text explanations are re

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site