networking and the internet (6)

27
BS2911 Week 6 1 Networking and the Internet (6) Last Week: » Compilers and linkers; interpreters (Willis, ch.7, sect 7.7) » Interrupts and status; processor modes (Coope, chapter 9) » Module assignment » HTML Frames and Practical Checkpoint – review of the module so far Introduction to Glossary in “topic 0” of Learning Network Week 6 Focus » Data integrity in a networked environment (first part) » HTML Practical » Workshop for assignment due Thursday May 6 th

Upload: aurek

Post on 13-Jan-2016

19 views

Category:

Documents


1 download

DESCRIPTION

Networking and the Internet (6). Last Week: Compilers and linkers; interpreters (Willis, ch.7, sect 7.7) Interrupts and status; processor modes (Coope, chapter 9) Module assignment HTML Frames and Practical Checkpoint – review of the module so far - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Networking and the Internet (6)

BS2911 Week 6 1

Networking and the Internet (6)

Last Week:» Compilers and linkers; interpreters (Willis, ch.7, sect 7.7)» Interrupts and status; processor modes (Coope, chapter 9)» Module assignment» HTML Frames and Practical

Checkpoint – review of the module so far

Introduction to Glossary in “topic 0” of Learning Network Week 6 Focus

» Data integrity in a networked environment (first part)» HTML Practical» Workshop for assignment due Thursday May 6th

Page 2: Networking and the Internet (6)

BS2911 Week 6 2

Review of the Module

So far we have covered:» Uses of networks in Business –

– Introduction to e-Business– What is the ideal B2C product?

» Systems for Networks:– Operating Systems and File organization– CPU design and Performance issues – Compilers and linkers; interpreters– Interrupts and vectors; processor modes

» Online Computing (Interactive versus Transactional)– Time-sharing, multi-programming, transactions

» HTML: – basics, links, tables, Frames, practical exercises

Page 3: Networking and the Internet (6)

BS2911 Week 6 3

The Rest of the Module

Still to Come» Data integrity in a networked environment » More on the (seven-layer) model for Computer Networks » LAN and WAN technologies, Network security» Data transmission » Network types » Relieving bottlenecks» Communication protocols and formats for transmission» Voice-Data integration

Anything else we should be covering?

What changes are needed?

Page 4: Networking and the Internet (6)

BS2911 Week 6 4

The Glossary

The class of 2004 suggested having a single source for all the abbreviations and terms used on this module» My start was improved by input from Stephen White» And I’ve added more as new topics have come up since

This Glossary is held on the Learning Network and at http://www2.winchester.ac.uk/bm/Courses/BS2911/BS2911-Glossary.doc

Please suggest any other entries needed» Ideally provide an entire entry – term and definition» It doesn’t have to be perfect, as I may be able to polish it» e-Mail is probably the best way to do this

(though we could build it by a conference or a Wiki on the Learning Network)

» We can print it when we’ve covered your key concerns

Page 5: Networking and the Internet (6)

BS2911 Week 6 5

Goals of Distributed Systems To get the best out of both servers and client systems

» Fast response times to user» Data integrity in the system as a whole» High availability and reliability » Low maintenance costs

Server offers:» Secure, fast access to data» Integrity and effective back-up» Access independent of workstation

Client workstation offers:» User-friendly interface» Local processing where central data not needed» MIPS* at lower cost than on mainframe systems

* Meaningless Indicator of Processor Speed

Page 6: Networking and the Internet (6)

BS2911 Week 6 6

Distributed Data Models

UNIX allows you to link data structures» the mount command attaches a directory hierarchy as part

of another hierarchy» Can mount directories from other systems

(a bit like mapping a network drive in Windows)» Requires message interchange to maintain data –

provided by the Network File System or equivalent Many database systems provide automatic replication

between systems» For example, Oracle, DB2, Lotus Notes» Locking is a serious problem with peer database engines

– how do you stop 2 copies of a field being updated at once?– Coordinating adds network delay even to local updates

Page 7: Networking and the Internet (6)

BS2911 Week 6 7

Distributing Function

Most information systems contain a mixture of» Data Management» Business logic» Data presentation and user interface

