Questions tagged [busy-waiting]

101 questions
1
vote
0 answers

What could be the interpretation of these strace outputs?

I have a problem with a calculus software in Linux (Ubuntu 20.04). When I submit a calculus, the work is performed perfectly. The log file indicates that everything was completed successfully and all the results are perfect. The problem arises when…
1
vote
0 answers

how to avoid busy waiting between python unrelated processes

i have two python unrelated subprocces, and my wait method was something like the following def wait(self): LIMIT = 3 t0 = time.time() while 1: message = self.__read_message() if message != '\x00': break …
void
  • 98
  • 8
1
vote
0 answers

Is there an efficient busy waiting method in kernel?

Suppose a process is waiting for a lock held by some other process. Either it spinlocks (Busy waits) or it goes to sleep, to be woken up when the lock is released. If the waiting time is too much, it is better to sleep, since too much resources will…
1
vote
0 answers

Is it bad practice to use Thread.yield() when busy-looping?

I have a thread busy-looping until my ServerSocket object binds to a port before doing any read/write operation. new Thread(() -> { while (!server.isBound()) { Thread.yield(); // hmm ... any better alternative???? } while…
Doga Oruc
  • 783
  • 3
  • 16
1
vote
3 answers

Avoid Busy waiting when waiting for a signal

I am trying a write a code which can be easily ported to any MCU. This MCU will act as a host and communicate with another audio codec chip. When communicating with the chip, host MCU will write a request to chip and will wait for an interrupt line…
Rohit Walavalkar
  • 790
  • 9
  • 28
1
vote
2 answers

Is there a standard function to busy wait for a condition or until a timeout

I need to wait in my program for a subsystem. In different places a have to wait for different conditions. I know I could also make use of threads and conditions variables. But since the subsystem (bare metal programmed in C) is connected via…
florgeng
  • 856
  • 1
  • 9
  • 17
1
vote
1 answer

Is select() a busy wait system call?

int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); Question: Irrespective of timeout argument passed, Does select() occupy CPU cycles, until any file descriptor is ready?
overexchange
  • 15,768
  • 30
  • 152
  • 347
1
vote
1 answer

Thread stuck busy waiting under some circumstances and not under others

I'm having a pretty weird problem with a java thread busy-waiting. I have one thread that busy waits on the state of a static variable of some other thread. Let's say the thread that busy waits is waiting for another thread's static int variable to…
Manuel
  • 2,143
  • 5
  • 20
  • 22
1
vote
0 answers

Kafka highlevel consumer consumerIterator thread blocking?

I've implemented a Kafka highlevel consumer from group : 'org.apache.kafka' ,name :'kafka_2.10' ,version : '0.9.0.1' in Java. I noticed that consumerIterator is thread blocking. It's hasNext() won't return until a new msg comes to consume. I use…
Vithulan
  • 300
  • 1
  • 11
1
vote
1 answer

listening to fifo without busy waiting in linux (C linux)

I've created a FIFO (with mkfifo()) and I need to wait till some process writes data several times into it. I've written the following code: (ignore the bad style, it's to keep the example concise) int count = 0, read = 0; while(count < 2) { …
sel
  • 483
  • 5
  • 16
1
vote
1 answer

Why does busy-wait of less than 15ms are inconsistent?

I am doing simulation project where i have hundred of CPU-Bound jobs running for 10 to 50 milliseconds. The Job is a Runnable object with specified running-time for which the job will keep CPU busy. There are 10 threads waiting in a thread pool for…
Faisal Bahadur
  • 498
  • 3
  • 19
1
vote
2 answers

Is busy wait inconsistent?

I want a busy wait loop for a specific amount of time and I tested the following java code, which gives different outputs on different runs (sometimes). Most of the time it gives 16 and 0. It means one can not trust a busy wait. What is the…
Faisal Bahadur
  • 498
  • 3
  • 19
1
vote
1 answer

Using JProfiler, is there a Recommended Tactic to determine whether app is CPU or Network-bound?

The title asks the crux of the question. Additionally, if there's some pretty graphics in JProfiler that illustrate whether a slow app is CPU, Memory, or Network-bound then I would like to know that as well. I suspect that RTFM would help but it's…
Lonnie
  • 88
  • 1
  • 6
1
vote
1 answer

Controls doesn't show if heavy process

I use c# in winform. Before a very heavy function, I want to show a waiting form to prevent the user. The form opens, but the controls in it are not drawn. In the following code, waitingForm is a little form, with only a textbox and a…
bubarnet
  • 101
  • 9
1
vote
1 answer

avoiding busy wait with boost::asio poll

I'm writing a service on linux that uses boost::asio::io_service with io_service::poll in a while loop. This is a busy wait loop, e.g. it wastes CPU cycles. void Application::run() { try { std::cout << "TcpServer starting..\n"; …
stack user
  • 835
  • 1
  • 9
  • 28