Creating A GUI from scratch in C++ or assembly [closed]

In order to create a window you’ll need to interface with whatever windowing system is currently present on your operating system. This will either require system calls if the window manager runs in kernel space (as is the case in Windows) or some sort of interprocess communication for user space window managers (like X). To … Read more

Why does compiler inlining produce slower code than manual inlining?

Short Answer: Your asd array is declared as this: int *asd=new int[16]; Therefore, use int as the return type rather than bool. Alternatively, change the array type to bool. In any case, make the return type of the test function match the type of the array. Skip to bottom for more details. Long Answer: In … Read more

Relative performance of swap vs compare-and-swap locks on x86

I assume atomic_swap(lockaddr, 1) gets translated to a xchg reg,mem instruction and atomic_compare_and_swap(lockaddr, 0, val) gets translated to a cmpxchg[8b|16b]. Some linux kernel developers think cmpxchg ist faster, because the lock prefix isn’t implied as with xchg. So if you are on a uniprocessor, multithread or can otherwise make sure the lock isn’t needed, you … Read more

Difference between “section” and “segment” in NASM

From the nasm documentation: The SECTION directive (SEGMENT is an exactly equivalent synonym) Nasm can produce output in various formats, some of which support sections. Certain section names can be arbitrary (such as the three you listed), for them only the section flags count. The predefined ones are just convenience shortcuts, .text is marked as … Read more

Does a memory barrier ensure that the cache coherence has been completed?

The memory barriers present on the x86 architecture – but this is true in general – not only guarantee that all the previous1 loads, or stores, are completed before any subsequent load or store is executed – they also guarantee that the stores have became globally visible. By globally visible it is meant that other … Read more