CS447_Spring2003_Mid..

advertisement
CS 447 Network and Data Communication
Midterm Exam No.1 (SOLUTIONS)
Spring, 2003
7:30-8:45 P.M.
February 25, 2003
This question is a closed book and closed note exam. There are 6 questions in this exam.
You have 75 minutes to finish the questions. Please write your answers on separated
pieces of papers. To avoid grading problems, please staple your papers in the ascending
order in the question number. Please bring a calculator (no calculator sharing, please).
Name: _______________________________
Student ID (optional): ___________________
Question #1 (10 minutes - 20 points)
(1) Name each layer in the OSI seven-layer model (from low level to high level). You do NOT
have to describe them – 6 points
(1) Physical layer
(2) Data-link layer
(3) Network layer
(4) Transport layer
(5) Session layer
(6) Presentation layer
(7) Application layer
(2) What is a network protocol? – 3 points
A protocol is:
(1) a set of rules
(2) that governs communication between two hosts
(3) Implemented as software
(3) What is synchronous transmission (give the brief definition – please mention the one we got
in the classroom)? – 3 points
1
The synchronous transmission is a type of data transmission where a receiver resynchronizes
with a sender at every bit (or a type of data transmission where transmitted signals have
timing information for receiver synchronization).
Note: A similar definition with a correct idea (the underlined part) will be acceptable
(4) Define what is “port” (in socket programming)? How you can choose available port? – 3
points
Port is a logical connecting point for two communicating processes using socket (2 points) .
A user should choose a port with port # 1025 or above (1 point).
Note: the key word is “connecting point”. It’s not a connection, but a connecting point.
(5) What are the five functions that should be handled in the data-link layer (please name the five
functions we discussed in the classroom)? – 5 points
(1) Frame Synchronization
(2) Flow Control
(3) Error Control
(4) Addressing
(5) Control and data management (or distinguish control information from the data)
Question #2 (10 minutes - 20 points)
(1) Show the six procedures of asynchronous transmission at the receiver side – 5 points
 Detect the first downward signal transition
 Adjust the local clock (clock synchronization)
 Receive as many data bits as the receiver is supposed to.
 Receive the parity bit
 Perform parity error detection
 Skip (ignore any signal) stop bit(s)
(2) Sketch the communication between a client and a server using socket (show the direction of
messages and identify all major functions, mention which functions are blocking functions) –
5 points
CS447 - Socket Programming Tutorial
SERVER
socket()
“*” indicates a blocking function call.
CLIENT
socket()
bind()
listen()
1: Connection Request
connect()
*
dge
*
accept()
*
read()
eques
R
write()
nowle
t Ack
write()
2. Send a command
read()
3. Receive the result
close()
close()
Socket.ppt/005
2
*
(3) What is the probability of detectable error for parity error detection using the following
assumptions (all what you need to do is to set up the equation with correct parameters - you
do not have to complete calculation)? – 5 points



10 user bits + 1 parity bit
Bit error rate = p
Ignore start/stop bits
Pr [detectable error] =
11
9 i
n i
 Ignore ““ between “9” and “i”
   P  (1  P)
i
i 1, 3, 5 ,...
(4) Define and describe (a) propagation delay and (b) Frame transmission delay. You can
describe them using a picture (show how the two delays are involved in data transmission in a
picture) – 5 points
Definitions:
(a) Propagation delay: time required for signal to propagate between a sender and a
receiver (1 point).
(b) Transmission delay: time required to send a frame at a sender (1 point).
Description:
Beginning of a
frame transmission
Signal Propagation Delay (Tp)
End of a frame
transmission
Frame
Time
Frame Transmission Delay (Tf)
Link Distance
Question #3 (10 minutes - 20 points)
Answer the questions for the data transmission with the following assumptions:


Asynchronous data transmission
Each of the sender’s and the receiver’s clocks could drift  2minutes in one
year.
3


If a bit signal is sampled within 25% from its center, bit error will not happen
Transmission rate = 1 Kbps (to simplify your calculation use K = 1,000 in
stead of K= 1,024)
(a) How many bits can be transmitted before the first bit error (due to clock drift)
happens?
Assuming that x represents the number of bits that can be transmitted before the first
bit error due to the clock drift happen, the equation will be:
4
 x  0.25 ………………………….(1)
60  24  365
x  32850
(b) If transmission rate is increased from 1 Kbps to 12.5 Mbps, will that affect the result
of question (a) above –answer only by “YES” or “NO. You do NOT have to describe
your answer (any answer that does not say “YES” or “NO” will not get full credit.
Similarly, a solution that intentionally includes both “YES” and “NO” will not get the
full credit, either).
No.
(c) How many bits can be transmitted if synchronous data transmission is used before the
first bit error (due to clock drift) happens?
, since
4
 0.25 and clocks will be resynchronized at every bit
60  24  365
Question #4 (15 minutes - 20 points)
Assume the following assumptions:





