TechOnline India Header
Most Popular
Top 5 Courses
  • Fundamentals of PCB Design
  • Analog Devices' SHARC 32-Bit DSP
  • Fundamentals of Audio Networking
  • Analog eLab - Improved INA Input Filter
  • Fundamentals of x86 Architecture
    Most Popular
    Top 5 Technical Papers
  • ARM Platform Technical Overview
  • Using C++ Efficiently in Embedded Applications
  • Top 10 Drivers for Embedded Android
    Most Popular
    Top 5 Webinars
  • Designing embedded HMIs and connecting them to hardware
  • 2009 Embedded Market Study
    All Articles Products Courses Papers VirtuaLabs Webinars
    Top Search Items
    C


    Techpaper Spotlight

    Wind River
    Accelerating the Development of Embedded Linux Devices with JTAG On-Chip Debugging
    /
        Login | Register | Welcome, Guest

    Topics
    POLL
    How much code have you produced in your career?
    A few KLOC
        38%
    100s of KLOC
        44%
    Millions of LOC
        11%
    A trillion
        7%
     



    FLIRTing with 8-bit MCU OSes
    FLIRT is for developers who want a small, easy to use and simple to port operating system for a truly tiny multithreaded system on an 8-bit MCU, without sacrificing the ability to multithread and share CPU time effectively.
    Embedded.com

    Enhancement--"Weight"
    Once the system was running, I got a lot of inquiries from my peers about adding prioritization but to me the concept of prioritization for this application was wasted and defeated the purpose of the system. (Why is beyond the scope of this article.) When you add prioritization in a multithreaded system, you need to add the concept of blocking, which requires adding another queue of blocked items, among others. That would start adding complexity I didn't want. I wanted simple! I wondered how I could add the concept of one task being more important than another task without starvation or complexity: I came up with the concept of "weighted" importance. If a task has more weight, it requires additional ticks during its share of the CPU time. This can be abused if you are not careful to the point where starvation occurs, so think carefully before adding too much weight to a task. This enhancement changed the task control block structure to the code in Listing 6.

    View the full-size image

    The two new items are Weight and Count, where Weight is the amount of clock ticks this task will run consecutively before letting the next task run and Count is the number of clock ticks that have run so far. The base task always has a weight of 1.

    View the full-size image

    Listing 7 is the task initialization with weighting where the second parameter is now the Weight of the task.

    The TaskCreate function would set Count to zero and then assign the second parameter to the Weight member of the TCB. Of course, good design states that you have a maximum Weight allowed in the system and then do some error checking.

    The timer tick ISR would simply bump the Count member of the task's TCB by one, see if it equals the Weight member. If not, just return. If it does equal the Weight then switch tasks. Listing 8 is the modified portion of the timer tick ISR.

    View the full-size image

    < PREV 1 | 2 | 3 | 4 | 5 NEXT >
     
     
    Latest Webinars
    · The Next Generation of Ethernet: How the New IEEE Standards Enable Energy Efficiency and Quality-of-Service
    · Simplified Physical Layer Receiver Test of Re-timed Architectures Such as USB 3.0, SATA, SAS, PCIe 2
    · How to solve the most common high-speed bus issues in embedded design on a budget
    · Early access to ARM Core Technology with Fast Models from ARM
    · Latest MIPI Standards: PHY and Protocol Testing Guidance
     
    Member Company Spotlight
    GE Intelligent Platforms
     

    Read the latest white paper from GE Intelligent Platforms, "Making Flat Panel Computer Systems Work in Harsh Environments." This paper explains how manufacturers are producing rugged computer systems that bring the simplicity of a Microsoft Windows-based PC to tough field applications. View the paper here.


    Member Companies