This can be distributed asymmetrically, for example» Data Management on a server» Business logic on the server» Presentation logic on a workstation» or you could split business logic, e.g. to validate input before

sending it to the server Benefit of asymmetric distribution is that data integrity is

under the control of a single system» Great until the server fails!

Page 8: Networking and the Internet (6)

BS2911 Week 6 8

Programming Models

Function Shipping, as in NFS* or CICS» Application issues data request to environment (or OS)» Environment generates messages to another system to

request action on the data Transaction Routing, as in CICS

» Client system invokes a transaction that’s not local» CICS routes the request to another system (usually a

server) where associated program is run in its entirety Remote Procedure Call (RPC)

» Logic on workstation invokes procedure on the server » Procedure runs, and returns control (and results) to caller» Environment handles RPC messages» Permits complex structures of networked logic

or vice versa

* Network File System

Page 9: Networking and the Internet (6)

BS2911 Week 6 9

Logic split for a CICS System

Data

Network Interface

System code – Routes work to applications

Transaction routing

Client

FOR

”User InterfaceUsually on PCCICS has “thick client”

TOR

Applications

Not system code

Function shipping

AOR

Data Server

System code to read files/DB

Transaction routing

• User asks to run transaction• TOR routes it to an AOR• Application ships data request• FOR owns, reads, writes files

Terminal owning region

file owning

application owning

Page 10: Networking and the Internet (6)

BS2911 Week 6 10

Integrity – What makes it hard In a single system, events can be synchronized

» On uniprocessors, nothing is really simultaneous» Inter-process communication is affordable» The system can avoid concurrent updates by locking at

record level, or by serializing update activities On a distributed system, simultaneity is possible

» Anything that can go wrong will eventually go wrong» That’s why we usually have an “owning” site for any data,

and ship all requests there But there’s still a problem when two separate bits of data

are updated within a unit of work» Credit account A with £X, and debit B with £X (or do neither)» If accounts owned on different machines, one action might

fail after the other has completed

Page 11: Networking and the Internet (6)

BS2911 Week 6 11

Logic split between Systems with RPC

B is effectively working for A in this example» During running of A’s program, code calls function on B» B does the required activity (e.g. debit), then returns» In this case, A waits until B returns control

(but what if it ran on doing local things?) What if link fails after B has changed its data?

Data of A

Data of B

A Programstatementscall sysB prg Xwrite data AReturn

BProgram Xstatements…...write data BReturn

Inter-systemcommunication

Page 12: Networking and the Internet (6)

BS2911 Week 6 12

Logic split between Systems with RPC

A makes a request of server B» It then waits while B runs the program» When B returns the results, A continues working» In principle, A could have run on doing local things,

but eventually it’s going to have to wait for B’s response Integrity risk if link fails after B has changed its data

Data of A

Data of B

A Programstatementscall sysB prg Xwrite data AReturn

BProgram Xstatements…...write data BReturn

Inter-systemcommunication

Client Server

Page 13: Networking and the Internet (6)

BS2911 Week 6 13

Data Integrity

Consider a banking transaction: B pays A £100» System must decrement B’s account» AND increment A’s account» If it can’t do both, it must do neither

In real life, the actions can’t be atomic, so transaction monitor (such as CICS) groups them into a “unit of work”» Starts unit of work» decrements B’s account, logging previous state» Increments A’s account, logging previous state» Commits changes (or backs out if something fails)

at end of unit of work

Page 14: Networking and the Internet (6)

BS2911 Week 6 14

Two-phase Commit

One way to preserve data integrity is to back out any changes made if the unit of work aborts, e.g.» System A logs the “before” state of the account it owns,

then credits the account (speed limited by disk and need to move data between systems)

» System B logs the “before” state of the account it owns, then debits it, then notifies A that it’s ready to commit

» System A reacts to Ready by confirming commit to B – no delay for disk activity or volume data transmission

» System B gets confirmation and purges its log Similar logic applies however many nodes are involved

(you effectively run along a chain of nodes)

Page 15: Networking and the Internet (6)

BS2911 Week 6 15

