ENGR 330: Todays Class - PowerPoint PPT Presentation

1 / 14
About This Presentation
Title:

ENGR 330: Todays Class

Description:

Program assignment 12/13. Overall fine issues with format and commenting ... 1. Important: commodity products: USB hubs, singing greeting cards, etc. ... – PowerPoint PPT presentation

Number of Views:43
Avg rating:3.0/5.0
Slides: 15
Provided by: ricks6
Category:
Tags: engr | class | todays

less

Transcript and Presenter's Notes

Title: ENGR 330: Todays Class


1
ENGR 330 Todays Class
  • Class status
  • Review program translation
  • How subroutines work
  • Final programming assignment
  • Review Operating Systems hardware
  • Application requirements and microprocessors

2
Class Status
  • Program assignment 12/13
  • Overall fine issues with format and commenting
  • Full credit if it compiled and ran
  • How did the overflow test work? / not work?
  • Next couple of weeks
  • Spot reviews on important topics
  • C Programming
  • Arrays, address calculations, structures
  • Subroutines and recursion
  • Problem solving with processors
  • Establishing requirements
  • Data representations
  • Matching processors to requirements

3
Program Translation
  • How does it really work?
  • Translating common C elements
  • Assignment statement
  • Arithmetic calculation
  • If statement
  • While statement
  • What about procedure/function calls?

4
How functions/procedures work
  • The Stack
  • Saved registers
  • Return value, if any
  • Arguments passed to the procedure
  • Local variables
  • What does this mean for compiling one?

5
Last Programming Assignment
  • Read in a bunch of multi-digit numbers
  • Store them in an array
  • Print them out in the order they arrived
  • Print them out again in the opposite order
  • Use recursion
  • Also, meet industry standards for code
    formatting

6
Program Formatting
  • A REQUIREMENT for the last program
  • Start with everything on the leftmost column
  • Indent everything (statements and comments)
    inside a pair
  • Statements that take more than one line
  • Start the second line indented relative to the
    first
  • IF statements and loops containing one statement
  • Indent the statement covered by the IF or loop
  • Commenting
  • Start every function/procedure with a comment
  • Comment every variable declaration
  • Comment every major loop or IF
  • Otherwise include a comment every 2 to 5
    statements

7
Looping with while
  • printrest procedure, takes pointer at array
  • While pointer gt 0
  • Printf(d\n, pointer)
  • pointer
  • Return

8
Looping with Recursion
  • printback procedure, takes pointer at array
  • If pointer gt 0 Then
  • Call printback(pointer 1)
  • Printf(d\n, pointer)
  • End If
  • Return

9
What do Operating Systems do?
  • The fundamental tasks
  • P, M, I
  • How has that affected processor design?

10
The Litany
  • Process Management
  • Need control user programs
  • Feature Kernel mode/user mode
  • Need let user programs run privileged software
  • Feature TRAP programs that cause
    interrupt/exception
  • I/O management
  • Need let CPU get work done while waiting for I/O
  • Feature Interrupts
  • Feature DMA
  • Need Block users from I/O
  • Feature Kernel mode I/O access
  • Memory Management
  • Need keep programs from smashing each others
    RAM
  • Feature access restrictions by different
    processes
  • Feature memory mgmt can only be changed by the
    kernel
  • Need efficient RAM allocation minimize
    fragmentation
  • Feature Paging
  • Need share limited RAM among numerous processes
  • Feature virtual memory through page fault
    handling

11
Microprocessor Requirements, p. 1
  • A. Large addressable RAM
  • 1. Important video, scientific research, large
    scale simulations
  • 2. Unimportant most other things
  • B. Power consumption
  • 1. Important portable devices, devices in
    confined spaces
  • 2. Unimportant devices in open, climate
    controlled spaces
  • C. Processor Speed
  • 1. Important video, real time interactive
    systems, signal processing
  • 2. Unimportant home appliances

12
Microprocessor Requirements, p. 2
  • D. Cost per unit
  • 1. Important commodity products USB hubs,
    singing greeting cards, etc.
  • 2. Less important desktop computers,
    automobiles, fighter planes
  • E. Scalability for growing calculation sizes
  • 1. Same as for large RAM list above
  • 2. Memory and processing power can usually trade
    off with one another
  • a) You get by with less RAM with a faster
    processor (in theory at least)
  • 3. Scalability in processors assumes
    multiprocessor support

13
Microprocessor Requirements, p. 3
  • F. Software compatibility with (x) software
  • 1. Important application depends on software
    that only runs on Windows, or Solaris/SPARC, or
    something
  • 2. Unimportant application will be built to
    match the best CPU for the problem
  • G. Signal processing performance
  • 1. Important cell phones, radars, software
    radios, MP3 players
  • 2. Unimportant applications without real time
    data streams to process
  • H. Graphics processing performance
  • 1. Important video playback, video editing,
    image editing
  • 2. Unimportant applications without large
    shallow matrices to process

14
Thats it.
  • Questions?
  • Creative Commons License
  • This work is licensed under the Creative Commons
    Attribution-Share Alike 3.0 United States
    License. To view a copy of this license, visit
    http//creativecommons.org/licenses/by-sa/3.0/us/
    or send a letter to Creative Commons, 171 Second
    Street, Suite 300, San Francisco, California,
    94105, USA.
Write a Comment
User Comments (0)
About PowerShow.com