• Complain

it-ebooks - Real-Time Programming Lecture Notes (Waterloo CS452)

Here you can read online it-ebooks - Real-Time Programming Lecture Notes (Waterloo CS452) full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2017, publisher: iBooker it-ebooks, genre: Romance novel. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

No cover
  • Book:
    Real-Time Programming Lecture Notes (Waterloo CS452)
  • Author:
  • Publisher:
    iBooker it-ebooks
  • Genre:
  • Year:
    2017
  • Rating:
    3 / 5
  • Favourites:
    Add to favourites
  • Your mark:
    • 60
    • 1
    • 2
    • 3
    • 4
    • 5

Real-Time Programming Lecture Notes (Waterloo CS452): summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "Real-Time Programming Lecture Notes (Waterloo CS452)" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

it-ebooks: author's other books


Who wrote Real-Time Programming Lecture Notes (Waterloo CS452)? Find out the surname, the name of the author of the book and a list of all author's works by series.

Real-Time Programming Lecture Notes (Waterloo CS452) — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Real-Time Programming Lecture Notes (Waterloo CS452)" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
Real-Time Programming Lecture Notes (Waterloo CS452)

From: CS452 - Real-Time Programming - Spring 2012

Lecture 1 - Introduction
Pubilc Service Annoucements
  1. Due date for assignment 0/1
  2. Combination to trains lab
  3. Ubuntu 10.10

Practical Details:

Embedded Systems

Most of the mediation between the internal representations and thereal-world is done by embedded systems

  • invisible computing
  • sense and control
  • billions and billions sold
Development Model

Two box model

  • develop on one box
  • execute on a different box.

Development cycle

  • edit & compile on one box
  • download to second box
  • execute

Problem one

  • raw code that owns the hardware itself
  • hardware-specific libraries provide access to hardware
    • microcontroller/hopper example

Problem two

  • OS-like abstraction of hardware
  • looks like a bunch of libraries, plus a little more.

What is real-time programming?

