Thread: Uniform distribution of processor load

  1. #1
    Registered User
    Join Date
    Apr 2019
    Posts
    7

    Uniform distribution of processor load

    This is basically an embedded C. Is there anything called processor loading where your c program for example 100ms tasks etc will some time load heavily that your processor resets?

  2. #2
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,670
    If your microcontroller overheats and the embedded system has an automatic thermal shutdown system, then sure. But nothing should be taken for granted in these situations.
    Devoted my life to programming...

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    37,118
    Perhaps you could uniformly run the processor at a lower clock speed.

    Or add better thermal management (add heatsinks) to your hardware.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    Apr 2019
    Posts
    7
    I am not saying anything in terms of thermal, but the way software code is distributed.

  5. #5
    Registered User
    Join Date
    Feb 2019
    Posts
    277
    Some microcontrollers have an watchdog timer which can be used in the same maner as SIGALRM signal, interrupting the flow of normal process and executing an interrupt service routine periodically. How you implement this depends on your microcontroller, your compiler and what you want to do...

  6. #6
    TEIAM - problem solved
    Join Date
    Apr 2012
    Location
    Melbourne Australia
    Posts
    1,680
    ...will some time load heavily that your processor resets?
    I'm guessing that you are getting a reset while using freeRTOS?

    There are a few different ways that a device can reset - In the device that I am currently using (PIC16F15325) there are ways of determining the cause of the reset (by reading the STATUS and PCON registers). This is explained in the section of the data sheet called, "8.13 - Determining the Cause of a Reset".

    Have a look in your devices datasheet and see if there is a way to read what the last reset was on startup.

    From there, see if there is a way of implementing a start up routine with freeRTOS.
    Fact - Beethoven wrote his first symphony in C

  7. #7
    Registered User
    Join Date
    Apr 2019
    Posts
    7
    It is embedded c so it should be in continuous while(1). But major doubt is should a basic scheduler must always be implemented and run all my functionality in the tasks? I cannot run my functionality in a continuous while loop? I know i can run but i am getting the reviews that i should never do it. Is it correct?

  8. #8
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    37,118
    Sure you can run a while(1) loop.

    But you either need to disable the watchdog functionality on your chip, or make sure you call whatever 'watchdog reset' mechanism is provided at least once every time around your forever loop.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  9. #9
    TEIAM - problem solved
    Join Date
    Apr 2012
    Location
    Melbourne Australia
    Posts
    1,680
    The Arduino runs this way, and that is very popular - You have 2 functions that you must implement: Setup and Loop. Setup runs once, and then the loop... Well.. Loops forever.

    It's what you do from there that makes it a good or crappy!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Random integral numbers from uniform distribution
    By jangaser in forum C++ Programming
    Replies: 9
    Last Post: 09-06-2015, 10:42 AM
  2. IDEs: I want non uniform fonts!
    By Mario F. in forum General Discussions
    Replies: 33
    Last Post: 12-16-2009, 11:44 PM
  3. Ranom numbers having uniform distribution
    By edesign in forum C Programming
    Replies: 9
    Last Post: 08-16-2009, 05:56 AM
  4. Uniform sampling
    By Dedalus in forum C Programming
    Replies: 6
    Last Post: 06-29-2009, 04:30 PM
  5. Uniform resize of a window
    By Mastadex in forum Windows Programming
    Replies: 5
    Last Post: 02-13-2008, 02:40 PM

Tags for this Thread