read() and write() behavior in *NIX

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jorba101
    New Member
    • Jun 2008
    • 86

    read() and write() behavior in *NIX

    When the file descriptor on which read() and write() apply is set up in such a way so that these syscalls block (for instance, until no data is available to read() from a serial port), I wonder following:

    What's the processor doing with this process while waiting, in general, in a *NIX? Is it busy-waiting, or sleeping?
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    It's going to schedule another task/process because your task can't run anymore.

    kind regards,

    Jos

    Comment

    • jorba101
      New Member
      • Jun 2008
      • 86

      #3
      Who'll remember my task is waiting for a semaphore? The OS?

      Comment

      • mac11
        Contributor
        • Apr 2007
        • 256

        #4
        Originally posted by jorba101
        Who'll remember my task is waiting for a semaphore? The OS?
        I would say so - process scheduling is part of the OS's job description.

        Comment

        Working...