Title: Networking and the Internet 4
1Networking and the Internet (4)
- Last Week
- Online Computing (Interactive versus
Transactional) - e-commerce issues what do we need for B2C?
- HTML introduction
- HTML Practical
- Week 4 Focus
- Network Architecture
- Computer Memory Virtual and Real
- CPU design and Performance (Coope chapter
6 Willis, chapters 6, 7 and 8) - HTML Practical
- HTML tables
2Network Architecture
- In earlier weeks we looked at networks in various
waysPhysical, logical, data, meaning of data - Will now consider Packet Switching
3Early Computer Networks
- Initially had two distinct purposes
- to connect terminals to mainframe computers
- to link computers together
- And two ranges
- Local low errors, wiring under enterprise
control - Wide-area wiring regulated by PTTs (was
error-prone) - And two topologies
- Point-to point
- Concentrated (multiple devices sharing a
connection) - Network architectures developed to share
connections, based on packet-switching concept - Systems Network Architecture led through 70s and
80s - Internet Architecture now taken over (even in IBM
shops)
Telephone companies
4Networking Requirements
- Two fundamental forms of communication
- Session-based, where you set up a call, exchange
data, then hang up like a telephone call - Message-based, where you create a message, put an
address on it, and send it like a postcard - Sessions are often used synchronously, with a
conversation between their endpoints - Example is terminal emulator to host
- but they can support bursty flows, including
messages - Message flows can be mixed together, as in the
mail - If the packaging/unpacking is fast enough, you
can get the impression of synchronous
conversation - This is the basis of packet-switched networking
5Packet-Switching
- All modern networks rely on chopping
transmissions into packets, and identifying them
with control information - Think of the address and return-address on a
letter - Packets usually have other controls, such as
- error-correction (for fix or detect transmission
errors) - Sequence control (to get the packets back into
order) - Examples of packet-switching
- Local Area Networks (like Ethernet)
- Cellular phone networks
- The phone system (apart from the local loop
the copper wire to your house) - Internet
6A general network
- A has direct links to B, C H
- Can manage links as sessions
- Flows from A-E could go
- A-C-E
- A-H-G-E
- A-B-D-F-H-G-E
- If we break flows into packets, and address them
to ultimate destination, we can mix flows on the
links - If packet for E reaches H, H works out which link
to send it out on - Sender and receiver dont care about route taken
- or about how each link works
for example
7A general network
- Sender and receiver dont care about route taken
- or about how each link works
- In this case, a packet would get there faster via
H - Fast wide-area connection to H
- Local connection to G
- Would even be faster to E
- Each node functions as a router
- Key issue is to avoid routing round in circles
Slow
Fast
Fast
wireless
Fast
LAN
LAN
8Seven Layer Model
- Protocols effectively define how layers talk to
their peers
9TCP/IP has superseded SNA
- The World of e-Commerce is built on LANs and
TCP/IP - Well cover Ethernet and other LAN technology
later they provide the links to carry Internet
Protocol data - Every location on the Internet has an IP address
- To send data to a location, system applies its
address to every packet to be transmitted - Also attaches a return address for replies
- Sender works out which link to send the packet
down - Routes it when theres no direct link
- for example, at home, any non-local Internet
address is down the Pipex connection from my home
network - Other end of link works out onward routing
10Memory Concepts
- Virtual and Real Memorywell start with Real
11Random Access Memory
- CPU accesses memory through two registers
- Memory Address Register (where)
- Memory Buffer Register (what)
- To write to memory (e.g. STORE 1234)
- CPU puts address (1234) into MAR, and
- data (contents of general register or
accumulator) in MBR - Matches John Von Neumanns model of a computer
- Memory is linear array of cells
- No physical separation between instructions and
data - Only one cell can be accessed at any one time
- Well nearly multi-cell groupings are accessed
today - 8-byte double-words in the case of a
Pentium(Coope uses Pentium III addressing on
p.51)
12Register Sizes on a Pentium
- MAR needs to handle the full 4GB address-range
- 4GB is 2³² so we need 32 bits
- Though the last 3 wont be used by the memory
hardware, as 8 bytes flow over the bus even if
only one is to be used - MBR needs room for all 8 bytes 64 bits
- How long will 4GB be sufficient?
- Even I can afford 2½GB today
- Software grows to fill the space available (e.g.
Windows Vista) - The architecture limit will become a practical
issue - Now were moving to 64-bit systems 64-bit MAR
able to address How much?
13Associative Memory
- Memory is read by content, not by address
- Essentially you get locations matching a given
key - Place key in interrogate register
- Filter matches with a mask
- Parallel memory electronicsflag all locations
that match - Expensive Little used for ordinary data
- Valuable for paging systems
- As we shall see
- Gordon Scarrotts CAFS was never a commercial
success
Content Addressable File Store
14Memory Contention
- CPU is much faster than memory access
- So it helps if we can pre-fetch instructions
and data - Cant do this if MAR/MBR are a bottleneck
- We could split memory into banks, each with an
MAR - Send request to one bank, and while its
working... - Send request to another one
- If we store odd locations in one bank and even in
another we have 2-way interleaving - Within limits, more interleaving increases
speed(Willis has four-way example on p.88) - Depends on having a fast bus to feed CPU requests
to MAR(s) this is why a 800MHz front side bus
is advertised
15Cache Memory
- Memory access is seldom truly random in real life
- Groups of locations get used much more than
others - So if we can make a local copy of them, we save
time - Cache is a place we can look without waiting for
the data to come from memory (Coope, pp.53-57) - Good chance that active working variables will
fit in cache - Can also be used to pre-fetch instructions
- Usually implemented as small, high-speed memory
- Very fast, but very expensive if actually on CPU
chip - Cheaper and fairly fast if on separate silicon
(level 2) - How do we know if a location is in cache?
- An opportunity for associative memory (Coope p.51)
16Virtual Memory
- Introduced with Ferranti Atlas (1965)
- Commercial debut with IBM System/360 model 67
- Achieved success with IBM System/370 in 1971
- Now everybody does it, even PCs
- Basic principles
- Virtual Memory has more addresses than real
memory - Divide address range of virtual memory into pages
- Put pages of virtual memory into frames in real
memory - Map virtual address to address of frame in real
memoryusing dynamic address translation - OK until every frame is full, then we have to
page out - find a page we can sacrifice write it to disk
- allocate the frame to another (virtual) page
17Organizing Virtual Memory
- Early virtual systems (like OS/VS1 and DOS/VS)
used a single 16MB virtual address range - chopped it up between processes just as real
operating systems had done previously - Minimized change needed to OS and 24-bit
applications - - Limited total concurrent programs to 16MB
- - Left risk that programs would tread on each
other - Better and safer to have separate address spaces
- Each process runs in a separate chunk of virtual
memory (initially 16MB to be compatible with
24-bit programs) - No risk of writing to other processs memory
cant see it - CP/67, VM/370, MVS, most Unix, Windows (NT and
later)
18Dynamic Address Translation
- Hardware translates a virtual address into a Real
address - For every (virtual) address space, we have a
page table, giving addresses of frames that
contains each page - If a page is present, its entry will contain a
frame number - For pages not present, entries will be flagged
invalid - How it works (example with 4KB pages in 16MB
space) - treat address as pageoffset-in-page 12 12
bits - So page-table will need 4K entries (212)
- Use 12 high-order bits to look in the page table
for address of frame containing the page - Add (by OR) the offset (low-order bits) get that
address - Assumes page table is in real memory
- Move to two-level (segment table) when thats a
problem
19Getting to a byte in real memory
8F4 Page number
A10 Offset in page
A10
Virtual address
Relevant page frame
Page table
Addressed byte
8F4
contains real address
Real memory
20Machine code CPU structure
- Some of Coope chapter 5 (Willis 7-8) will be
familiar to you - Instruction sets for Machine code
- Register instructions
- Stacks
- Components of the CPU
- Base Displacement addressing may not be
- IBM System/360 instructions use 16-bit
address,but memory needs a 24-bit address
(31-bit from S/370) - So have a register to hold a base address
(lt32-bits) - add displacement to decide which location to
access - Displacement can be literal or held in a
register - Can also add contents of another (Index) register
great for stepping along an array
Optional detail (youll not be examined on
anything beyond simple Virtual Memory)
within instruction
21World Wide Web Publishing
- Writing HTML
- Some recommended references
- http//www.web-nation.com/lessons/html-pri.htm
- http//www.w3schools.com/
22World Wide Web Publishing
- How confident are you about
- Basic structure of an HTML document
- Headings, Paragraphs and Lists
- Including Images
- Making Hyperlinks
- Did you do the exercise last week? See document
and zip file of samples on Learning Network - Main structures still to study are
- Tables (this week)
- Frames
?
23Reminder 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
Important in Assignment
24Internal Bookmarks
- You can also name a target inside a resource
- Like a bookmark in Word
- Also coded on Anchor tag, this time as NAME
attribute - ltA name"phred"gttarget of the linklt/Agt
- ltA href"phred"gtClick here to get to targetlt/Agt
- or if the link may be from a different
document...ltA href"http//www.pdq.edu/freds.htm
phred"gtClicklt/Agt - So the full form of the HREF attribute is a URL
followed by and a named anchor inside the URL - Missing out the resource means its in this
document - If the name is omitted, it refers to the top of a
resource
25Tables
- As in Word, a table is an array of cells,
arranged in - Rows, usually containing related data
- Columns
- Each cell can contain multiple lines of data
- In HTML, we need to
- Indicate where a table starts and
finishes lttablegt - Show the start of each row lttrgt
- Provide table data for each cell lttdgt
- Some bells and whistles
- Heading rows contain special table headers ltthgt
- And cells may contain nulls ltbr/gt
26HTML Tables
- ltTABLEgt tag starts structure provides
attributes to lay it out - border attribute frames each cell as well as
whole table - Heading item identified with ltTHgt
- Rows introduced with ltTRgt
- Each cell is Table Data identified with ltTDgt
- align attribute places text at right, left or
center of cell - valign attribute places text at top, bottom or
center of cell - No explicit statement of number of columns
- inferred from maximum number of cells in a row of
the table (so missing a lttrgt can have a dramatic
impact!) - Most tags automatically terminate previous tag
- so end-tags can be omitted (not lt/TABLEgt of
course) - ltcaptiongt can appear anywhere in table, but
browser will always show caption text at the top
27More about tables
- Tables are always the most complicated structures
in any text-processing system, and their precise
syntax often changes as the mark-up language
develops. The table tags of mainframe GML were
initially unpublished, then modified in the
commercial GML called BookMaster, then modified
again before being published in starter set. - Similarly, in Microsoft Word, table commands have
changed in every release, with graphical creation
of complex tables being a key selling point of
Word 97. Word XP added yet more bells and
whistles. - HTML took a fairly simple view that you pour
cells (table data) into a table, creating columns
as you pour new cells into a row. Rows are ended
explicitly, or implicitly by beginning a new row.
A side-effect of this is that omitting a ltTRgt
tag will create a double-length row, thus
doubling the number of columns in the table. - Check out the table in table.htm in the zip file
on the Learning Network or athttp//www2.winches
ter.ac.uk/bm/courses/BS2911/htmlsam2.zip - This cuts corners in terms of the tags actually
used, but stays within the rules of syntax for
HTML tables, so appears correctly. - In the following exercise, well see how
Microsoft Internet Explorer can tolerate sloppy
HTML. Even so, its safer to be pedantic!
28More Complex Tables
- Tables are not always simple C R arrays
sometimes we want to combine cells horizontally
and/or vertically - This is done with attributes on the cells tag
- COLSPANc says how many columns are spanned
- Also used to give width in horizontal units,
without spanning - ROWSPANr says how many lines are spanned by the
cell - Empty Cells
- Usually represented as if the cell were not there
(raised surface in most browsers) - Put ltBR /gt in the cell to create a true cell
containing a blank - Graphics
- Yes, the ltIMGgt tag works fine in tables
- Its often the easiest way to control where
pictures appear
29Table Exercise
- Columns are automatically scaled so that the
largest possible cell fits on a line (if you
shrink the window so that the largest cell
word-wraps, the column scaling will change so the
widest remaining cell is just wide enough for its
contents). - The file table3.htm uses the ROWSPAN attribute to
produce a table displaying the main table tags. - table4.htm adds the COLSPAN attribute to split
one of the cells in what is visually the RH
column. This has to be done by treating all the
other cells in that column as if they span two
columns the best way to think of it is as a
grid on to which the cells are placed the grid
has to be fine enough to contain the smallest
cell required.
- table4a.htm was based upon Fig 10.3 of the 10
Minute Guide to HTML by Tim Evans (QUE
publishing, 1995), where the author decided to
work on a much finer horizontal grid. This works
fine until one actually tries to use the COLSPAN
attribute to split cells, at which point it gave
odd results on both the browsers I tried. In
neither case were the two cells occupying the
right-hand column shown in the ratio prescribed
by the COLSPAN values. - Try making one of the cells wider than the others
in its column. And narrower. What happens in
Microsoft Internet Explorer? And in Firefox? - Finally, make a personal copy of one of the
tables, and insert an image into it.
30HTML Table Exercise
- Starting with the zip file of samples from Week 4
of the BS2911 area of the Learning Network - Make a copy of the source in 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 as well if you have it
- 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)
31How tolerant is your browser?
- Try messing around with the HTML to see what you
can get away with is it safe to rely on quirks
of your browser? - lttable bordergtltthgtCol one headingltthgtCol two
headingltthgtColumn threelttrgtlttdgtrow 1 item
1lt/tdgtlttdgtrow 1 item 2lttrgtlttdgtrow 2 item
1lttdgtlttdgtrow 2 item 3ltcaptiongtCrazy
tablelt/tablegt
- Next arrange that there isnt quite enough room
for every cell to be displayed on a single line
(you can add text, increase the number of
columns, or shrink the browser window, or a
combination of these). Note how the text in a
cell gets split across lines, and the cell
boundaries stay lined up. - Add the attribute align"xxx" to various data and
heading cells, where xxx takes the values right
left and center. Try other forms, such as L,
centre etc. What can you tell about the defaults
in IE and Firefox?
32Challenging Table Exercise
- Make a table to display your Semester 2
timetables - Should follow SchBM.html model in htmlsam2.zip
file - Please find and correct the bug in SchBM.html
it is only obvious with Firefox - Timetables are posted on the BA Student Info area
of LN - BM single hons Year 2 timetable is quite complex
- Timing varies from day to day
- Have to consider optional modules
- My approach was to slice the day into hours and
then join cells to represent the sessions - You may be able to think of a better way what
if hours ran across with days going down the
page? - If you do something good, Id welcome it to go on
the LN
33HTML Covered So Far
- Overall Document Structure
- ltHTMLgt, ltHEADgt, ltBODYgt tags
- Headings and other text tags
- ltH1gt, ltH2gt..ltH6gt tags ltPgt, ltBR/gt, ltEMgt,
ltSTRONGgt - Lists and the items within them
- ltOLgt, ltULgt with ltLIgt
- Anchors and Hyperlinks
- ltA name"target"gt Text labelled (if any)lt/Agt
- ltA href"where_to_link_to"gt Explanatory textlt/Agt
- ./ means same folder and ../ means folder
above - In-line graphics
- ltIMG src"path to image" alt"dont forget
non-graphic user"gt
34Extra HTML in Week 4
- Tables
- framed between lttablegt and lt/tablegt tags
- rows start with lttrgt tag (lt/trgt is optional)
- normal table data starts with lttdgt
- except for header rows, where its ltthgt
- Include the break tag ltbr/gt if the cell is empty
- Label table with ltcaptiongtcaption textlt/captiongt
- Table tags can have attributes
- lttable frame"border"gt
- lttd colspan2gt
- lttd align"center"gt (HTML was designed in
Switzerland by an Englishman, so it's in
American!) - Still to do Frames