Скачать презентацию Networking and the Internet 2 l Last Week Скачать презентацию Networking and the Internet 2 l Last Week

3ba29dcb9519765654dfc63350e765b4.ppt

  • Количество слайдов: 32

Networking and the Internet (2) l Last Week: l Week 2 Focus Useful text-book: Networking and the Internet (2) l Last Week: l Week 2 Focus Useful text-book: » Why does Networking matter? Coope, S et al (2002) » Some thoughts about e-Business Computer Systems » Hardware foundation – Computer architecture Mc. Graw Hill » Computer architecture – working through operations » Software – Operating Systems, File storage » Operating system foundations – Interrupts, concurrency and multi-programming – Scheduling and Dispatching – Time-sharing and Online systems » Graphical Operating Systems, including Windows BS 2911 Week 2 1

Computer Architecture Memory Processor 1234567890 -= QWERTYUIOP[]# ASDFGHJKL; ’ ZXCVBNM, . / Input (Data) Computer Architecture Memory Processor 1234567890 -= QWERTYUIOP[]# ASDFGHJKL; ’ ZXCVBNM, . / Input (Data) Output (Information) Bus Disk Storage Other long-term Storage Processor executes instructions from memory, l and works on data in memory l Other data flows through the bus l BS 2911 Week 2 2

Computer Processor & Machine code Instruction Control Unit (starts at 310) Clock Arithmetic and Computer Processor & Machine code Instruction Control Unit (starts at 310) Clock Arithmetic and Logic Unit Registers 1 2 Instruction Register Central Processor Unit 1 = Load 2 = Store 3 = Add 4 = Subtract 5 = Multiply BS 2911 Week 2 Memory 310 314 318 31 A 1 1 5 2 1 1 600 602 2 604 . . . 600 602 604 606 608 60 A 4 6 4660 4608 4660 -14 4

Operating Systems How we control this hardware BS 2911 Week 2 6 Operating Systems How we control this hardware BS 2911 Week 2 6

Operating Systems l l Though the processor is simple and serial, we want to Operating Systems l l Though the processor is simple and serial, we want to do more complex things, often several at once An operating system is a program that provides the building blocks of complex systems » Some simply encapsulate function to save every application from having to include a copy » Others handle specific hardware, presenting a generic interface that hides behaviour unique to that hardware » Sometimes the interface is so generic that it has little to do with the hardware – file structures are the best example l Modern operating systems make it look as if the computer is doing several things at the same time » Our operating system is Windows XP BS 2911 Week 2 7

Concurrent Operations l To give the appearance of doing several things at once: » Concurrent Operations l To give the appearance of doing several things at once: » OS must stay ready to accept work: – keystrokes, mouse clicks, signals from modem, printer ready to receive another buffer of data – These can interrupt a computation already being run » It then does a bit of the required work, » then goes back to an interrupted task, and so on. l l We say the machine is doing things “concurrently” – they’re not simultaneous, but they look it! The key is switching the CPU between logical processes » In theory, you could go round “polling” – high overhead » In practice, concurrency depends on hardware interrupts BS 2911 Week 2 9

Essentials of an operating system l Controls the hardware » Lets applications be less Essentials of an operating system l Controls the hardware » Lets applications be less hardware-specific by abstracting operations (who cares how big a track is!) » Reduces havoc that can be done by rogue programs by restricting use of risky instructions (such as those giving direct access to hardware) » Allows processes to update files with integrity l l Encapsulates commonly-used functions Manages resources, including storage Supports concurrent operations Success judged by performance, in terms of Availability, Reliability, Response-time, Throughput BS 2911 Week 2 10