Link distance: 400 miles
Transmission rate: 10 Mbps (to save your time, you could use M = 106)
Frame size: 64 bytes (not “64 bits”)
Signal propagation speed = 185 K miles/sec.(similarly, you could use K = 1,000)
Frame error rate (P) = 0.012 (= 1.2%)
(1) What is the maximum possible link utilization for the Stop-and-Wait ARQ can
achieve for this data transmission (calculate the line utilization up to the second
digit after the decimal point)? Please show your work – 8 points.
4

Tf =
64  8
512 51.2
 7  6 = 51.2 s (2 points)
6
10  10
10
10

TP =
400
2.16

= 2.16 ms (2 points)
185 K 10 3
U ( Stop and W ait ARQ) 
T f  (1  P)
2  Tp  T f

51.2  (1  0.012) 50.59

 1.15% (4 points)
2  2,160  51.2
4371.2
(2) If we assume the Selective-Reject ARQ, what is the minimum window size to
achieve 30% utilization? Please show your work – 12 points.
U ( Selective Re ject  ARQ) 
n  T f  (1  P)
(2  T p  T f )  (1  P  n  P)
 0.3 (8 points)
n  51.2  (1  0.012)
 0.3
(2  2,160  51.2)  (1  0.012  n  0.012)
n  50.59
 0.3 (2 points)
4371.2  (0.988  0.012  n)
n
3 4318.7  52.45  n

10
50.59
n
3 4318.7 52.45  n
(

)
10 50.59
50.59
n
3
 (85.36  1.036  n)
10
n  25.60  0.311 n
0.689  n  25.6
Solving the above equation, n  37.15 (2 points)
Question #5 (20 minutes - 10 points)
Note: This is Exercise Question #6.5 from the textbook (Stallings’).
5
An asynchronous transmission scheme uses one-bit start bit, 7 data bits, an even parity bit,
and one-bit stop bit. What percentage of clock inaccuracy can be tolerated at the receiver
with respect to the framing error? Assume that if a bit sample is taken at after (or before)
a bit boundary, then signal of wrong bit will be read. Assume that the sender and
receiver clocks are synchronized (both adjusted to be at the middle of the bit at the start
bit). Since partial credit will be given, show all your work. You could support your
solution by drawing some pictures.
Hint: You need to calculate the rate of clock drift (in %) in such a way that the amount of
clock drift is large enough to possibly cause a frame error (i.e., you need to find the
“necessary condition” for a framing error to happen). There are two different cases
(one for if the receiver clock is too fast and the other for if the receiver clock is too
slow) for a framing error to happen.
Solutions:
There are two cases for a framing error to happen:
Case 1: if the receiver’s clock is fast.
In order for a framing error to happen, the receiver’s clock for the parity bit must happen
at the seventh user data bit. For a framing error to happen, the polarity of the seventh
user data bit must be same as that of the stop bit and the parity bit must be the same
polarity of the start bit (see the figure below).
Frame(i)
1
R1 1
2
3
4
5
6
0
7
1
P
S
R2 1
R: Start Bit
P: Parity Bit
S: Stop Bit
1 – 7: User Data Bits
Time
3 notches (for drift)
18 notches
Let us assume that the stop bit is 1 and that the stop bit is 0. In the figure, the receiver’s
clock is slow and the receiver samples the seventh user data bit for the stop bit. If the
seventh bit is 0 (which is the same as the stop bit) and the parity bit is 1 (which is same as
the start bit). Then the receiver accidentally interprets the parity bit as the start bit of the
next frame, which is a framing error. If the receiver’s clock is not fast enough to take the
seventh bit for the stop bit, a framing error can not happen.
6
In order for this situation to happen, the amount of drift should be larger than 3/18, which
is 16.7%. At the clock drift rate larger than 16.7%, a farming error could happen if the
receiver’s clock is fast.
Case 2: if the receiver’s clock is slow.
In order for a framing error to happen, the receiver’s clock for the stop bit must happen at
the start bit of the next frame. If this happens, the receiver will skip until the next ‘0’
after this (because the start bit is always 1), and use the first 1 as the start bit of the next
frame, which is a framing error. As long as the receiver is late enough so that the
receiver’s clock drifts into a next frame, a framing error will happen (see the figure
below). In order for this situation to happen, the amount of drift should be larger than
1/18, which is 5.5%. At the clock drift rate larger than 5.5%, a farming error could
happen if the receiver’s clock is slow.
Frame(i)
1
R1 1
2
3
4
5
6
7
P
0
S
1
R2 1
R: Start Bit
P: Parity Bit
S: Stop Bit
1 – 7: User Data Bits
Time
1 notch (for drift)
18 notches
Question #6 (10 minutes - 10 points)
For CRC error detection using:


M = “11100011:
P = “11011”
(a) Find the FCS. Show all your work (8 points). For correct FCS, 2 points will be given
and for showing correct work, 6 points will be given.
(b) What is the message that will be transmitted by the sender? Show the message (i.e.,
the bit pattern) the sender will transmit (after CRC code is attached) (2 points)
7
CS 447-Network and Data Communication, Midterm Exam #1, February 25, 2003
8
Download