Thread: linux writing often on main disk

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    (2) Is my argument about NPTL vs. linuxthreads correct?
    Yes.

    (1) Is his argument about linux writing often to main file system correct?
    I don't think any standard linux distro writes to disk more often than any other linux.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  2. #2
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    re: linux writing to disk: I read a little while ago that because linux, like all *nix, maintains "access times" for the filesystem, this means every disk read must also be complimented by a disk WRITE in order to update the atime. Supposedly all this adds up, so in heavy use situations where the atime is not considered crucial (since the m(odification)time is seperate from the atime, you might wonder when it ever would really be important) you can start linux with the "noatime" kernel parameter which means the kernel no longer writes an atime to disk every time a file is accessed. And this means something like a 10-20% improvement in speed where the disk access is constant.

    Since you are dealing with significance on the order of 25ms and are worried about time wasted with (basically irrelevent) writes to disk, I thot I'd mention that. Google "noatime" and some articles will appear.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  3. #3
    Alessio Stella
    Join Date
    May 2008
    Location
    Italy, Bologna
    Posts
    251
    Quote Originally Posted by CornedBee View Post
    Yes.


    I don't think any standard linux distro writes to disk more often than any other linux.
    I apologize I was not detailed and precise:
    actually his complete argument is that his embedded linux has the main file system on ramdisk and only a subdir as flash
    This would eliminate compact flash progressive corruption (still actually I guess reached in so many years it is not very relevant) and would reduce the time loss
    But I remember I made some tests on Debian with RAMdisk and I found out that the time for writing to ramdisk was only 20% less than writing on hard disk
    Plus as I said our applications would write so little that the compact flash would be corrupted in xxx years so..

  4. #4
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by mynickmynick View Post
    But I remember I made some tests on Debian with RAMdisk and I found out that the time for writing to ramdisk was only 20% less than writing on hard disk
    That just means Linux's filesystem caching is about 80% efficient.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  5. #5
    Alessio Stella
    Join Date
    May 2008
    Location
    Italy, Bologna
    Posts
    251
    Quote Originally Posted by brewbuck View Post
    That just means Linux's filesystem caching is about 80% efficient.
    what you mean? I don't know chaching mechanism in the case of file system.. Is the writing on hard disk delayed after a wriitng on RAM?

  6. #6
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Yes, Linux is generally using any spare memory (memory that isn't currently used by applications or the kernel itself) as a cache for disk operations, so writing to disk will actually just write to memory, and later on write to disk proper.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. ReadyBoost for Linux?
    By cyberfish in forum Tech Board
    Replies: 0
    Last Post: 06-07-2009, 04:52 AM
  2. C99 and int main()
    By cwr in forum C Programming
    Replies: 8
    Last Post: 09-19-2005, 06:54 AM
  3. Writing Linux Drivers
    By Jperensky in forum Linux Programming
    Replies: 1
    Last Post: 03-20-2002, 09:30 AM
  4. void or int for main?:)
    By bigtamscot in forum C Programming
    Replies: 13
    Last Post: 09-27-2001, 03:11 AM