Course Overview

 

 

What are Computers?

      From Outside

   CPU box, Monitor, Keyboard, mouse and Printers

 

      From inside

   ICs, Chipsets, Hard Disks, PCB cards, Drives, Buses

   All the above are called Computer Hardware

   The physical engine that solves problems

Programmability

      Unique feature of Computers

      raw HW can not do anything on its own

      needs programs or software to do things

      Same hardware can be configured to do a variety of functions

      Programs provide this ability

      `run' or `execute' the program in the machine for this


What are Programs

      Sequence of precise instructions or commands

      tell the HW to read input,

      to compute simple arithmetic functions

      and to print outputs etc.

      Control HW to compute a variety of tasks

      It is the programs that provide the rich problem solving abilities
  
Programming Main focus of this course

Low-level Programming

       Programs that can run in a computer are low-level,

       Instructions are simple arithmetic and logical operation on binary numbers (sequences of 0 and 1)

       specific to the machine and will not run in other machines

       called as machine programs (assembly programs)

       very difficult to write and understand, error prone

       for most common applications not necessary

 

Example
  mov R1,R2                          move the value from R1 to R2
   add R2,R3,R4                   
add R2 and R3 and store it in R4
  sto R4, #010110                 
store R4 in memory

High-level programming

      Instructions are complex operations on a variety of data objects

      programs are independent of machines

      closer to problem domain

      resembles natural language statements

      easier to write, debug and understand

      This is the focus of this course

      Examples

   compute the interest for six months of Mr. Sachin's Savings a/c

   book a tkt. for Rahul from Mumbai to Bangalore

   Switch on the alarm when belt not fastened

Translators/Compilers

      High level programs can not run directly on computers

      need to be translated to low level instructions

      compilers do this job

      compilers are themselves programs - system programs

      CS students learn how to write compiler software

Operating Systems

      Compilers alone are not enough

      Other programs required for executing application programs Operating Systems

      Provides a high level view of hardware

      Efficient utilization of resources

      various utility functions, like reading inputs, printing, etc.

      UNIX, Windows, SunOS, Solaris,

      GNU/Linux

A Simplified Picture

OS is the boss

      OS gateway to the machine

      All interaction through the OS

      OS is in control always

      Safety, Security and Efficiency

      Watches for inputs (mouse,keyboard) and provides appropriate responses

   Giving login Prompts,

   Reading user name and passwords

   Allows or rejects

      Runs the command line interpreter (window manager)

The Shell

      The command line interface is called shell

      Various versions of shell

   C-shell, Bash, etc.

      After login, user commands are interpreted by the shell and appropriate OS commands are executed

      User commands to create/remove, edit files, compile and execute programs etc.

      When a user command is executed, there is a momentary transfer of control

      After execution, control is transferred back

 

 

Programming Languages

      Program instructions should be precise enough to be understood by machines or other programs

      Compilers and Raw HW are dumb

      need precise syntactic rules  and a unique semantics

      Programming languages define these rules and semantics

      Hundreds of languages - FORTRAN, Algol 60, PASCAL, BASIC, C, C++, Java,

 

Fortran

      We teach FORTRAN

      First High Level Language (1954 57)

      John Bachus (IBM), got Turing Award

      Revolutionary Step

      Grand father of all modern PL

      Name derived from Formula translation

      Simple idea: Mathematical formulae are high level descriptions of computations

Evolution of Fortran

      Original Fortran very primitive, restrictive and small

      It has evolved over the years

   Fortran II

   Fortran IV

   Fortran 66, Fortran 77

   Fortran 90, Fortran 95

      Fortran 90 compares with all modern languages

      We will use FORTRAN 90

      So, this is a course on Programming in Fortran 90

 

Why Fortran

      Efficient compilers exist

      Oldest and widely used

      Large base of utilities and programs

      It has all modern features

      Fortran 90 is just a choice

      Self-learning of Programming in C, Java or any PL possible after this

Main Focus

      Problem solving using computers

      Fortran for concreteness

      Exercises in programming in a HLL

      All languages, at your level, are equivalent

      Obtaining a solution is more difficult

      Representing solution in a PL require mastery over the language and comes with practice