Pages

Thursday, February 6, 2014

Lab #2

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. 
     
     a) (M/R) + D = ?
      
          (M/R) = 10mb / 1Gbps                                               D = 3600 / 299792458
                     = (10 * 10485) * 8 / 1000000000                        = 0.0000120083s * 1000
                     = 0.083886s * 1000                                             = 0.012ms 
                     = 83.886ms

                                                      (M/R) + D = 83.886ms + 0.012ms
                                                                        = 83.898ms
     b) (M/R) + D = ?
       
          (M/R) = (10 * 10485) * 8 / 10                                     D = 2 / 299792458
                     = 8388608 * 1000                                                 = 0.0000000066728 * 1000
                     = 8.388608ms                                                       = 0.0000066728ms

                                                      (M/R) + D = 8.388608ms + 0.0000066728ms
                                                                        = 8.38861467ms

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.

    First lets define the word "pipe." Pipe is used when a data flow is connected from one process to
    another. The simplest way of passing data between two programs is with the "popen" and "pclose"
    functions.

    Functions used for implementing ICP : popen(): opens a file stream from one program to another.
                                                                   pclose(): closes the file stream which was opened by popen.

    Functions needed for communication using shared memory: shmget(): to access shared memory.
                                                                                                     shmctl(): shared memory controls.
                                                                                                     shmat(): attaches shared memory
                                                                                                                    segment.
                                                                                                     shmdt(): detaches shared memory
                                                                                                                    segment.

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(): reads the data from the open file.
     fwrite(): writes data into the open file.

1 comment:

  1. your calculations are not making sense. you got the product of 1024*1024 wrong.
    You did not write a sample program for fread and fwrite. You should do this ASAP because we are going to need these in the group project!

    ReplyDelete

Note: Only a member of this blog may post a comment.