etm 555 1 operating systems. etm 555 2 what is an operating system? a program that acts as an...

78
ETM 555 1 Operating Systems

Post on 20-Dec-2015

216 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 1

Operating Systems

Page 2: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 2

What is an Operating System?• A program that acts as an intermediary between a user of a

computer and the computer hardware.

• Operating system goals:

– Execute user programs and make solving user problems easier.

– Make the computer system convenient to use.

• Use the computer hardware in an efficient manner.

Page 3: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 3

Computer System Components1. Hardware – provides basic computing resources (CPU, memory, I/O

devices).2. Operating system – controls and coordinates the use of the hardware

among the various application programs for the various users.3. Applications programs – define the ways in which the system

resources are used to solve the computing problems of the users (compilers, database systems, video games, business programs).

4. Users (people, machines, other computers).

Page 4: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 4

Abstract View of System Components

Page 5: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 5

Operating System Definitions• Resource allocator – manages and allocates

resources.• Control program – controls the execution of user

programs and operations of I/O devices .• Kernel – the one program running at all times (all

else being application programs).

Page 6: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 6

Simple Batch Systems• Hire an operator• User operator• Add a card reader• Reduce setup time by batching similar jobs• Automatic job sequencing – automatically transfers control from one job to another. First rudimentary operating system.• Resident monitor

– initial control in monitor – control transfers to job – when job completes control transfers back to monitor

Page 7: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 7

Time-Sharing Systems–Interactive Computing

• The CPU is multiplexed among several jobs that are kept in memory and on disk (the CPU is allocated to a job only if the job is in memory).

• A job is swapped in and out of memory to the disk.• On-line communication between the user and the system is provided;

when the operating system finishes the execution of one command, it seeks the next “control statement” not from a card reader, but rather from the user’s keyboard.

• On-line system must be available for users to access data and code.

Page 8: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 8

Personal-Computer Systems• Personal computers – computer system dedicated to a single user.• I/O devices – keyboards, mice, display screens, small printers.• User convenience and responsiveness.• Can adopt technology developed for larger operating system’ often individuals have sole use of computer and do not need

advanced CPU utilization of protection features.

Page 9: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 9

Common OS System Components

• Process Management • Main Memory Management• Secondary-Storage Management• I/O System Management• File Management• Protection System• Networking• Command-Interpreter System

Page 10: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 10

UNIX Versions & Clones

•System V (AT&T)

• AIX (IBM)

•BSD (Berkeley Univ.)

•HP-UX (HP)

•Linux (Linus Torvalds)

•Minix (Tanenbaum)

•OSF (open software foundation)

•SCO (santa cruz operation)

•Solaris (SUN Microsystems)

•XENIX (Microsoft)

•FreeBSD

Page 11: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 11

UNIX HISTORY

• 1950’s time-sharing invented at Dartmouth & MIT (sys. running only basic)

• MIT System CTSS

• 2nd Generation: MIT, Bell Labs, GE designed MULTICS (Multiplexed Information Computing Service)

• Ken Thompson from Bell Labs wrote stripped down MULTICS on a discarded PDP-7. Code was written in assembly language.

• Brian Kernighan – (Bell labs) called the system UNICS (Uniplexed Information Computing Service). Later this name was changed to UNIX.

• Dennis Ritchie joined the team of Ken Thompson.

• UNIX moved to PDP-11

• B and later C languages were designed/developed.

Page 12: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 12

UNIX HISTORY• Thompson and Ritchie rewrote UNIX in C.

• 1974, Thompson and Ritchie wrote a landmark paper on on UNIX.

• Universities started to ask for a copy of UNIX.

• By Mid 80’s UNIX was in widespread use.

• AT&T released first commercial UNIX product : System III which was not well received.

• AT&T later released System V.

• AT&T decided to concentrate on telephone business. Sold UNIX business to Novell – 1993.

• Novell sold UNIX biz to Santa Cruz Operation in 1995.

Page 13: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 13

