How continuously spinning sync() call can cause high IO wait?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












From what I undertstand from sync() library call is that it allows a process to flush all dirty buffers to disk




The service routine sys_sync( ) of the sync( ) system call invokes a
series of auxiliary functions:




wakeup_bdflush(0);
sync_inodes(0);
sync_supers( );
sync_filesystems(0);
sync_filesystems(1);
sync_inodes(1);


If i run sync() call once, after that there shouldn't be anything in the buffer.



I am using a tool called stress that when runs with -i flag spawn N workers spinning on sync(),



stress --i 1


This command suppose to consume high IO wait since it keep sending sync() calls,
I confirmed it using ltrace,



sync() = 0
sync() = 0
sync() = 0
sync() = 0
sync() = 0
sync() = 0
sync() = 0
sync() = 0
sync() = 0
sync() = 0
sync() = 0
sync() = 0
sync() = 0
sync() = 0
sync() = 0
sync() = 0
sync() = 0
sync() = 0
sync() = 0
sync() = 0
sync() = 0
sync() = 0
sync() = 0
sync() = 0
sync() = 0
sync() = 0
sync() = 0
sync() = 0
sync() = 0
sync() = 0
sync() = 0
sync() = 0
sync() = 0
sync() = 0
sync() = 0
sync() = 0
sync() = 0


Can someone please explain why continuous sync calls consume a lot of IO? I was assuming that after first sync call buffer should be empty.









share

























    up vote
    0
    down vote

    favorite












    From what I undertstand from sync() library call is that it allows a process to flush all dirty buffers to disk




    The service routine sys_sync( ) of the sync( ) system call invokes a
    series of auxiliary functions:




    wakeup_bdflush(0);
    sync_inodes(0);
    sync_supers( );
    sync_filesystems(0);
    sync_filesystems(1);
    sync_inodes(1);


    If i run sync() call once, after that there shouldn't be anything in the buffer.



    I am using a tool called stress that when runs with -i flag spawn N workers spinning on sync(),



    stress --i 1


    This command suppose to consume high IO wait since it keep sending sync() calls,
    I confirmed it using ltrace,



    sync() = 0
    sync() = 0
    sync() = 0
    sync() = 0
    sync() = 0
    sync() = 0
    sync() = 0
    sync() = 0
    sync() = 0
    sync() = 0
    sync() = 0
    sync() = 0
    sync() = 0
    sync() = 0
    sync() = 0
    sync() = 0
    sync() = 0
    sync() = 0
    sync() = 0
    sync() = 0
    sync() = 0
    sync() = 0
    sync() = 0
    sync() = 0
    sync() = 0
    sync() = 0
    sync() = 0
    sync() = 0
    sync() = 0
    sync() = 0
    sync() = 0
    sync() = 0
    sync() = 0
    sync() = 0
    sync() = 0
    sync() = 0
    sync() = 0


    Can someone please explain why continuous sync calls consume a lot of IO? I was assuming that after first sync call buffer should be empty.









    share























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      From what I undertstand from sync() library call is that it allows a process to flush all dirty buffers to disk




      The service routine sys_sync( ) of the sync( ) system call invokes a
      series of auxiliary functions:




      wakeup_bdflush(0);
      sync_inodes(0);
      sync_supers( );
      sync_filesystems(0);
      sync_filesystems(1);
      sync_inodes(1);


      If i run sync() call once, after that there shouldn't be anything in the buffer.



      I am using a tool called stress that when runs with -i flag spawn N workers spinning on sync(),



      stress --i 1


      This command suppose to consume high IO wait since it keep sending sync() calls,
      I confirmed it using ltrace,



      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0


      Can someone please explain why continuous sync calls consume a lot of IO? I was assuming that after first sync call buffer should be empty.









      share













      From what I undertstand from sync() library call is that it allows a process to flush all dirty buffers to disk




      The service routine sys_sync( ) of the sync( ) system call invokes a
      series of auxiliary functions:




      wakeup_bdflush(0);
      sync_inodes(0);
      sync_supers( );
      sync_filesystems(0);
      sync_filesystems(1);
      sync_inodes(1);


      If i run sync() call once, after that there shouldn't be anything in the buffer.



      I am using a tool called stress that when runs with -i flag spawn N workers spinning on sync(),



      stress --i 1


      This command suppose to consume high IO wait since it keep sending sync() calls,
      I confirmed it using ltrace,



      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0
      sync() = 0


      Can someone please explain why continuous sync calls consume a lot of IO? I was assuming that after first sync call buffer should be empty.







      linux





      share












      share










      share



      share










      asked 7 mins ago









      MaverickD

      525




      525

























          active

          oldest

          votes











          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f475500%2fhow-continuously-spinning-sync-call-can-cause-high-io-wait%23new-answer', 'question_page');

          );

          Post as a guest



































          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f475500%2fhow-continuously-spinning-sync-call-can-cause-high-io-wait%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          How to check contact read email or not when send email to Individual?

          Displaying single band from multi-band raster using QGIS

          How many registers does an x86_64 CPU actually have?