Networking and the Internet 5 - PowerPoint PPT Presentation

1 / 25
About This Presentation
Title:

Networking and the Internet 5

Description:

CPU design and Performance (Coope ch.6, Willis ch.9-8) ... Other browsers climbed on to the bandwagon. HTML standards committee added the facility ... – PowerPoint PPT presentation

Number of Views:23
Avg rating:3.0/5.0
Slides: 26
Provided by: EricB114
Category:

less

Transcript and Presenter's Notes

Title: Networking and the Internet 5


1
Networking and the Internet (5)
  • Last Week
  • CPU design and Performance (Coope ch.6, Willis
    ch.9-8)
  • Memory Virtual and Real (Coope, chapter 4)
  • HTML Tables and Practical work
  • Week 5 Focus
  • Compilers and linkers interpreters (Willis,
    ch.7, sect 7.7)
  • Interrupts and status processor modes (Coope,
    chapter 9)
  • Module assignment
  • Frames HTML to display multiple pages at once
  • HTML Practical

2
Programming Languages
  • In the beginning
  • machine code(1948 to around 1950)
  • Then Assemblers developed
  • translate 11 to machine code
  • Processor-dependent
  • As complex as the processor (at least)
  • Still in use today
  • High-level compiled languages (from 1956)
  • Processor-independent
  • FORTRAN, Cobol, ALGOL, Pascal, C, PL/I
  • Interpreted languages (from 1960s)
  • Translated as program runs
  • Basic, APL, REXX
  • Report Generators (from 1970)
  • Also called 4GL 4th generation
  • Based on definitions of input and output
    ......not procedures to transform
  • Object-oriented
  • Aims to model real world, defining methods for
    objects
  • Visual Basic, C, Java

3
Producing Machine Code
  • What runs in the CPU is a series of numeric codes
    in memory machine code
  • Weve already seen those (BS2911w1.doc)
  • Problem is that humans are lousy with numbers
  • So we represent them with mnemonics like LOAD
    ADD
  • Also use symbols to represent data
    addressesDefinitions A, B, C DS
    INT4 Executable code LOAD A ADD B STORE C
  • Assemblers produce machine code in two passes
  • First determines which symbols and labels
    existin this case, it has to reserve three words
    for integer data, perhaps A at 00 0F 0C, B at 00
    0F 10 and C at 00 0F 14
  • Second pass fills in the addresses for the symbols

