IO write using O_DIRECT flag with and without memset() after malloc()
Hello,
System: x86_64
Kernel 2.6
I do have an application which does a write operation on raw devices (RAM disk) using O_DIRECT flag. The application simply uses malloc(block_size + PAGE_SIZE) to allocate memory and aligns this buffer before writing in direct mode. Once we run this application, it creates threads using p_threads, say number of threads is 24, and the application hangs without any throughput. Ctrl+C defuncts the application, but dosent come out of it.
The application runs well if we add a line memset(buff, 0, sizeof(buff)).
My query is why this application runs well if we insert memset() after malloc() function? This behaviour seems to be strange.
Please do reply. Thanks.
Regards,
Yogesh
Last edited by naik_yogesh; 04-01-2009 at 11:12 PM.
|