Todays topic: - PowerPoint PPT Presentation

1 / 8
About This Presentation
Title:

Todays topic:

Description:

fork overheads. Is context switching a big problem? Removing the fork overheads ... E.g. pre-fork N multiplexed servers. TCP: Reliable byte stream service. ... – PowerPoint PPT presentation

Number of Views:29
Avg rating:3.0/5.0
Slides: 9
Provided by: wfa
Category:
Tags: fork | todays | topic

less

Transcript and Presenter's Notes

Title: Todays topic:


1
  • Todays topic
  • Preforked server
  • UDP

2
  • Preforked server
  • Main limitation with the concurrent server
  • fork overheads.
  • Is context switching a big problem?
  • Removing the fork overheads
  • Pre-fork N processes and use them forever.

3
Sequential server
Prefork server (example2.c)
socket()
socket()
bind()
bind()
listen()
listen()
N Fork()s
accept()
accept()
read()
accept()
read()
read()
write()
write()
write()
close()
close()
close()
4
  • Preforked server
  • Comparison to other server implementation
    techniques
  • Single CPU, multiple CPUs
  • Concurrent, multiplex, and prefork are building
    blocks for server implementation. One can use a
    combination of techniques.
  • E.g. pre-fork N multiplexed servers.

5
  • TCP
  • Reliable byte stream service.
  • Different ways to build clients and servers
  • Some problems when building clients/servers with
    TCP
  • How to get around blocking I/O
  • Data format conversion
  • Basic assumption whatever sent will eventually
    be received!!
  • UDP
  • Unreliable datagram service.
  • Data may get lost application may need to deal
    with more details in the communication.

6
  • Why UDP
  • Applications that do not need 100 reliability
    communication. E.g VoIP, video stream, DNS
    servers.
  • Applications care a lot about performance high
    performance computing (TCP cares too much about
    other things than performance).
  • Applications that need multicast or broadcast
    (TCP only supports point to point communication).

7
  • Basic UDP service interface
  • Socket, bind, sendto, recvfrom, close

UDP server UDP client socket
socket bind
sendto recvfrom recvfrom sendto
close
TCP server TCP client socket
socket Bind
connect Listen Accept
read/write
close Read/write close

8
  • include ltsys/socket.hgt
  • ssize_t recvfrom(int sockfd, void buff, size_t
    nbytes, int flags, struct sockaddr from,
    socklen_t addrlen)
  • ssize_t sendto(int sockfd, void buff, size_t
    nbytes, int flags, const struct sockaddr to,
    socklen_t addrlen)
  • See example3.c/example4.c for communication using
    UDP.
  • TCP and UDP ports are independent
  • Show lost of packets in UDP? What is the error
    rate? Why?
Write a Comment
User Comments (0)
About PowerShow.com