Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6559601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:21:00+00:00 2026-05-25T13:21:00+00:00

In my application, threads need to pause for a very little time (100s of

  • 0

In my application, threads need to pause for a very little time (100s of clock cycles). One way to pause is to call nanosleep, but I suppose it requires a system call to the kernel. Now I want to pause without going to the kernel.

Note that I have enough cores to run my threads on and I bind each thread to a separate core, so even an instruction that can halt the core for a little while would be good. I am using x86. I just want the thread to halt while pausing. I don’t want a busy loop or a system call to the kernel. Is it possible to do this? What is the minimum time I can pause a thread?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T13:21:00+00:00Added an answer on May 25, 2026 at 1:21 pm

    _mm_pause in a busy-wait loop is the way to go.

    Unfortunately the delay it provides can change with each processor family:

    http://siyobik.info/main/reference/instruction/PAUSE

    Example usage for GCC on Linux:

    #include <xmmintrin.h>
    
    int main (void) {
        _mm_pause();
        return 0;
    }
    

    Compile with MMX enabled:

    gcc -o moo moo.c  -march=native
    

    Also you can always just use inline assembler:

    __asm volatile ("pause" ::: "memory");
    

    From some Intel engineers, you might find this useful to determine the cost of pausing:

    NOP instruction can be between 0.4-0.5 clocks and PAUSE instruction
    can consume 38-40 clocks.

    http://software.intel.com/en-us/forums/showthread.php?t=48371

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to parallelise an application using win32 threads. One of the portions of
I need to find a way to enumerate all my iPhone application's active threads.
I have multiple threads (C# application running on IIS) running that all need to
I wrote little WPF application with 2 threads - main thread is GUI thread
I have two threads in an Android application, one is the view thread, and
I need to call this external command qconf from my application without freezing it
In my java application I have many threads, but there are several most important
I need to run some method in Swing application in separate thread. What is
I need to kill specific worker thread in my application. I don't have any
i want to get list of all application or Threads attached with a process.For

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.