UNIX HISTORY• Berkeley Unix (BSD: Berkeley Software Distribution). Introduces many

improvements, networking TCP/IP.

• System V and BSD are major 2 Unix flavors

• IEEE POSIX standard was developed to reconcile these two flavors – took intersection of these two systems

• POSIX: Portable Operating System IX

• POSIX Idea: A software vendor who writes his a program that uses only procedures defined in POSIX standard knows that this program will run on every conformant UNIX system.

• OSF : (Open Software Foundation), IBM, DEC, HP Unix system version (with X11, Motif etc included)

• OSF gradually vanished

Page 14: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 14

UNIX HISTORY• Solaris: (from SUN Microsystems) is based on System V.

• Minix (Tanenbaum) written for educational purposes ’87, 12K lines of code.

• Linux: developed by finnish student Linux Torvalds), first released in ’91.

• Minix has micro-kernel architecture, Linux is monolithic.

• Big famous argument between Tanenbaum & Linus about micro-kernel vs monolithic operating systems.

Page 15: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 15

Comparison of some operating system sizes

Page 16: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 16

Windows Desktop OS Family History

2006 Windows Vista

2009 Windows 7

Page 17: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 17

Comparison

Page 18: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 18

Page 19: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 19

Windows Server OS History

2005 Windows Server 2003 R2

2008 Windows Server 2008

2003

2009 Windows Server 2008 R2

Page 20: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 20

Miscellaneous OSs

• NeXTSTEP, OPENSTEP :-object-oriented, multitasking operating system developed by NeXT Computer.

• MAC OS: - Apple computer operating system - Based on Mach/NextStep/FreeBSD/NetBSD

• iOS: based on Mac OS X, runs on the iPhone, iPod Touch, iPad• Android

- mobile operating system - developed by Android Inc. was purchased by Google in 2005 - based upon a modified version of the Linux kernel.

• Symbian : - Nokia's mobile operating systems for mobile devices and smartphones

Page 21: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 21

WEB Programming

Page 22: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 22

HTML

• Hypertext Markup Language

• Identifies the elements of a page so that a browser such as MS Internet Explorer or Netscape can render that page on the computer screen

• Static page description

• WYSIWYG web page authoring tools

- MS Frontpage

- Dreamweaver

- Home Site

Page 23: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 23

HTML Example Source

<HTML>

<HEAD>

<TITLE> Hello </TITLE>

</HEAD>

<BODY>

<P> Hello world </P>

</BODY>

</HTML>

Page 24: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 24

HTML Form Example

<HTML><HEAD>

<TITLE> Hello </TITLE>

</HEAD>

<BODY>

<FORM METHOD="GET" ACTION="http://localhost/cgi-bin/ex.cgi >

<INPUT TYPE="text" NAME="word">

<INPUT TYPE="submit" VALUE="Submit word">

</FORM>

</BODY>

</HTML>

Page 25: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 25

GET and POST METHODS

• GET method passes form input as part of the URL to the server side program:

http://www.yahoo.com/cgi-bin/process.cgi?firstname=ali&last=veli

• POST method passes input to the standard input of the server side program:

firstname=ali

last=veli

Page 26: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 26

JAVASCRIPT

• Scripting language

• Browser contains Javascript interpreter which processes the commands in the script

• Processed by client

Page 27: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 27

Javascript Example Source

<HTML>

<HEAD>

<TITLE> Hello </TITLE>

<SCRIPT LANGUAGE= "Javascript" >

function sayhello()

{

document.writeln("<p> Hello world </p>") ;

}

</SCRIPT>

</HEAD>

<BODY ONLOAD= "sayhello()" > </BODY>

</HTML>

Page 28: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 28

CSS (Cascading Style Sheets)

• Allow you to specify the style of your page elements (spacing, margins etc) separately from the structure of your documents (section headers, body, text, links etc)

• “Separation of Structure from Content” allows greater manageability and makes changing the style of the document easier.

Page 29: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 29

CSS Example Source

<HTML>

