Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 04-01-2009, 06:28 AM   #1
LQ Newbie
Registered: Feb 2004
Location: Bangalore, Karnataka, India
Distribution: Red Hat Linux 9
Posts: 7

Rep: Reputation: 0
Question IO write using O_DIRECT flag with and without memset() after malloc()


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.


Last edited by naik_yogesh; 04-01-2009 at 11:12 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
mdadm: flag device as write-mostly on pre-existing array zazoo24601 Linux - General 1 08-15-2016 12:22 PM
using memset() functions for graphics gvp87 Programming 2 02-05-2008 05:10 PM
graphic function with memset() gvp87 Programming 1 01-31-2008 12:04 AM
LXer: Linux: Accessing Files With O_DIRECT LXer Syndicated Linux News 0 01-11-2007 07:03 PM
gcc question....on solaris....O_DIRECT Petros Koutoupis Solaris / OpenSolaris 2 09-14-2006 01:53 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:44 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration