Saturday, March 29, 2014

What is Macro & Macro Processor in System Software and Compiler?

Macro & Macro Expansion
*******

  • Macro works same as subroutine or a function which is used repeatedly whenever we required. Macro definition paced at starting of the program and Macro definition is started using word MACRO and end with word MEND.
  • Each macro should have a unique name.
  • Below is an example of Macro.
           MACRO ----> From here macro has started.        
             INCR &X,&Y ----> This is the declaration of prototype statement of Macro.
             LOAD  &X   ___
             ADD    &Y          |------>
             STORE &X   ___|------> This is the Macro definition. 
        MEND                
  • Now we can use INCR macro in assembly langunage, the assembler will automatically place the LOAD, ADD & STORE opcode with its operand.
  • e.g.
         INCR A,B ---> this statement will do three things instead of INCR A,B
                                  LOAD A 
                                  ADD B
                                  STORE A   
  • The above statement is called Macro Expansion. 



What is Network Bridge and why is it used?

What is Network Bridge and why is it used?
  • It is a network device works on Data Link Layer of OSI model. 
  • Main use of Bridge in the network is to reduce traffic in LAN segments. Now you will ask question how? In previously decade before the technology used for transferring data in a LAN using Broadcasting. Now again you will ask what is broadcasting? in simple word we can say broadcasting means to sending data to all nodes. for example there is a one network segment given in below image. all nodes are connected in LAN.
  • Below image of simple LAN without bridge.

Bridge is used to control the traffic of network
LAN Segments without Bridge


As per above image if host 1 in the network wants to send data to the computer host 4 then data packet with address of node 4 will be sent to all nodes. 

It means nodes 1(one) will send data to both segment of node 1, node 2, node 3, node 4, node 5 and node 6 and so on all node of both segment will check data packet address, if the data packet which is send from node 1 is for their own then it will receive otherwise it will be discarded. 

Due to this broadcasting process LAN traffic and congestion will increased. so reducing traffic congestion Bridge is introduced.  

  • Introduce Bridge in below image.

LAN Segment with Bridge
LAN Segments with Bridge
  
  • As per above image there are two LAN Segment with segment no. 1 and segment no. 2 and bridge device has established. 
  • What will be the process occur when segment 1 of node 1 will send data to node 4 of same segment 1? 
  • After establishment of bridge, data will be broadcast to only segment 1 because node 4 of segment 1 is available in segment 1 only. so bridge will not allow to pass data from segment 1 to segment 2. 
  • If segment 1 and node 1 wants to send data to segment 2 of node 6 then bridge will allow to send data to segment 2 only. 
  •                 
    • Bridge maintains routing table to route a traffic. routing table is shown in above image. it has two port like port 1 for segment 1 and port 2 for segment 2. each port has given mac addresses to communicate with its LAN Segment independently.