<HEAD> <TITLE> Hello </TITLE> </HEAD>

<BODY>

<P STYLE= “font-size: 20 pt” > Hello world </P>

</BODY></HTML>

• inline style (w/o CSS)

Page 30: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 30

CSS Example Source

<HTML>

<HEAD>

<TITLE> Hello </TITLE>

<STYLE TYPE = “text/css”>

P {font-size: 20 pt }

</STYLE>

</HEAD>

<BODY>

<P > Hello world </P>

</BODY></HTML>

• css style sheet

Page 31: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 31

CSS Example Source

<HTML>

<HEAD>

<TITLE> Hello </TITLE>

<LINK REL = “stylesheet” TYPE=“text/css” HREF = “styles.css”

</HEAD>

<BODY>

<P > Hello world </P>

</BODY></HTML>

• importing the css file:

Page 32: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 32

XML-Extensible Markup Language

• HTML markup is for displaying information

• XML markup is for describing data of virtually any type

• XML enables creation of new markup languages to markup anything imaginable (such as mathematical formulas, records etc)

• In XML, new tags can be created

• Data is structured in a hierarchical manner

Page 33: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 33

XML example

<? xml version = “1.0”>

<person>

<firstname> Ali </firstname>

<lastname> Veli </lastname>

<married> yes </married>

<wife>

<firstname> Ayse </firstname>

<lastname> Mehmet </lastname>

</wife>

</person>

Page 34: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 34

XML Document Model

• A “document model” is used to enforce structure within a document

• Two types of document models for XML:

– DTD – Document Type Definition

– XML Schema

• Document models are not required in XML

Page 35: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 35

Validating Parsers

• A validating parser will check an XML document’s structure against a DTD or XML Schema

• Documents that conform to a document model are “valid”

• Validating parsers will report an error if the document does not conform to it’s document model, even if it is well-formed

Page 36: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 36

DTD Example: XML File

• 1 <?xml version=”1.0” standalone=”yes”?>

• 2 <emails>

• 3 <message num=”a1” to=”joe&#64;acmeshipping.com”

• 4 from=”brenda&#64;xyzcompany.com” date=”02/09/01”>

• 5 <subject title=”Order 10011”/>

• 6 <body>

• 7 Joe,

• 8 Please let me know if order number 10011 has shipped.

• 9 Thanks,

• 10 Brenda

• 11 </body>

• 12 <reply status="yes"/>

• 13 </message>

• 14 </emails>

Page 37: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 37