Actually real-world programming, which means

  • World is measured in seconds, metres, etc.
  • Programs manipulate bits, bytes, words, which must be translated into into real-world measures.
    For example,
    • formatted output: translate from int, which computers manipulate, to decimal, which humans read
      • out in the open: i2a( ), printf( )
      • hidden: print, cout
    • Banking: int translates into, e.g., number of cents
      • program says dispense( 10000 ), which means `put five twemties into the hopper'.
      • microcontrollers start
        • activating motors
        • sensing forces
        • reading digitized video
        • etc.
    • Train control: contents of messages map into change speed, switch turn-out, sensor triggered
What is important for real-time?
  1. Throughput
    • e.g., number of frames per second in a game
    • e.g., frequency of sensor sampling in process control
    • no solution except
      1. getting better hardware
      2. getting better algorithms
      3. restructuring the task
  2. Response time
    • e.g., time from button press to gun firing in game
    • e.g., time from sensor reading to control code executing in provess control
    • several programming techniques exist
      1. busy-wait
      2. polling loop

      tension between flexibility and performance

In cs452 we take guaranteed response time as the defining quality ofreal-time computation.


Serial I/O

Uses a device called a UART,

  • which is really just two shift registers
  • with a one byte buffer in front of each one
  • plus one bit in a control register for each. They mean
    • read: there's a byte you haven't read yet
    • write: the buffer is empty, you can write

Busy Waiting

This is used to synchronize with an external event, minimizing responsetime.

#define FOREVER for( ; ; )FOREVER { while( !ready( ) ) ; do-it( );}

or in another form

FOREVER { if ( ready( ) ) do-it( );}

Sometimes you only want to do the thing once, as you do when putting acharacter on a serial line.

#define UART1_BASE 0x808c0000#define UART_DATA_OFFSET 0x00 // low 8 bits#define UART_FLAG_OFFSET 0x18 // low 8 bits#define TXFF_MASK 0x20 // Transmit buffer full flags = (int *)( UART1_BASE + UART_FLAG_OFFSET ); data = (int *)( UART1_BASE + UART_DATA_OFFSET ); while( ( *flags & TXFF_MASK ) ) ; *data = c;
Worst case response time

From the time that the ready bit sets until the first instruction of do-itis executed

  • execution time forwhile( !ready ) ;do-it;
  • Even a moderately optimizing compiler will produce good machine code. Something likeready: ldb r0, STATUS-ADDRESS and r0, r0, READY-BIT beq _readydo-it: ldb r0, DATA-ADDRESS

    Here do-it is acquiring a single byte from interface hardware when the status register indicates that valid data is available in the dara register.

  • Worst case response time is the execution of and, beq, ldb, and and beq
  • Normally code like this would be inside a loop, acquiring one byte after another until no more are available.
The problem with busy-waiting

What if the CPU has to two things at once?

E.g.,

  1. collect bytes coming in a serial port
  2. maintain a clock

Unless the rate of bytes coming in and rate of clock ticks areidentical

you are guaranteed to lose something sooner or later.


Return to:

Lecture 2 - Polling Loops
Pubilc Service Annoucements
  1. Due date for assignment 0
  2. Ubuntu 10.10
  3. Caches, optimization, clock speed, FIFOs
  4. Libraries: memcpy in particular

Practical Details:
What is real-time programming?

Actually real-world programming, which means

  • World is measured in seconds, metres, etc.
  • Programs manipulate bits, bytes, words, which must be translated into into real-world measures.
    For example,
    • formatted output: translate from int, which computers manipulate, to decimal, which humans read
      • out in the open: i2a( ), printf( )
      • hidden: print, cout
    • Banking: int translates into, e.g., number of cents
      • program says dispense( 10000 ), which means `put five twenties into the hopper'.
      • microcontrollers start
        • activating motors
        • sensing forces
        • reading digitized video
        • etc.
    • Train control: contents of messages map, sometimes indirectly, into changes in speed of trains, state changes (turn-outs, train locations), sensor reports.
What is important for real-time?
  1. Throughput
    • e.g., number of frames per second in a game
    • e.g., frequency of sensor sampling in process control
    • no solution except
      1. getting better hardware
      2. getting better algorithms
      3. restructuring the task
  2. Response time
    • e.g., time from button press to gun firing in game
    • e.g., time from sensor reading to control code executing in process control
    • several programming techniques exist
      1. busy-wait
      2. polling loop

      tension between flexibility and performance

In cs452 we take guaranteed response time as the defining quality ofreal-time computation.


Timers

How does one keep time in a computer?

  • crystal oscillator in a phase-locked loop
  • interrupts from a timer
  • ntp
Polling Loops
Busy Waiting

This is used to synchronize with an external event, minimizing responsetime.

#define FOREVER for( ; ; )FOREVER { while( !ready( ) ) ; do-it( );}

or in another form

FOREVER { if ( ready( ) ) do-it( );}

Sometimes you only want to do the thing once, as you do when putting acharacter on a serial line.

#define UART1_BASE 0x808c0000#define UART_DATA_OFFSET 0x00 // low 8 bits#define UART_FLAG_OFFSET 0x18 // low 8 bits#define TXFF_MASK 0x20 // Transmit buffer full flags = (int *)( UART1_BASE + UART_FLAG_OFFSET ); data = (int *)( UART1_BASE + UART_DATA_OFFSET ); while( ( *flags & TXFF_MASK ) ) ; *data = c;

Note. The volatile keyword.

Worst case response time

From the time that the ready bit sets until the first instruction of do-itis executed

Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Real-Time Programming Lecture Notes (Waterloo CS452)»

Look at similar books to Real-Time Programming Lecture Notes (Waterloo CS452). We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «Real-Time Programming Lecture Notes (Waterloo CS452)»

Discussion, reviews of the book Real-Time Programming Lecture Notes (Waterloo CS452) and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.