LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices



Reply
 
Search this Thread
Old 04-01-2009, 07:28 AM   #1
naik_yogesh
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()


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-02-2009 at 12:12 AM.
 
  


Reply


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
using memset() functions for graphics gvp87 Programming 2 02-05-2008 06:10 PM
graphic function with memset() gvp87 Programming 1 01-31-2008 01:04 AM
LXer: Linux: Accessing Files With O_DIRECT LXer Syndicated Linux News 0 01-11-2007 08:03 PM
mdadm: flag device as write-mostly on pre-existing array zazoo24601 Linux - General 0 12-18-2006 12:39 PM
gcc question....on solaris....O_DIRECT Petros Koutoupis Solaris / OpenSolaris 2 09-14-2006 02:53 PM


All times are GMT -5. The time now is 04:04 PM.

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