DTD Example: Internal DTD1 <!DOCTYPE emails [ 2 <!ELEMENT emails (message+)>3 <!ELEMENT message (subject?, body, reply*)>4 <!ATTLIST message5 num ID #REQUIRED6 to CDATA #REQUIRED7 from CDATA #FIXED

“brenda&#64;xyzcompany.com”8 date CDATA #REQUIRED>9 <!ELEMENT subject EMPTY>10 <!ATTLIST subject11 title CDATA #IMPLIED>12 <!ELEMENT body ANY>13 <!ELEMENT reply EMPTY>14 <!ATTLIST reply15 status (yes | no) "no">16 ]>

Page 38: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 38

XML Schema

• XML Schema specification released by the W3C in May 2001, and contains two parts:

– Part I - structure

– Part II - data types

• Developed as an alternative to DTD’s and is much more powerful

• Features:

– Pattern matching

– Rich set of data types

– Attribute grouping

– Supports XML namespaces

– Follows XML syntax

Page 39: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 39

XML Schema Example

1 <?xml version=”1.0”?>2 <message3 xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"4 xsi:noNamespaceSchemaLocation = "message_schema.xsd">5 <to>Joe Poller</to>6 <from>Brenda Lane</from>7 <date_sent/>8 <subject>Order 10011</subject>9 <body>10 Joe, 11 Please let me know if order number

10011 has shipped. 12 Thanks, 13 Brenda14 </body>15 </message>

Page 40: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 40

XML Schema Example

1 <?xml version=”1.0”?>2 <xsd:schema xmlns:xsd=”http://www.w3.org/2001/XMLSchema”>3 <xsd:element name=”message”>4 <xsd:complexType>5 <xsd:sequence>6 <xsd:element name=”to” type=”xsd:string”

minOccurs-“1”

maxOccurs=”unbounded”/>7 <xsd:element name=”from” type=”xsd:string”

minOccurs=”1”/>8 <xsd:element name=”date_sent”

type=”xsd:date”/>9 <xsd:element name=”subject”

type=”xsd:string”/>10 <xsd:element name=”body”

type=”xsd:string”/>12 </xsd:sequence>12 </xsd:complexType>13 </xsd:element>14 </xsd:schema>

Page 41: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 41

ASP/PHP

• Javascript is client side scripting language

• ASP/PHP are server side scripting languages

• ASP/PHP process pages on the server and return the results in the form of HTML source to the client (browser)

• ASP is Microsoft product

Page 42: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 42

PHP Example 1

<html> <body><?php $db = mysql_connect("localhost", "root"); mysql_select_db("mydb",$db); $result = mysql_query("SELECT * FROM employees",$db); printf(“<p>First Name: %s</p>\n", mysql_result($result,0,"first")); printf(“<p>Last Name: %s</p>\n", mysql_result($result,0,"last")); printf(“<p>Address: %s</p>\n", mysql_result($result,0,"address")); printf(“<p>Position: %s</p>\n", mysql_result($result,0,"position")); ?> </body> </html>

Page 43: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 43

PHP Example 2 <html> <body> <?php if ($submit) { // process form $db = mysql_connect("localhost", "root"); mysql_select_db("mydb",$db); $sql = "INSERT INTO employees (first,last,address,position) VALUES ('$first','$last','$address','$position')"; $result = mysql_query($sql); echo "Thank you! Information entered.\n"; } else{ // display form ?> <form method="post" action="<?php echo $PHP_SELF?>"> First name:<input type="Text" name="first"><br> Last name:<input type="Text" name="last"><br> Address:<input type="Text" name="address"><br> Position:<input type="Text" name="position"><br> <input type="Submit" name="submit" value="Enter information"> </form> <?php } // end if ?> </body> </html>

Page 44: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 44

PHP-MYSQL PROGRAMMING

MYSQL Commands

CREATE TABLE tablename ( columnname typ modifiers,

columnname typ modifiers,

…..)

SELECT fieldname1, fieldname2,.. FROM tablename WHERE criteria

SELECT fieldname1, fieldname2,.. FROM tablename ORDER BY fieldname ASC

DSC

Page 45: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 45

PHP-MYSQL PROGRAMMING

INSERT INTO tablename (fieldname1, fieldname2,…) VALUES

(‘value1’, ‘value2’, … )

UPDATE tablename SET fieldname1=‘value1’, fieldname2=‘value2’ WHERE criteria

DELETE FROM tablename WHERE criteria

Page 46: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 46

CGI

• Common Gateway Interface

• Protocol to enable running programs on the web server

•These programs produce HTML output which is sent to the client (browser)

•Programs can be written in any language (most popular is PERL)

Page 47: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 47

PERL

• Practical Extraction and Report Language

• Became popular with CGI programs

• High level – rich and easy to use pattern matching, text processing operators

• Lots of free PERL modules (packages) are available that make programming easy:

-networking modules

-Html/XMP parser, CGI modules

• Extremely useful for developing automated pograms that surf the Internet

Page 48: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 48

Automated Web Page Downloader#!/usr/local/bin/perl

use LWP::UserAgent ;

use HTML::TokeParser ;

$options{"agent"} = "Mozilla/4.6 [en] (X11; I; SunOS 5.7 sun4u)";

my $agent = new LWP::UserAgent(%options);

my $request = new HTTP::Request('GET' => $ARGV[0] ) ;

my $response = $agent->request($request) ;

if ( $response->is_success() ) {

print($response->content()) ;

} else {

print("Error: " . $reponse->status_line() . "\n" ) ;

die ;

}

Page 49: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 49

CGI Life Cycle

• Server receives a request for a CGI program

• Server creates a new process to run the CGI program

• Server passes information to the program:

– via environment variables and standard input.

Page 50: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 50

CGI – Based Web Server

Request for CGI1

Request for CGI2

Request for CGI1

Child process for CGI1

Child process for CGI2

Child process for CGI1

Main Process

Page 51: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 51

Problems with CGI

• Expensive to create a process for each request:– requires time and significant server resources, – limits the # of requests a server can handle concurrently

• Stateless: No history remembered– A big problem for web-based development– Solutions: cookies– Still expensive

Page 52: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 52

Problems with CGI

• Once the CGI program starts:

– It cannot interact with the web server

– It takes advantage of the server's abilities once it begins execution

• Reasons: the program is running in a separate process.

• Example, a CGI script cannot write to the server's log file.

Page 53: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 53

Ways to Improve CGI Performance

• FastCGI

• mod_perl

• Other solutions

Page 54: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 54

FastCGI

• Developed by a company “Open Market”

• FastCGI creates a single persistent process for each FastCGI program

• It eliminates the need to create a new process for each request.

• See: http://www.fastcgi.com/

Page 55: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 55

FastCGI

• No need to start multiple processes for different requests for the same fastcgi program

• Still needs one process for each cgi program.

• It does nothing to help the FastCGI program to interact more closely with the server.

– Not implemented by some of the more popular servers, i.e., Microsoft's Internet Information Server.

• Not very portable

Page 56: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 56

FastCGI – Based Web Server

Request for CGI1

Request for CGI2

Request for CGI1

Single Child process for CGI1

Single Child process for CGI2

Main Process

Page 57: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 57

Mod_perl

• Used in the Apache web server

• mod_perl is a module that embeds a copy of the Perl interpreter into the Apache httpd executable

• Providing complete access to Perl functionality within Apache

• CGI scripts are precompiled by the server and executed without forking,

• Thus running much more quickly and efficiently.

• http://perl.apache.org/

Page 58: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 58

Server Extension APIs

• Proprietary server extension APIsfor example:

– Netscape provides an internal API called NSAPI

– Microsoft provides ISAPI

– Exist within the main process of a web server

Page 59: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 59

Server Extension APIs Advantages

• Using one of these APIs, one can write server extensions that enhance or change the base functionality of the server

• Allowing the server to handle tasks that were once assigned to external CGI programs.

• Use linked C or C++ code

– Thus can run extremely fast; and

– make full use of the server's resources.

Page 60: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 60

Web Server with Server Extension API

Request for ServerExtension1

Request for ServerExtension2

Request for ServerExtension1

ServerExtension1

ServerExtension2

Main Process

Page 61: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 61

Server Extension APIsDisadvantages

• Difficult to develop and maintain

• Pose significant security and reliability hazards

– a crashed server extension can bring down the entire server.

• Proprietary server extensions are tied to the server API on a particular OS

– Not very portable

Page 62: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 62

JAVA

• Introduced by SUN Microsystems

• Object oriented programming language

• Java compiler creates bytecodes that are interpreted by java bytecode interpreter

• Portable bytecode

• Java can be used to create dynamic content on web pages

• Java applets: are programs that can be embedded in HTML documents. Browser (i.e. client) executes the applets.

Page 63: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 63

JAVA Servlets

• A servlet is a server-side version of an applet

• Servlets are executed on the server under the control of web server

• Servlets are called from HTML just as with applets

• Servlet receive a request and returns a response to the client in the form of an HTML source

• Often used as alternative to CGI programs

• Some advantages:

- CGI programs start, execute and stop providing no way to save information whereas servlet continue to run (hence capable of saving information)

- Large set of APIs

- Can be faster than CGI

Page 64: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 64

Java Servlet Based Web Server

Request for Servlet1

Request for Servlet2

Request for Servlet1

Servlet1

Servlet2

Main Process

thread

thread

thread

JVM

Page 65: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 65

AJAX Technologies(Asynchronous Javascript and XML)

• Ajax programming uses combination of :

– XHTML/HTML and CSS for formatting.

– DOM accessed with a client-side scripting language such as JavaScript to dynamically display and interact with the information presented.

– XMLHttpRequest object is used to exchange data asynchronously with the web server without leaving the current page

– XML is used for transferring data between the server and client, (any other format can also be used).

• Example: Gmail uses ajax technologies

Page 66: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 66

Web Services Technologies

• XML-RPC

• SOAP

• WSDL

• UDDI

Page 67: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 67

XML-RPC

• XML-RPC uses a simple XML application to express function calls (requests) and returned values (responses) between clients and servers.

• The heart of an XML-RPC message is the way data is encoded into XML.

Page 68: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 68

SOAP ( Simple Object Access Protocol )

SOAP :

• XML based protocol to let applications exchange information over HTTP

• Protocol for accessing a Web Service.

• A communication protocol

• For communication between applications

• Provides a format for sending messages

• Designed to communicate via Internet

• Platform independent

• Language independent

• Simple and extensible

Page 69: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 69

<?xml version="1.0"?><soap:Envelopexmlns:soap="http://www.w3.org/2001/12/soap-envelope"soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"> <soap:body pb="http://www.acme.com/phonebook"> <pb:GetUserDetails> <pb:UserID>12345</pb:UserID> </pb:GetUserDetails> </soap:Body></soap:Envelope>

SOAP ( Example Request)

Page 70: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 70

WSDL( Web Services Description Language )

• WSDL is a document written in XML which describes a web service. It specifies the location of the service and the operations (or methods) the service provides.

Page 71: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 71

UDDI( Universal Description, Discovery and Integration )

• UDDI is a directory service where businesses can register and search for web services.

UDDI communicates via SOAP

Web service interfaces in UDDI is described by WSDL

Page 72: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 72

• Representational State Transfer• REST is an architecture style for designing networked applications. •Rather than using complex mechanisms such as RPC or SOAP to connect between machines, simple HTTP is used to make calls between machines.• RESTful applications use HTTP requests to post data (create and/or update), read data (e.g., make queries), and delete data.• Despite being simple, REST is fully-featured; there's basically nothing you can do in Web Services that can't be done with a RESTful architecture.

Examples:• http://www.acme.com/phonebook/UserDetails/12345• http://www.acme.com/phonebook/UserDetails?firstName=John&lastName=Doe

REST

Page 73: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 73

Dynamic Load Balancing Web-Server Systems

Server1

Server2

Server3

Server4

ServerM

Client1

Client2

Client3

Client4

ClientN

Page 74: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 74

Dynamic Load Balancing Web-Server Systems

• Client-Based Approach

– Web clients, if they are aware of the Web-server system’s replicated servers, can actively route requests

– After receiving a request, the Web client selects a node of the web server cluster and, after resolving the address mapping, submits the request to the selected node, which is then responsible for responding to the client.

– Approaches:

• Netscape: wwwi.netscape.com

• Via smart client, e.g java applet

Page 75: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 75

Dynamic Load Balancing Web-Server Systems

• DNS-Based Approach

– The cluster DNS—the authoritative DNS server for the distributed Web system’s nodes—translates the symbolic site name (URL) to the IP address of one server

Page 76: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 76

Dynamic Load Balancing Web-Server Systems

• Dispatcher-Based Approach

Page 77: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 77

Dynamic Load Balancing Web-Server Systems

• Server-Based Approach

Page 78: ETM 555 1 Operating Systems. ETM 555 2 What is an Operating System? A program that acts as an intermediary between a user of a computer and the computer

ETM 555 78

Amazon’s Cloud Load Balancing Service

• Elastic Load Balancing automatically distributes incoming application traffic across multiple Amazon EC2 instances.• http://docs.amazonwebservices.com/ElasticLoadBalancing/latest/DeveloperGuide/