Window of doubt

What if link goes down after A has received “Ready to commit” from B?» Could we end up with “after” state at A and “before” at B?

CICS deals with this by maintaining logs until the loop is closed, even if this is days later» If B comes back and “NAKs”* the commit, A can back out

the change» If B comes back and confirms, A can purge its log

What about other transactions that hit the same data in the meantime?» Can probably maintain integrity of values in the file» But some decisions taken might be based on values that will

later be backed out* NAK = Negative Acknowledgement

See glossary

Page 16: Networking and the Internet (6)

BS2911 Week 6 16

Synchronous or Asynchronous

Everything described so far has been synchronous» Client can’t do anything until the server has responded» That’s important if you’re taking decisions on the way

But business often includes activities that can run at their own speeds» We don’t do everything by phone» If no conversation is needed, we write or leave a message» Even applies to payment – we can send a cheque by mail

Distributed processing can also work through Messaging » We do need a way to guarantee that the message will arrive» And that it will arrive once only» Queuing is helpful to keep messages in sequence

Page 17: Networking and the Internet (6)

BS2911 Week 6 17

Advantages of MQ Approach

Simple: » Allows easy connection of heterogeneous systems» Asynchronous operation is built into the model

Coping with failure is inherent» You never know when the message will arrive,

so you have to design around non-instant delivery» Network failure is simply an extended case of this

Depends on integrity of infrastructure» Since many customers and systems use same vehicle,

problems will get ironed out quickly

We’ll cover Messaging and Queuing next time

Page 18: Networking and the Internet (6)

BS2911 Week 6 18

Module Assignment The Site (two-thirds of assignment marks, split equally

between design and coding)» Pick a topic that interests you» Produce a site with 4-6 pages» Work in straight HTML – no Dreamweaver, Front Page etc» Cascading style sheets good, but not required» Put the site on to an ISP if you like, but also hand it in on

the USB stick – this will prove that it’s portable

Write up your development process (one third)» Summary of what you set out to achieve;» Review of what you discovered during development;» Reflection on what you did

Page 19: Networking and the Internet (6)

BS2911 Week 6 19

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» If you use frames, View Source on menu ≠ right-click View

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 <HTML> <HEAD> etc

Page 20: Networking and the Internet (6)

BS2911 Week 6 20

Using Graphics

Pictures inserted with image tag:<img src=“url” alt=“alternative text” />

Use JPEG format for photos, GIF for line drawings Ideally manipulate the image to the size you need

» Most systems have Microsoft Photo Editor – lets you crop and resize images

Can also resize with width= or height= attributes» Dangerous to use both, as you can distort the image» Use one or the other, or take care to preserve aspect ratio» If image can’t be displayed, browser will reserve space using

these attributes, and show value of alt= attribute» Better to scale down than up, but file size isn’t affected –

large images will still be delivered very slowly

Never use BMP

Page 21: Networking and the Internet (6)

BS2911 Week 6 21

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

» <A href="http://www.pdq.edu/freds.htm">Quick Univ</A>» <A href="freds.htm">Local reference</A>

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

<A href=“./subdir/fred2.htm">relative reference</A>

Page 22: Networking and the Internet (6)

BS2911 Week 6 22

Some HTML Primers on the Web The original NCSA primer has been removed, but there’s

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 Drewry’s 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?

Page 23: Networking and the Internet (6)

BS2911 Week 6 23

Remaining slides are revision

Frames topic from Week 5

Page 24: Networking and the Internet (6)

BS2911 Week 6 24

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 websiteBUT: » Burns up valuable screen real-estate

Page 25: Networking and the Internet (6)

BS2911 Week 6 25

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/tutorials/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

Page 26: Networking and the Internet (6)

BS2911 Week 6 26

Learning about Frames

As usual, the best thing is to try it with a simple example» Download

http://www.winchester.ac.uk/bm/courses/BS2911/frames.zip» Extract everything in it into a folder on your machine

Edit the file framed.html using Notepad» Can you work out what it’s 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 what’s happening

Page 27: Networking and the Internet (6)

BS2911 Week 6 27

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 70:30

– 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!