In the beginning. . . l 21 June 1948: First stored-program computer (Manchester University In the beginning. . . l 21 June 1948: First stored-program computer (Manchester University “Baby”) ran its first program » » l Too much investment Program keyed directly into memory to let it sit around Results displayed as dots on a CRT waiting for humans to When program finished, it stopped press buttons Next machines used tape or card for I/O Monitors developed in 1950 s » » encapsulate standard functions (for example, Input/Output) automate running of programs one after another still one program at a time then added SPOOLING to overlap input and output BS 2911 Week 2 11

True Operating Systems l l Introduced with Ferranti Atlas and IBM System/360 Applied concurrency True Operating Systems l l Introduced with Ferranti Atlas and IBM System/360 Applied concurrency to user work as well as to SPOOL » Potential to run complementary jobs alongside each other l OS became a resource manager » » l Sharing processor resource between jobs Providing separate memory for use by each job Controlling allocation of tapes and other hardware Scheduling jobs to fit resources available Used interrupts to switch control between processes » Need to be sure we understand how they work l Foundation for on-line systems with terminals BS 2911 Week 2 13

On-line Computing l l Terminal attached to mainframe computer Operating system “time-shared” processor among On-line Computing l l Terminal attached to mainframe computer Operating system “time-shared” processor among users Developed initially with slow lines and typewriter-like terminals or teleprinters, which sent a character at a time It was expensive to read every keystroke » so switched to using “Block mode”: » User types into terminal buffer, presses Enter to transmit l l Most transaction processing is done that way, even today Weaknesses of mainframe + terminal are » poor bandwidth: can’t track mouse, write graphics » can’t take shortcuts based on every keystroke BS 2911 Week 2 15

Basic Concepts Covered So Far l Faking concurrency » multiprogramming: appearing to do several Basic Concepts Covered So Far l Faking concurrency » multiprogramming: appearing to do several things at once » processes and threads » For multiple users – or one user with several balls in the air l Interrupts l There’s more to come on: » I/O buffering » Spooling (offline, online) » Multiprocessing – Using multiple processors to get more power – symmetrical, clustering or master-slave BS 2911 Week 2 17

What Operating Systems Do OS/360 and Batch Scheduling How Online Computing is different BS What Operating Systems Do OS/360 and Batch Scheduling How Online Computing is different BS 2911 Week 2 19

OS/360 l l “Betting the Business” for IBM in late 1960 s Environment: » OS/360 l l “Betting the Business” for IBM in late 1960 s Environment: » Batch processing » Real memory only (Ferranti Atlas had paging, but the idea hadn’t yet crossed the Atlantic) » Physical cards used for job entry » Line-printers used for output (up to 1000 lines/min) » Tapes and disks expensive but heavily used l Concepts » Job Control Language (JCL) to describe each job » Each program ran in a Job Step BS 2911 Week 2 20

Structure of a Job Whole Job Step 1, e. g. compile program Needs card Structure of a Job Whole Job Step 1, e. g. compile program Needs card input + workfile l l l Step 2, e. g. link-edit program l Needs object deck + workfile l Step 3, e. g. run program Needs module + input data Step 4, e. g. sort output Needs output data Step 5, e. g. run utility on result Needs sort output + target file BS 2911 Week 2 l Must run steps in sequence Don’t run step if previous one failed Must have input available at start of step Need somewhere to write results Usually generate spool output Normally expects the Program run in each step to be on disk //ERIC JOB //COMP EXEC //SYSIN DD //SYSPRINT DD //SYSOUT DD //LINK EXEC /* and so on PGM=PLIOPT * * DSN=“ERIC. PLI. OBJ” PGM=LKEDIT 21

Scheduling Jobs l Back in the days of monitors, scheduling was easy » When Scheduling Jobs l Back in the days of monitors, scheduling was easy » When a job finishes, load the next one and run it » If I/O is spooled, next one will be loaded from spool file that contains images of cards read in earlier. . » . . and CPU time needs to be shared between the running job and spool I/O (which uses predictably little CPU) l Gets harder when more than one real job can run » Have to match resource requirements with availability » Need to be concerned with sequence of jobs » Optimization needs awareness of job type (processor-heavy, I/O heavy, etc. ) » Specified with complex Job Control Language BS 2911 Week 2 22

OS/360 Batch Scheduling l Job 5 l Job 3 Job 4 l Job 2 OS/360 Batch Scheduling l Job 5 l Job 3 Job 4 l Job 2 Job 1 Print spool Operating System Job initiators BS 2911 Week 2 Card spool Job queue memory Wasted fragment of storage l Memory was critical resource (>$1000 per kilobyte) Divided into partitions or regions, each with a job initiator OS reads each job in and places it on a (prioritized) queue When job completes in region, initiator looks on queue for more work » Must fit in available memory » Necessary resources must be available » Otherwise try continue looking down queue 23

Batch Scheduling Problems l Storage » With fixed-size partitions, you can have long queues Batch Scheduling Problems l Storage » With fixed-size partitions, you can have long queues for a big partition while one or more small ones are free » With variable-sizes (“regions”), you get fragmentation » Various steps may have different space requirements l Resource allocation » Need to collect together all resources needed by a step: such as files and dedicated hardware » Can still waste run time (e. g. if you get a tape drive but haven’t mounted the right tape on it) » Addressed by extensions to Job Control Language (even more chances to make mistakes with it!) BS 2911 Week 2 24

Risks of Deadlock OS/360 enforced pre-allocation to avoid deadlock l l Consider two jobs, Risks of Deadlock OS/360 enforced pre-allocation to avoid deadlock l l Consider two jobs, A & B Job A » is holding tape drive 1 » can’t complete until it can update file X. Y. Z l Job B » is writing file X. Y. Z » can’t close the file until it’s written a log to tape » BUT there are no tape drives available l l Therefore both jobs will stall, tying up both regions But you can’t pre-allocate with on-line users BS 2911 Week 2 25

Scheduling Today l We’re not usually concerned with resources on a home PC » Scheduling Today l We’re not usually concerned with resources on a home PC » Schedule an anti-virus upgrade and it’ll run quickly (though running the virus checker might be much slower) l We may be concerned about sequence » Better to be sure the upgrade is complete before scanning l In business systems: » Duration can be longer (that’s why ITS constrains disk space; otherwise the back-ups would take too long) » Sequence can be critical – don’t pay out before taking in » Every transaction must run once and once only BS 2911 Week 2 26

Scheduling and Dispatching l Once we’ve scheduled jobs to start, we have to divide Scheduling and Dispatching l Once we’ve scheduled jobs to start, we have to divide machine cycles between the concurrent processes » With a small degree of multiprogramming (few regions), that can be fairly simple » Whenever a region waits, we dispatch another one » Dispatcher is like a micro-level scheduler » Often have different dispatch and initiator priorities l Storage limitations addressed with Virtual Memory » Allowed increase in number of initiators » Increasing degree of multiprogramming. . » . . and need for more complex dispatching – there’s no point in dispatching a process without (real) memory BS 2911 Week 2 27

Online Systems l l Expands scale of allocation and dispatching problems “Jobs” become very Online Systems l l Expands scale of allocation and dispatching problems “Jobs” become very long-running » » l so we can’t pre-assign all resources and hold until job end Total number of jobs grows greatly Jobs need to sleep when user isn’t interacting Each interaction is like a mini job step Two basic approaches to managing this » Treat each user as a process and tune the dispatcher » Unix, VM/370, MVS/TSO and VMS work this way » Treat each user as a thread on a “timesharing” process » CICS and IMS work this way » High-performance web servers too BS 2911 Week 2 28

Time-sharing l Consider a system with 100 on-line users » Average think time 10 Time-sharing l Consider a system with 100 on-line users » Average think time 10 seconds (so overall arrival rate is 10 interactions per second) » Average CPU demand of 50 msec per interaction » Therefore load should be 50% plus overhead » If load is homogeneous, “round-robin” dispatching is OK l But what if a few users need 1 sec & the rest 10 msec? » Queue will build up if the long task is allowed to complete » OK, let’s preempt task on expiry of a time-slice; suspend task (take the CPU away) if it takes too long, and make it wait until next time round BS 2911 Week 2 29

Life Cycle of an Interaction User hits ENTER Task runs until interrupted for some Life Cycle of an Interaction User hits ENTER Task runs until interrupted for some reason Task Created Executable Task On Ready Queue Dispatched Finishes Terminated Time expires Requeued on Event BS 2911 Week 2 Running Enters WAIT Blocked 30

Dispatching Tasks l Let’s assume a Ready Queue of tasks waiting to run » Dispatching Tasks l Let’s assume a Ready Queue of tasks waiting to run » OS adds tasks to queue according to a priority pattern (cheapest is FIFO*, but we may want to improve on that) » Dispatch the task at the head of the queue » When it gives up control, dispatch new head of queue » May want to maintain queue of blocked tasks too l What if task doesn’t give up control? » Need to interrupt it at end of time slice to let others run (Windows 3. x didn’t do this except for DOS tasks) » Can return it directly to Ready Queue (with risk that it’ll consume too much CPU time) » Maybe we should favour short interactions over long BS 2911 Week 2 * First In First Out 31

Graphical Operating Systems Development of Windows BS 2911 Week 2 32 Graphical Operating Systems Development of Windows BS 2911 Week 2 32

Graphical Operating Systems l WIMP concepts » Windows, Icons, Menus, Pointer » invented late Graphical Operating Systems l WIMP concepts » Windows, Icons, Menus, Pointer » invented late 70 s at Xerox Palo Alto Research Center l First marketed in Lisa machine – very expensive » Later in Xerox “Daisy” – still too costly to succeed l Apple made success of the idea in Macintosh – 1984 » Massive advertising campaign » Succeeded first with designers and Desk Top Publishing l IBM & Microsoft followed with 16 -bit OS/2 V. 1 (1987) » Full WIMP approach in 1988 » IBM Went it alone for OS/2 V 2 – incompatible interface BS 2911 Week 2 33

Early Flavours of Windows l Windows 1 and 2 » Never really made it Early Flavours of Windows l Windows 1 and 2 » Never really made it – Lisa ideas done less well than Mac l l OS/2 Version 1 (Microsoft/IBM collaboration) Windows 386 » Exploited 80386 virtual machine code; Win 2 interface l Windows 3. 0 (1990) – The breakthrough » Picked up OS/2 V 1 user interface, with simpler API » Added Windows 386 process mgt (multiple DOS boxes) » Still no pre-emption of ill-behaved Windows processes l Windows 3. 1 » Enhanced Win 3. 0 without major architecture changes » Added some new GUI controls BS 2911 Week 2 34

Flavours of Windows since 1993 l Windows for Workgroups (3. 1 and 3. 11) Flavours of Windows since 1993 l Windows for Workgroups (3. 1 and 3. 11) » Added networking capabilities » Introduced (some) 32 -bit code, such as file I/O » You could bolt-on IP network support – free but not trivial l Windows 95 – New user interface » » l Integrated IP networking Much more 32 -bit code Long file-names (and file-types, unlike OS/2) Still not fully pre-emptive multitasking, but improved capability to detect and abort ill-behaved processes Windows 98 – Minor changes from W 95 » Adds Internet-like interface to Windows 95 » Meant to be “last of the line of Windows 3. x successors” BS 2911 Week 2 35

Windows NT l NT V 3. x » » l Microsoft’s OS/2 successor, with Windows NT l NT V 3. x » » l Microsoft’s OS/2 successor, with full Windows GUI Kernel based on experiences with VMS (at Digital) Data permissions RACF style, by user and group 32 -bit, with some limitations on use of 16 -bit applications NT V 4. 0 » » » Enhanced from NT V 3. 51 Added Windows 95 user interface Improved tolerance of 16 -bit applications… …providing they don’t try to access the hardware directly Full pre-emptive multitasking – Windows processes get time-sliced, so ill-behaved ones can’t hog the processor BS 2911 Week 2 36

Current Windows Flavours l Windows 2000 – Intended to unify NT and 9 x Current Windows Flavours l Windows 2000 – Intended to unify NT and 9 x families » To avoid duplicate development effort » Replaced NT for professionals and large & small Servers » But Domestic version didn’t run all W 98 software, so… l Millennium Edition (of Windows 98) » Stopgap because 98/NT integration wasn’t complete l Windows XP – finally did unite NT and 9 x families » Came in versions for different purposes – XP Home edition, – Professional edition for corporate clients – Servers l Increasing price Similar approach with Windows Vista (2007) and W 7 BS 2911 Week 2 37

Summary of Week 2 l Computer does simple things, in sequence » Instruction counter Summary of Week 2 l Computer does simple things, in sequence » Instruction counter contains address of next instruction to run l Operating systems package these into useful facilities » Including ability to run programs concurrently l Processor is a resource that the Operating System uses » OS treats each program as a task » Gives it a bit of time on the processor » Then passes the processor to another task l OS gets control back through interrupts » Voluntary (supervisor call by user program) » External (such as disk I/O completion, timer interrupt) BS 2911 Week 2 38

Checkpoint Questions l Describe differences between B 2 C & B 2 B e-Commerce Checkpoint Questions l Describe differences between B 2 C & B 2 B e-Commerce » 1. » 2. l What are the main functions of an Operating System? » 1. » 3. l 2. 4. What does the “Instruction Counter” point to? BS 2911 Week 2 39