software Software architecture by fanzhongqing


									          Software architecture
 Selection criterium -
  How much control do you need over system
 simple systems may use simple architecture
 complex systems require complex
            Round - Robin Architecture

   main loop checks each of the inputs in turn and
    services any that need a service
   Pros - no interrupts, no shared data,
   Cons - may have to long response time, very little
    control over it, very fragile - not scalable
   suitable for very simple devices only
    Round - robin with interrupts

 Principle
 - Interrupts are setting flags
 - the main loop polls the flags and does
 any processing required by the
   Round - robin with interrupts

 Pros
 - a little more control over priorities
 - interrupts can get good response
 - interrupts priorities can be controlled
 - more complex applications possible,
 e.g. two-way communication bridge,
 bar code scanner
        Round - robin with interrupts
   Cons
    - more complex than round-robin
    - shared data problems between interrupt
    routines and the task code require more
    complex code
    - all task code executes at the same priority
    - not good for compute-intensive applications
    e.g. a laser printer or the underground
    monitoring system
Function-Queue-Scheduling Architecture

   Principle - interrupt routines add function pointers
    to a queue of function pointers. The main routine
    reads pointers from the queue and calls the
   Pros - main routine can call the functions using
    any priority scheme,
    - better response time for highest priority task
   Cons - lower priority tasks have longer response
    time or may never execute
    Real-Time Operating System Architecture

   Uses RTOS which handles the necessary signalling
    between the interrupt routines and the task code
   RTOS decides which of the task routines should run
   RTOS can suspend one task code routine in the
    middle of its processing in order to run another
    Real-Time Operating System Architecture

 Pros - the worst-case response for the highest
  priority task is stable and close to zero
  - RTOSs are widely available
  - they are sold with a collection of useful
  collection of testing and debugging tools
 Cons - RTOS costs and uses some memory
  and processing time
              Selecting an Architecture

   Select the simplest architecture that will meet
    response requirements
   If your response requirements can be met only by an
    RTOS - do not hesitate to use RTOS
   you can create hybrid architectures, e.g. RTOS +

To top