Lab 2
February 5, 2014
# 3) Consider a transmission link that is 36000m long and uses 1Gbps transmission speed. How long will it take to transmit a 10MB file along this link? Repeat this question for a 2m long link with 10bps transmission rate. Assume that the propagation speed is equal to the speed of light.
length of transmission= 36,000m
speed of transmission= 1 Gbps
propagation= 3.0*10^8 m/s which equals 299,792,458 m/s
Propagation Delay formula,also represented by (D) formula as shown in the video notes: length/ speed of light also represented by (C)
D= 36,000/299.792,458 m/s
=0.12 m/s
transmission delay formula: M/R + D
M= bits
R= rate
rate= 1 Gbps= 10^9=84 ms
Transmission delay: 10*2^20*8/10^9=84 ms
Latency formula= transmission delay + propagation delay
Latency= 0.12+84= 84.12 ms
Part two of same question:
length of transmission= 2m
speed of transmission= 10bps
propagation speed of light= 3.0*10^8 m/s which equals 299,792,458 m/s
Propagation Delay formula,also represented by (D) formula as shown in the video notes: length/ speed of light also represented by (C)
D=2/299,792,458 ms
=6.67*10^6 ms
transmission delay= 10*2^20*8/10= 8.4*10^9 ms
latency= 6.67*10^-6+8.4*10^9= 8.4*10^9ms
#4) We will start working on a group project that implements “Interprocess communication using pipes”. Pipes is one of the ways to implement IPC. Write a blog that explains the functions needed to implement IPC using pipes and also those needed for communication using shared memory.
popen() : this begins another to send and receive data
pclose() : this ends the file stream that was opened
fread() : this is used to read data from the file opened by the popen
fwrite() : this is used to write data to the file
shmget() : this allows us to accesses memory that is shared
shmctl() : this alters characteristics and permissions of a shared memory
shmat() : this connects memory portions
shmdt() : this breaks memory portions
#5) fread and fwrite are C functions that can read bytes (instead of lines, or strings, char etc) from a file. Describe these functions and also write short programs that demonstrate them.
fread: is used to read data from the file opened
fwrite: is used to write data to a file.
basically they do opposite jobs.
fread function:
size_p fread(void *ptr, size_p size, size_p nmemb, FILE *stream);
fwrite function:
size_p fwrite(const void *ptr, size_p size, size_p nmemb, FILE *stream);
Write a short program with fread and fwrite
ReplyDelete