Sie sind auf Seite 1von 3

01-October-2012

Monday, October 01, 2012


10:10 AM

Todays topic:
Queries and issues with preemptive and foreground/background
a. How do you know when the task resumes when it was initially suspended?
b. Preemptive causes the issue of indefinite suspending

Consider the following tasks for a boat


Task

Description

Motor propeller speed control

Rudder direction (continuous send)

Temperature monitoring

Psuedocode for Task 3


Cannot be interrupted here!!!
Read sensor
Update screen
Compare to threshold
If greater,
Turn on light
Turn off __________
Else,
Turn off light

The above block of code should not be broken since when returning is would have old values and can cause
the system to react incorrectly.

In-class activity:
Write psuedocode for propeller and rudder
What would happen is it does not restart when interrupted?

What is considered Real-Time?


- Does NOT mean "fast"
- Has to do with the guarantee of the system
Purely Cyclic:
- Events arriving at regular intervals
Mostly Cyclic:
- Events occur at regular intervals most times. The time intervals may vary slightly
Asynchronous but predictive:
- Here, the system will be expecting an input but is not sure when it will arrive
MicroP II Logs Page 1

- Here, the system will be expecting an input but is not sure when it will arrive
- The input is sure to arrive
- In class e.g. Waiting on a bus : We know that a bus will arrive but we do not know the exact time at
which it will arrive

Asynchronous but unpredictable:


- Here, we do not know when (or if) the input will be arriving or how often they will occur
- For e.g. The above example indicates that we know that a bus WILL arrive. In this case, we do not know
IF the buss will arrive

Hard and Soft constraints


Hard
- if the constraint is missed, this will cause a system fail
Soft
- If the constraint is missed, the task will not fail
- Not a disastrous effect
Consider constraints for heart-rate monitor!!!!
1) Processor-independent
> Contains C-code that never changes

2) Processor specific
> Customize certain file for processor
> Start-up code
Linker scripts
> May have to write port for processor (porting)
3) Application specific
> Files that you must write for each project you create
E.g. May have to port once for processor but will have to change application file often

OS_CONFIG.H
- # defines
Tick
- Runs at regular intervals
- OS_TICK_PER_SEC sets this interval
- Why is a tick needed for pre-emptive OS?
> This function generated regular interrupts
> E.g. When a context switch is required, it is only when the tick interval expires and generates an interrupt
then the context switch can occur

IDLE TASK
- Runs when no other task is ready to run
- You do not write this ( part of kernel)
- Consider stack for idle task
Note that in uCOS II : The bigger the number assigned to the priority of a task, the lower its priority

MicroP II Logs Page 2

TYPES OF STACKS:
1) C Software stack
2) Hardware stack
Note: Must create stack with enough space to accommodate for interrupts and when other routines are called

Home-Work
1) Write one task for the uCOS II OS

MicroP II Logs Page 3

Das könnte Ihnen auch gefallen