Udoo freeze for 30 seconds

Discussion in 'General Programming Discussion' started by stefben, Jan 28, 2014.

  1. stefben

    stefben New Member

    Joined:
    Jan 28, 2014
    Messages:
    3
    Likes Received:
    0
    Hi all,
    I am using Udoo quad with 12.10 ubuntu (i have update from 11.10 and for each version i have had the same problem).
    I have wrote an application (as a while true) that stay in execution and each maximun 15 ms he restart. I have seen that if i write something on the sd card (for example i make a copy of a 60 MB file) the execution time of this application increase untill 30000 ms. In my opinion the execution time of application has to increase, but only a little.
    I think that is an sd driver problem, but i don't know. Someone has had this type of problem?
     
  2. mkopack

    mkopack Member

    Joined:
    Jun 14, 2013
    Messages:
    451
    Likes Received:
    21
    Sounds like the write to the SD card is causing a block stopping other processing from happening. Remember that if your file operations are happening in the same thread as the rest of your program, your program code is effectively going to block until the write is finished. SD card access is relatively slow so this is why you're seeing the delay.

    I would recommend the following possible solutions:

    1) break the writes up into smaller chunks and do them more often (that way the delay is spread out more and is more uniform rather than big spikes.

    2) Use a 2nd thread to do the IO operations, and use 2 buffers that you swap between. So for instance, your main thread works along, filling up buffer #1. As soon as it's full, you switch to buffer #2, and tell the 2nd thread to write out what's in buffer #1. While the 2nd thread is busy doing the write, your main thread keeps going along filling up the 2nd buffer. Once the 2nd thread is done with the SD write, it clears that buffer and makes it available to the main thread to switch out, and so on...
     
  3. stefben

    stefben New Member

    Joined:
    Jan 28, 2014
    Messages:
    3
    Likes Received:
    0
    Thanks a lot for the fast reply.

    The application doesn't write files. For make the test I had manually copied the files (from the Ubuntu desktop).
    I have done this test because I have observed that the application freeze sometimes (not in a cyclic mode), and I have try to make something with udoo. I have seen that the problem is (or might be) when I write on the sd card...
     
  4. mkopack

    mkopack Member

    Joined:
    Jun 14, 2013
    Messages:
    451
    Likes Received:
    21
    Ok, sorry, just having a hard time understanding what you're saying (English obviously isn't your first language) so trying to piece it together...

    Remember that the Linux side of the Udoo isn't a running a realtime OS - you have ZERO guarantee of service time for your app.

    It's possible that the kernel itself is getting blocked during SD writes. Not sure.
     
  5. mkopack

    mkopack Member

    Joined:
    Jun 14, 2013
    Messages:
    451
    Likes Received:
    21
    Also, does your test program us a lot of memory? It's possible if it does that it's causing the system to swap out to virtual memory (which on an SD is going to be REALLY slow.)
     
  6. stefben

    stefben New Member

    Joined:
    Jan 28, 2014
    Messages:
    3
    Likes Received:
    0
    Thanks for the answer, and sorry for my bad english.
    Yes i know that linux is not a RT-System, but 15 second of freezing are a lot of i think.
    About the memory... I think that is enought for my testing program... (and also if he write on SD I think that 15 second are too much)
     
  7. DangerousThing

    DangerousThing New Member

    Joined:
    Jan 23, 2014
    Messages:
    21
    Likes Received:
    0
    Does the Udoo Ubuntu distro have any swap enabled by default? I just got the info I needed in order to be able to created a working swap, but I'm running my system off of the SATA port with a 1 TB SSD drive; I created a swap partition a few days ago, but didn't know how to get the partition working by default. I'm not fond of the firmware auto-mounting most of the disk systems without doing the swap partition also. I have to use the fstab file, but only for this. It just seems odd.
     

Share This Page