Communication
10 Questions
9 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

Which of the following statements about blocking and non-blocking file descriptors are correct?

  • Newly allocated file descriptors are usually in non-blocking mode.
  • A non-blocking read system call returns EINTR if it would have to block.
  • Blocking mode causes read system calls to block if there is no pending data and write system calls to block if there is no capacity to write data. (correct)
  • In non-blocking mode, system calls will fail instead of blocking the calling process or thread. (correct)
  • Which of the following statements about connection-less datagram sockets are correct?

  • Due to the low overhead, most of the Internet communication uses connection-less datagram sockets.
  • Connection-less datagram sockets requires that applications handle communications errors as part of the application logic. (correct)
  • Connection-less datagram sockets have very low overhead. (correct)
  • Applications can use a single datagram socket to communicate with many servers concurrently. (correct)
  • Which of the following statements about connection-oriented stream sockets are correct?

  • Stream sockets ensure that data is delivered in the order it was sent; any problems caused by missing or duplicated or out-of-order packets are dealt with by the kernel. (correct)
  • The kernel passes newly established connections one-by-one to the application by allocating a file descriptor for a new socket representing the connection. (correct)
  • A server prepares a socket and then asks the kernel to listen for incoming connection requests. (correct)
  • Applications can use a single stream socket to communicate with many servers concurrently.
  • Which of the following statements about file descriptors are correct?

    <p>By convention, the file descriptor 0 refers to the standard input, the file descriptor 1 refers to the standard output, and the file descriptor 2 refers to the standard error. (A), Active file descriptors can be copied to other file descriptors, which allows a programmer to redirect the standard input, standard output, and standard error of a process. (B), A file descriptor is an index into the file descriptor table. A file descriptor table entry refers to the details of the input/output mechanism associated with the file descriptor. (C)</p> Signup and view all the answers

    Which of the following statements about Internet addresses are correct?

    <p>The Internet protocol version 4 (IPv4) uses 32-bit addresses while the Internet protocol version 6 (IPv6) uses 128-bit addresses. (A), Internet addresses are associated with network interfaces and a network interface can have multiple IPv4 and IPv6 addresses. (B), The IP addresses 127.0.0.1 and ::1 both refer to the local host via the loopback network interface. (C), The IP addresses 0.0.0.0 and :: can be used to match any IPv4 and any IPv6 addresses. (D)</p> Signup and view all the answers

    Which of the following statements about multiplexing input/output are correct?

    <p>Event driven programs can be very efficient but they are more difficult to understand than regular programs since the program logic is scattered over many callback functions. (A), The select() system call can be used to pause a process for a certain amount of time. (B), The select() system call can be used to determine if sockets are readable, writable, or have exceptions pending. (C), In event-driven programming, the application logic is implemented by callback functions, which are called by the main event loop when events are detected. (D)</p> Signup and view all the answers

    Which of the following statements about name resolution are correct?

    <p>A computer name can resolve to multiple addresses belonging to the same address family. (B), The getaddrinfo() function can be used to convert an address into a numeric character string representation. (C), The name resolution functions support an argument that can filter the addresses returned. (D)</p> Signup and view all the answers

    Which of the following statements about pipes are correct?

    <p>Pipes are unidirectional communication channels over which processes can send a stream of bytes. (A), The endpoints of a regular pipe are identified by two file descriptors. (B), The endpoints of a named pipe are identified by a special file system object. (C)</p> Signup and view all the answers

    Which of the following statements about signals are correct?

    <p>Signals can interrupt the execution of blocking system calls. (A), The POSIX API improves the C language API for signal handling by providing mechanisms to block signals, by providing more details for certain kinds of signals to signal handler functions, and by allowing applications to control the lifetime of signal handlers as well the restarting of interrupted system calls. (B), The set of different signals that a kernel can deliver is fixed and can’t be enlarged dynamically. (D)</p> Signup and view all the answers

    Which of the following statements about socket addresses are correct?

    <p>A struct sockaddr_in adds an IPv4 address member and a port number member to a generic socket address. (A), A struct sockaddr represents a generic socket address and has the address family and optionally on BSD systems the address length as members. (B), A struct sockaddr_in6 adds next to an IPv6 address member, a port number member, a flow information member, and a scope identifier to a generic socket address. (C)</p> Signup and view all the answers

    Flashcards

    Blocking file descriptors

    Read/write system calls block if no data/capacity.

    Connection-less datagram sockets

    No connection, applications handle errors.

    Connection-oriented stream sockets

    Data order guaranteed, kernel handles errors.

    File descriptor 0

    Standard input.

    Signup and view all the flashcards

    File descriptor 1

    Standard output.

    Signup and view all the flashcards

    File descriptor 2

    Standard error.

    Signup and view all the flashcards

    IPv4 address

    32-bit Internet address.

    Signup and view all the flashcards

    IPv6 address

    128-bit Internet address.

    Signup and view all the flashcards

    Socket address struct sockaddr_in

    Adds IPv4 address and port to generic socket address.

    Signup and view all the flashcards

    Multiplexing I/O

    Event-driven programs handle multiple I/O channels.

    Signup and view all the flashcards

    More Like This

    CS131 Week 5 and Week 6
    22 questions
    Standard I/O Library Overview
    92 questions
    Chapter 5: Create and Edit Text Files
    48 questions
    Use Quizgecko on...
    Browser
    Browser