70 likes | 233 Views
Broadcasting. Chap 20. Introduction. Use of broadcasting to know server address on the local subnet: resource discovery to minimize network traffic on a LAN Internet applications ARP(Address Resolution Protocol) BOOTP(Bootstrap Protocol) NTP(Network Time Protocol)
E N D
Broadcasting Chap 20
Introduction • Use of broadcasting • to know server address on the local subnet: resource discovery • to minimize network traffic on a LAN • Internet applications • ARP(Address Resolution Protocol) • BOOTP(Bootstrap Protocol) • NTP(Network Time Protocol) • Routing daemons: broadcast routing table
Broadcast Addresses • Subnet-directed: [subnetid, -1] • Normally routers do not forward these broadcasts • most commonly used today • e.g.) ping 203.253.70.255 • Limited broadcast: 255.255.255.255 • must not forwarded by a router • Some systems do not understand a subnet-directed broadcast address and only interpret 255.255.255.255 as a broadcast • TFTP and BOOTP use this address to know IP address of its diskless workstation on bootstrapping procedure
Before broadcasting, set SO_BROADCAST socket option 문제점 만일 timeout이 짧다면 ?? SIGALRM signal이 blocked system call (recvfrom) 이외에서 deliver되면 loop을 빠져 나오지 못함 해결방안 1: recvfrom 외에는 ALRM signal이 뜨지 않게 만들자. 즉, signal을 block시킴. (Fig. 20.6, bcast/dgclibcast3.c) 그래도 race condition이 발생할 수 있음 Race Condition: shared data를 여러 process들이 동시에 access할 때 time-dependent error 발생 Case 1: shared data (global variable) among threads Case 2: dealing with signals signal handler도 일종의 thread로 봐야 dg_cli Function thatbroadcasts bcast/dgclibcast1.c
Correct Solutions for Avoiding Race Condition bcast/dgclibcast5.c