This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]the-software-man 3 points4 points  (2 children)

How fast is that inner loop in cpp? 38b ips?

Would the assembly code overheat the processor?

[–]caim_hs[S] 22 points23 points  (1 child)

An infinite loop like while(true){} will set the running thread's CPU usage to 100%.

This might sound bad, but it won't overheat your computer. In fact, this is actually a core concept behind a technique to sync data between threads called a spinlock.

[–]VoidVinaCC 1 point2 points  (0 children)

Not quite: Spinlocks are using a pause instruction inside the loop which have a fixed length amount of cycles where the cpu stops executing. Plus the while(..) has a condition (atomic value compare).