Problem on simultaneously misaligned memory accesses bugs
Currently facing some problems in our office server, first one is rarely happened bug on address of a pointer/ ‘pMemory’, which is mis-aligned. In ‘pmemeory’ two threads accessed simultaneously(one is read the value and other one is modify the ‘pmemory’, from 0xFFFF FFFF to 0x02de 2c68 ). Again then the first thread read the higher part (0x02de). 8 CPU’s are using to run the program. 0xFFFF FFFF is the original value of ‘pmemory’. However a non-aligned data access impact on the performance of theprocessor. Any suggestion about this?
Re: Problem on simultaneously misaligned memory accesses bugs
Two ways to overcome this problem. You should first aligned the data properly. And then use the locked instruction, which would provide the bus control signal which will permit the extra memory sub-system to separate the access atomic. I think it is the enough to modify the data with LOCK exchange instruction. Remember that on QPI-based systems the data locked instruction data can be very slow.
Re: Problem on simultaneously misaligned memory accesses bugs
I read your post properly and I think that the test of the pointer 0xFFFFFFFF, which indicating you that the pointer is not set yet. You can change it by either the high word or low word similar to 0xFFFF. Generally allocations are aligned on 8 byte, so the lower pointer never be 0xFFFF. If you i9nsert any valid pointer into DWORD it will not have 0xFFFF for the words.
Re: Problem on simultaneously misaligned memory accesses bugs
The address of the pointer 0xFFFF , the higher part of the last few pages of the virtual memory. Operating system in windows or the stack of address in *ux. You should make sure that what you insert into the pointer. Aligning the address of the pointer in DWORD (32 bit system architecture) or QWORD ( 64 bit system architecture) is as dimity would suggest you to assure what writes the operation.
Re: Problem on simultaneously misaligned memory accesses bugs
This kind of issue may overcome, if you make an alignment by forcing a 16 byte data structure. Where SIMD operands are drawn. You can also do this either by using declspec(align(16)), which is used to directs the static variable or mm_malloc(), which is called for an dynamic memory allocation. Both the language originated by the Intel compiler., also supported by the recent version of Visual C++ compiler
Re: Problem on simultaneously misaligned memory accesses bugs
According to my knowledge any misalignment will not be rectify by any means, by any natural algorithm. As for instance the “Motion estimation or motion compensation algorithms” is a good one for the video codec’s. This process is also known as “Macro book”, which is typically processed in 16x16 pixels resolution. The misalignment will be prevents if this will match with the XMM register size in the video frame
Re: Problem on simultaneously misaligned memory accesses bugs
The average pixel is computed in 16x16 blocks. You can see it as a small square shape. In 256 pixel it is shaped as the diagonal, adjacent to the lower right. It is 4 byte length and then divide by 10 to get the average value. The codes for the quarter-pixel interpolation by using SSE2 assembly. To producing the quarter pixel “rowloop” is generally used.