4
Assembler Example
  • Lets write a program to addC A B
  • Assume the following codes
  • 01 is written as LOAD
  • 02 written as STORE
  • 03 written as ADD
  • 04 written as SUB and so on
  • So we program as LOAD A ADD B STORE C(more
    code would go in here)A DS INT4B DS INT4C DS I
    NT4
  • First pass, we translate codes and prepare data
    storage (1-byte code, 3-byte addresses)
  • Lets start from cell 00 0C 00C00 01 C01 needs
    AC04 03 C05 needs BC08 02 C09 needs C(assume
    more code up to F0C holds AF10 holds BF14 hold
    s C
  • Now we can resolve the symbols to machine
    codeC00 01 00 0F 0CC04 03 00 0F 10C08 02 00 0F
    14
  • The processor can run this

5
High Level Languages
  • Writing assembler still needs you to think about
    how machine works
  • 11 correspondence of mnemonic to code
  • plus macros mnemonics that produce several
    codes
  • Better if we can write in something closer to
    English
  • Machine independent
  • Calculations written like algebraic formulae
    CAB
  • Choices written as structures IF xx THEN yy
    ELSE zz
  • Loops handled in structured way WHILE xx DO
    END
  • One formula generates many machine instructions
  • Process of converting to machine code is
    Compilation
  • Slow to compile, but MUCH faster to write

6
Running a program
  • Compiling high-level language needs more than 2
    passes
  • Declarations, internal subprogram calls, syntax
  • Then compiler needs to do what the Assembler does
  • Object code produced still has unresolved
    references such as starting points of external
    subprograms
  • These must be resolved before pointing CPU at the
    code
  • In real life, machine code runs under OS control
  • Program calls built-in and OS subprograms
  • Location is determined by OS at run-time
  • So Assembler cant produce absolute addresses
  • Most computers have hardware features to assist
  • OS sets a Base Register to hold the starting
    address, and compiled program contains offsets
    from that

7
Running the Compiled Program
  • Before running, machine code has to be loaded
    into memory
  • As object module is read, the loader does two
    things
  • relocates the module by adjusting addresses to
    take account of starting point
  • makes a list of unresolved references names
    used but not defined inside the module
  • It then tries to resolve references using
    entry-points in known modules (OS, function
    libraries, etc.)
  • where to look may be a defined in a LIBPATH
  • in Windows, main resolution is through DLLs
  • All this takes time, so we may try to do it once,
    creating a load module with a Linkage Editor or
    Builder

8
Compile or Interpret?
  • Compilers typically generate efficient code, but
  • Change cycle is long Edit/Compile/Link/Load/Run
  • Each compilation takes time and resource
  • Source code isnt usually available for run-time
    debugging
  • Wouldnt it be nice to compile on the fly?
  • Interpreters do this, for example APL, REXX,
    Basic
  • Generally limited ability to look-ahead
  • Undeclared variables get typed by what goes
    into them
  • Each statement is read and converted to machine
    code when its needed
  • Some interpreters redo this every time a
    statement is run
  • Excellent diagnostics available if code fails,
    source can be displayed with values of variables
    in use

9
Processing without Interruption
Clock
Arithmetic and Logic Unit
Central Processor Unit
1 Load 2 Store 3 Add 4 Subtract 5
Multiply
Memory C00 1 1 F0C C04 1 2 F10 C08 3 1 2 C0C 2 1
F14 .. .
Processing happens one instruction after another
C00, C04
...
10
Interrupts
  • Interrupts are a hardware facility for
    controlling software
  • All current processors depend heavily on
    interrupts
  • Essentially, work by swapping the Instruction
    Counter
  • Interrupts can be caused by many things
  • I/O hardware ready (device end after moving data)
  • External event (such as timer or keyboard)
  • Addressing exception (DAT cant give real
    address)
  • Program check (e.g. because instruction unknown)
  • this is a neat way to invoke software emulation
    of an instruction not present on this particular
    model of CPU
  • Supervisor call (e.g. task asks OS for a service)
  • Interrupts are the basis of much task switching,
    as well as detecting errors that the OS must
    deal with

11
Interrupt handling
  • Lets assume we have finished our time-slice, and
    the timer has just signalled the fact and
    interrupted us
  • Interrupt hardware will save current IC value in
    (say) loc 40
  • Then set IC to the address given in (say)
    location 60
  • CPU then executes interrupt handler code at this
    address
  • First it has to save state vector of interrupted
    task
  • registers, privilege level (e.g. supervisor
    state)
  • then do whats needed to service the
    interruptprobably jump into the scheduler to
    pick next ready task
  • IBM S/370 maintains state information in PSW
  • Hardware swaps whole Program Status Word, not
    just the instruction counter
  • Each interrupt class loads its own new PSW

12
Processor modes
  • Clearly we could lose our return address if an
    interrupt handler is interrupted (by the same
    class of interrupt)
  • So we need to Mask against this class
  • and usually against lower-priority interrupts as
    well
  • This mask is another component of the S/370 PSW
  • defines one of the processors modes
  • Other processor modes (examples again for S/370)
  • Supervisor state Needed to run privileged
    instructions
  • Allows OS to do things not permitted to
    applications
  • Certain instructions need current PSW in
    Supervisor state
  • If its not, you get a Program interrupt
  • Storage key lets you protect your code and data
    from being overwritten by another task

13
Finishing Survey of HTML
  • Last week Creating Tables
  • Tables allow you to present tabular data without
    worrying about the size of the viewers window
  • Dividing a window into Frames
  • Frames let you present more than one WWW page at
    a time

14
Web Site development Assignment
  • Web Site means a collection of related
    pages,put together in a logical way
  • Development means you go through a process
  • Decide what your site is to do
  • Make a high-level design what the pieces are
    and how they should fit together
  • Design the individual pages and their linkages
  • Code up the content of the pages
  • Please dont use a tool like Front Page
  • It doesnt simplify the task of understanding and
    designing
  • Does make it easy to produce visually-interesting
    pages
  • Doesnt give you understanding of HTML
  • And you lose marks

15
Marking Scheme
  • Two thirds for quality of web-site, including
  • Success in achieving what you said you set out to
    do
  • Usability, including ease of navigation between
    pages
  • Accuracy minimal impact from errors
  • One third for report showing evidence of
    understanding and logical development
  • Clear statement of scope what is and isnt to
    be included
  • Review of what you discovered in research
    development
  • Reflection on how you developed your site
  • Both aspects will be affected by how ambitious
    youve been, but you can usually do better with a
    simpler site you get right than aiming for the
    sky and falling short

16
Netscape Frames
  • Typical Example of how HTML has grown
  • Netscape extended HTML to address a navigation
    issue
  • Other browsers climbed on to the bandwagon
  • HTML standards committee added the facility
  • Idea is that we can attach pages within logical
    frames inside our page
  • Gives common look and feel to site
  • Makes navigation information permanently
    available
  • Lets you include alien material in your website
  • BUT
  • Burns up valuable screen real-estate

17
Frames
  • Frames are a useful way to organize content of
    screen
  • You can have a fixed bit, perhaps for navigation
  • and what the user does there can control what
    appears in another frame
  • E.g. we might have choice of what appears in the
    RH pane
  • Normal way to organize modern web-sites
  • Details on the web at http// sharkysoft.com/tutor
    ials/frames/
  • Summary in your notes
  • Basic structure is a page that defines
  • how it is split into frames,
  • hyperlinks to the resources that go into each
    frame
  • Awkward shapes can be produced by binary chopping
  • Each frame can be named
  • You can control which named frame gets updated
    with next resource
  • or even create a new browser window
  • Best way forward is to try it

18
Learning about Frames
  • As usual, the best thing is to try it with a
    simple example
  • Download frames.zip from Week 5 of the Learning
    Network
  • Extract everything in it into a folder on your
    machine
  • Edit the file framed.html using Notepad
  • Can you work out what its meant to do?
  • You may need to look inside the components it
    links to
  • Open framed.html
  • Does it behave as you expected?
  • What happens when you resize the window?
  • Try to understand exactly whats happening

19
Frames Exercise
  • Create a page called xxx.htm (you choose the xxx)
  • Divide it into three frames
  • Split the page vertically into two equal parts
  • Left initially displays a trivial page you create
    call xxxL.htm
  • Split the Right-hand half horizontally 7030
  • Top 70 of the RH, displays a trivial page called
    xxxTR.htm
  • Bottom 30 of the RH is for navigation store as
    xxxBR.htm
  • In Bottom-right frame
  • Provide hyperlinks to load target pages into the
    left-hand and top-right frames
  • And heavier-duty hyperlinks to replace whole page
  • Associate graphics with each hyperlink, e.g.
    arrows
  • You can base all future frame-sets on this!

20
HTML Summary
  • HTML is a pretty small language
  • Youve seen most of it already Frames was all
    thats left
  • Easy to pick up structure from a good site on
    the web,then introduce your own content
  • Writing your own HTML puts you in control
  • How pictures and text are related
  • What happens when you update the page
  • WYSIWYG tools are getting better, but still leave
    you guessing and often generate wasteful HTML
  • A good HTML tutorial can be found
    athttp//www.w3schools.com/html/html_intro.asp

21
Assignment Workshop
  • Chance to check understanding of
  • Document structure lthtmlgt ltheadgt lt/headgt ltbodygt
  • Basic HTML lthngt ltpgt ltulgt ltligt etc
  • Hyperlinking lta hrefgt lta namegt
  • Tables lttablegt lttrgt lttdgt
  • Handling graphics ltimg srcgt
  • Frames ltframesetgt ltframegt
  • Attributes used inside a tag
  • Width, height not both in an ltimggt tag!
  • href dont forget http// in remote links
  • border1
  • Try to avoid direct reference to presentation
  • Font, bold, italic

22
The Mechanics of Writing HTML
  • Need at least two windows open
  • A browser to test your page in e.g. Internet
    Explorer
  • An editor to update it in Notepad is fine
  • Internet Explorer View source opens file in
    Notepad
  • Can then modify the file, Save it,
  • Then check the effects in IE
  • Reality is that most pages are based on existing
    ones
  • Get file into Notepad
  • Save As with new name (make sure extension is
    right )
  • Modify the content as you wish including the
    Title
  • You never have to bother typing ltHTMLgt ltHEADgt etc

23
Reminder Creating Hyperlinks
  • Any hyperlink reference needs to say what it is
    linking to
  • In HTML, we use an Anchor tag with the HREF
    attribute
  • ltA href"http//www.pdq.edu/freds.htm"gtQuick
    Univlt/Agt
  • ltA href"freds.htm"gtLocal referencelt/Agt
  • You can reference any resource on the Internet
    Just give its URL
  • Any lack of specificity means look locally, so
    missing out the domain means it is in the local
    file system
  • Always leave out as much as you can
  • Makes it much easier to move the site
  • Can also use relative references, e.g. to a
    sub-folder ltA href./subdir/fred2.htm"gtrelative
    referencelt/Agt

24
Some HTML Primers on the Web
  • The original NCSA primer has been removed, but
    theres a printable archive on our web-site
  • Two good primers are available on-line at
  • http//www.w3schools.com/html/html_intro.asp
  • http//www.web-nation.com/lessons/html-pri.htm
  • This is Tony Drewrys clear exposition of HTML
    tagshttp//www.cems.uwe.ac.uk/tdrewry/html/index
    .htm
  • A very wide-ranging site, covering everything
    from simple HTML to XML and databases
    http//www.w3schools.com/
  • Any more favourites?

25
HTML Table Exercise
  • Starting with the zip file of samples from Week 4
    of the web-site (http//www.winchester.ac.uk/bm/
    )
  • Make a copy of the source on My Documents,
    preferably with a new name (samples\XXXtable.htm)
  • Start Windows Explorer and get your file visible
    on it
  • Open it with the NOTEPAD Accessory (right-click)
  • Open it with Internet Explorer (double-click)
  • Open Firefox and Netscape as well if you have
    them
  • You can drag the file from Explorer into each
    browser
  • Has anything gone wrong?
  • Make changes in NOTEPAD, Save, and look at the
    effect in both the browsers (dont forget to
    Refresh/Reload)
Write a Comment
User Comments (0)
About PowerShow.com