CSE 130 Programming Language Principles & Paradigms Lecture # 20. Chapter 13 Concurrency. + AJAX Discussion

Size: px
Start display at page:

Download "CSE 130 Programming Language Principles & Paradigms Lecture # 20. Chapter 13 Concurrency. + AJAX Discussion"

Transcription

1 Chapter 13 Concurrency + AJAX Discussion

2 Introduction Concurrency can occur at four levels: Machine instruction level (Processor) High-level language statement level Unit level Program level (OS) Because there are no language issues in instruction- and program-level concurrency, they are not addressed here

3 Multiprocessor Architectures Late 1950s - one general-purpose processor and one or more special-purpose processors for input and output operations Early 1960s - multiple complete processors, used for program-level concurrency Mid-1960s - multiple partial processors, used for instruction-level concurrency Single-Instruction Multiple-Data (SIMD) machines Multiple-Instruction Multiple-Data (MIMD) machines Independent processors that can be synchronized (unit-level concurrency)

4 Categories of Concurrency A thread of control in a program is the sequence of program points reached as control flows through the program Categories of Concurrency: Physical concurrency - Multiple independent processors ( multiple threads of control) Logical concurrency - The appearance of physical concurrency is presented by time-sharing one processor (software can be designed as if there were multiple threads of control) Coroutines (quasi-concurrency) have a single thread of control

5 Motivations for Studying Concurrency Involves a different way of designing software that can be very useful many real-world situations involve concurrency Multiprocessor computers capable of physical concurrency are now widely used With Web services (when asynchronous) we may see distributed concurrency sooner than we think

6 Intro to Subprogram-Level Concurrency A task or process is a program unit that can be in concurrent execution with other program units Tasks differ from ordinary subprograms in that: A task may be implicitly started (maybe by time or action) When a program unit starts the execution of a task, it is not necessarily suspended When a task s execution is completed, control may not return to the caller Tasks usually work together

7 Two General Categories of Tasks Heavyweight tasks execute in their own address space and have their own run-time stacks Lightweight tasks all run in the same address space and use the same run-time stack A task is disjoint if it does not communicate with or affect the execution of any other task in the program in any way

8 Task Synchronization We need a mechanism that controls the order in which tasks execute Two kinds of synchronization Cooperation synchronization Competition synchronization

9 Kinds of synchronization Cooperation: Task A must wait for task B to complete some specific activity before task A can continue its execution, e.g., the producerconsumer problem Competition: Two or more tasks must use some resource that cannot be simultaneously used, e.g., a shared counter Competition is usually provided by mutually exclusive access (approaches are discussed later)

10 Scheduler Providing synchronization requires a mechanism for delaying task execution Task execution control is maintained by a program called the scheduler, which maps task execution onto available processors

11 Task Execution States New - created but not yet started Runnable or ready - ready to run but not currently running (no available processor) Running Blocked - has been running, but cannot now continue (usually waiting for some event to occur) Dead - no longer active in any sense

12 Liveness and Deadlock Liveness is a characteristic that a program unit may or may not have In sequential code, it means the unit will eventually complete its execution In a concurrent environment, a task can easily lose its liveness If all tasks in a concurrent environment lose their liveness, it is called deadlock

13 Methods of Providing Synchronization Semaphores Monitors Message Passing

14 Semaphores Dijkstra A semaphore is a data structure consisting of a counter and a queue for storing task descriptors Semaphores can be used to implement guards on the code that accesses shared data structures Semaphores have only two operations, wait and release (originally called P and V by Dijkstra) Semaphores can be used to provide both competition and cooperation synchronization

15 Monitors Concurrent Pascal, Modula, Mesa, Ada, Java, C# The idea: encapsulate the shared data and its operations to restrict access A monitor is an abstract data type for shared data

16 Competition Synchronization Shared data is resident in the monitor (rather than in the client units) All access resident in the monitor Monitor implementation guarantee synchronized access by allowing only one access at a time Calls to monitor procedures are implicitly queued if the monitor is busy at the time of the call

17 Evaluation of Monitors A better way to provide competition synchronization than are semaphores Semaphores can be used to implement monitors Monitors can be used to implement semaphores Support for cooperation synchronization is very similar as with semaphores, so it has the same problems

18 Message Passing Message passing is a general model for concurrency It can model both semaphores and monitors It is not just for competition synchronization Central idea: task communication is like seeing a doctor--most of the time she waits for you or you wait for her, but when you are both ready, you get together, or rendezvous

19 Message Passing Rendezvous A mechanism to allow a task to indicate when it is willing to accept messages Tasks need a way to remember who is waiting to have its message accepted and some fair way of choosing the next message When a sender task s message is accepted by a receiver task, the actual message transmission is called a rendezvous

20 Threads Thread (thread of execution) split code into two or more simultaneously running tasks Threads were born from the idea that the most efficient way for cooperating processes to exchange data would be to share their entire memory space. Thus, threads are basically processes that run in the same memory context. Threads are described as lightweight because switching between threads does not involve changing the memory context. Threads provide for parallel execution on MP/Multicore systems Standard single CPU threads use standard time slicing Java and C# have support for threads see book for syntax

21 Generic Thread Control To control the execution of a thread you might imagine methods like: Yield() a request from the running thread to voluntarily surrender the processor Sleep() might be used to pause the thread Kill()/Abort() to dump a thread execution Join() could be used to force a delay of execution until the run method of another thread has completed its execution Lock() and other reservation methods Likely you will also have properties to indicate thread priority (high, low, etc.) as well as to change priority level

22 Statement-Level Concurrency Objective: Provide a mechanism that the programmer can use to inform compiler of ways it can map the program onto multiprocessor architecture Minimize communication among processors and the memories of the other processors Example High Performance Fortran A collection of extensions that allow the programmer to provide information to the compiler to help it optimize code for multiprocessor computers Specify the number of processors, the distribution of data over the memories of those processors, and the alignment of data

23 JavaScript and Concurrency Standard JavaScript would appear to have very limited possibility for concurrency Simple time based facilities settimeout(), setinterval() would allow you to schedule the execution of code at a particular time but really no direct support for concurrency at the language level it would seem However, given that JS is used in Web environment launching requests to remote servers (ex. Web services) and waking up to address them certainly has all the characteristics of concurrent programming and in fact is distributed as well. This style of JS usage is quite popular circa under the moniker AJAX

24 What is AJAX? AJAX Asynchronous JavaScript and XML Original term coined by Jesse James Garret in article in Feb es/ php AJAX is a term like DHTML to describe both the use of a collection of technologies (JS, XHTML, DOM, XMLHttp, XML, etc.) and a particular style of coding, in this case remote scripting, partial page updates, and rich Internet applications.

25 What is AJAX Contd. Simple idea is a Web site/application that does partial page updates and provides a desktop application-like experience

26 What is AJAX Contd. Innerbrowsing

27 What is AJAX Contd. Network Activity

28 Original AJAX Model by J.J.G.

29 Yet Another AJAX Model

30 AJAX Data Transmission Methods Typically if JavaScript is used the XMLHttpRequest object is used to exchange data asynchronously with a Web server Many other possibilities are possible <frame> Hidden <iframe> <script> tag <img> tag <link> tag for CSS However, for our purposes they are not as interesting because they are either 1-way or they are not as asynchronous or controlled as XHRs

31 AJAX Data Formats Given the X in AJAX you would assume XML but it is not always used If XML might a custom vocabulary or a known one like SOAP Why not XML? Bulk tag vs. content ratio Value without using some DOM parsing maybe it is just a super CSV format? Easy of eval()ing JavaScript code directly Other transport possibilities: Plain text HTML or XHTML (really XML if done right) JSON (JavaScript Object Notation) YAML Binary formats even!?

32 AJAX Consuming the Data In nearly every case we use JavaScript (particularly DOM features) to consume the received data You could in theory use VBScript Or if you are using the Flash integrated with Ajax you would see Actionscript in play (pretty much JS) In some instances you will see advanced XML ideas discussed such as using client-side XML and XSLT but that is uncommon

33 AJAX Hello World Walk-thru (simple.html) 1. Collect data from a form field 2. Create an XMLHTTP object a) Cross browser issues 3. Call a server-side program which does something a) In this case a PHP file called simple.php 4. Wait for the result 5. Read the result out of the XML using DOM functions 6. Populate a tag in the page using DOM functions

34 Step 1 Collect Data from Form Field Given a form like <form action="#" method="get"> <label>enter your name: <input type="text" id="nametext" /></label> <input type="button" value="ok" onclick="sendname();" /> </form> Use code like function sendname() { var name = document.getelementbyid("nametext"); if (name.value == "") { alert("please enter your name"); return false; } else startajax(name.value); } return false;

35 Step 2 XMLHTTP and Browser Fun var xmlhttp; function ajaxhttp() { try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {} try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} try { return new XMLHttpRequest(); } catch(e) {} alert("xmlhttprequest not supported"); return null; } function startajax() { snip xmlhttp = ajaxhttp(); snip }

36 Step 3 Call the Server Side Program function startajax(param) { var url = "simple.php?name=" + param; xmlhttp = ajaxhttp(); xmlhttp.open("get", url, true); xmlhttp.send(null); xmlhttp.onreadystatechange = ajaxstatechange; } ajaxstatechange is the name of a function I defined that will be invoked as things happen. This is dubbed a callback function

37 Step 3 - Send the Data

38 Step 4 Server Side Processing and Client Waiting <?php header("cache-control: no-cache"); header("pragma: no-cache"); header("content-type: text/xml"); $datemsg = "Hello World to $name at ". date("h:i:s A"); echo <<< END_OF_FILE <hello> <message id="date">$datemsg</message> </hello> END_OF_FILE?>

39 Step 4 Data is returned

40 Steps 5 and 6 Receive the Response and Use function ajaxstatechange() { if (xmlhttp.readystate == 4) { xmlstr = xmlhttp.responsexml; msg = xmlstr.getelementsbytagname("message")[0].firstchild.nodevalue; var ajaxdiv = document.getelementbyid("divforajax"); ajaxdiv.innerhtml = msg; ajaxdiv.style.display = ""; } } In XHTML we have <div id="divforajax" style="display:none;"></div>

41 What You Saw

42 AJAX and Concurrency The simple example shows the idea of how to create a backchannel request but does not point out that you can create many of them at once With AJAX you can easily spawn off numerous requests to various Web services using REST or SOAP interfaces and even route data from one to another, if this isn t concurrency I am not sure what is? Interestingly we see the Web at large playing with these ideas in the form of site/service mashups

43 Ajax Issues - Concurrency Concurrent calls to XMLHttpRequest present a number of problems. Internet Explorer limits the number of concurrent requests to a particular unique FQDN to 2 connections at a time. To have multiple requests you must ensure that your XMLHttpRequest object is not reused name wise particularly if using a global variable. You must use closures in order to guarantee that you pass the callback the appropriate response object. As concurrent requests will be running asynchronously, it is impossible to know which will return first. The callback function must take that into account. Possible race conditions with Session Variables

44 Ajax Issues Concurrency Connections ISSUE: Internet Explorer limits the number of concurrent requests to two connections to a particular FQDN at a time. If you send out multiple asynchronous requests at the same time, only two will be allowed to be processed by the server at once. This can lead to a delay in page processing. Other problem the request queue is unloaded in an order that may not be predictable to the coder (browser implementation dependency) Possible Solutions: Registry tweaks (not reasonable), use different virtual domain names for the same server (ajax1.pint.com, ajax2.pint.com, etc.)

45 Ajax Issues Concurrency Global Vars ISSUE: You must ensure that your XMLHttpRequest object is a unique variable. For example, if you use a global variable and reuse it before it is done with another call, the former call will be lost and only the response object of the second call will be seen. Example:

46 Ajax Issues Concurrency Closures ISSUE: You must use closures in order to guarantee that you pass the callback the appropriate response object. When we set the onreadystatechange property of the XMLHttpRequest, we pass it a function name. xmlhttp.onreadystatechange = ajaxstatechange; The problem is that we can not pass it any parameters. Using a global XHR variable, we may run into the global variable problems. If we don t use a global XHR variable, we have no access to the XHR in the callback function

47 Ajax Issues Concurrency Closures A closure is an inner function that has access to all of the local variables of the scope where it was defined. It captures these variables and is able to access them outside of the scope they were used. We use closures to pass the XmlHttpRequest object to the callback function. xmlhttp.onreadystatechange = function(){ajaxstatechange(xmlhttp)}; The function here passes the local variable xmlhttp to the ajaxstatechange function. When ajaxstatechange is called, xmlhttp is out of scope. However, it gets properly passed because of the closure.

48 Ajax Issues Concurrency Order As concurrent requests will be running asynchronously, it is impossible to know which will return first. The callback function must take that into account. You should not have one concurrent callback function rely on another. If they do rely on another, you must ensure they have both returned before you execute your code. You could detect that with various variables implementing a semaphore concept

49 Ajax Issues Concurrency: Race Conditions A race condition occurs when multiple threads in a process try to modify the same data at the same time. The value will depend on which thread arrived last. In normal Web pages, this is not an issue since each request from a user arrives sequentially. However, using Ajax, each page visit can spawn numerous concurrent requests which will arrive in an unknown order.

50 Ajax Issues Concurrency: Race Conditions With Ajax, it is possible to cause a race condition when writing to session variables. Since you can t check the order in which the threads arrived, the data only holds the value of the latest write.

51 Ajax Issues Concurrency: Race Conditions

52 Ajax Issues Concurrency: Race Conditions setsession.php <?php $_SESSION[ lastedit'] = $_GET[ editfield ];?> setsession.htm xmlhttp.open('get', setsession.php?editfield=clients', true); xmlhttp2.open('get', setsession.php?editfield=staff', true); As we can see in this contrived example, the session variable will be set to whichever of the xmlhttprequest variables hits setsession.php last. Solutions? Re-architect application, locks

CPS 506 Comparative Programming Languages. Programming Language Paradigms

CPS 506 Comparative Programming Languages. Programming Language Paradigms CPS 506 Comparative Programming Languages Concurrent Programming Language Paradigms Topics Introduction Introduction to Subprogram-Level Concurrency Semaphores Monitors Message Passing Java Threads 2 Introduction

More information

Chapter 13 Topics. Introduction. Introduction

Chapter 13 Topics. Introduction. Introduction Chapter 13 Topics Introduction Introduction to Subprogram-Level Concurrency Semaphores Monitors Java Threads C# Threads Statement-Level Concurrency Copyright 2006 Pearson Addison-Wesley. All rights reserved.

More information

Chapter Machine instruction level 2. High-level language statement level 3. Unit level 4. Program level

Chapter Machine instruction level 2. High-level language statement level 3. Unit level 4. Program level Concurrency can occur at four levels: 1. Machine instruction level 2. High-level language statement level 3. Unit level 4. Program level Because there are no language issues in instruction- and program-level

More information

Chapter 13. Concurrency ISBN

Chapter 13. Concurrency ISBN Chapter 13 Concurrency ISBN 0-321-49362-1 Chapter 13 Topics Introduction Introduction to Subprogram-Level Concurrency Semaphores Monitors Message Passing Ada Support for Concurrency Java Threads C# Threads

More information

Concurrency. Lecture 14: Concurrency & exceptions. Why concurrent subprograms? Processes and threads. Design Issues for Concurrency.

Concurrency. Lecture 14: Concurrency & exceptions. Why concurrent subprograms? Processes and threads. Design Issues for Concurrency. Lecture 14: Concurrency & exceptions Concurrency Processes and threads Semaphores, monitors and message passing Exception handling Concurrency Is is often desirable or necessary to execute parts of programs

More information

Concurrency - Topics. Introduction Introduction to Subprogram-Level Concurrency Semaphores Monitors Message Passing Java Threads

Concurrency - Topics. Introduction Introduction to Subprogram-Level Concurrency Semaphores Monitors Message Passing Java Threads Concurrency - Topics Introduction Introduction to Subprogram-Level Concurrency Semaphores Monitors Message Passing Java Threads 1 Introduction Concurrency can occur at four levels: Machine instruction

More information

Performance Throughput Utilization of system resources

Performance Throughput Utilization of system resources Concurrency 1. Why concurrent programming?... 2 2. Evolution... 2 3. Definitions... 3 4. Concurrent languages... 5 5. Problems with concurrency... 6 6. Process Interactions... 7 7. Low-level Concurrency

More information

AJAX and PHP AJAX. Christian Wenz,

AJAX and PHP AJAX. Christian Wenz, AJAX and PHP Christian Wenz, AJAX A Dutch soccer team A cleaner Two characters from Iliad A city in Canada A mountain in Colorado... Asynchronous JavaScript + XML 1 1 What is AJAX?

More information

XMLHttpRequest. CS144: Web Applications

XMLHttpRequest. CS144: Web Applications XMLHttpRequest http://oak.cs.ucla.edu/cs144/examples/google-suggest.html Q: What is going on behind the scene? What events does it monitor? What does it do when

More information

AJAX. Lecture 26. Robb T. Koether. Fri, Mar 21, Hampden-Sydney College. Robb T. Koether (Hampden-Sydney College) AJAX Fri, Mar 21, / 16

AJAX. Lecture 26. Robb T. Koether. Fri, Mar 21, Hampden-Sydney College. Robb T. Koether (Hampden-Sydney College) AJAX Fri, Mar 21, / 16 AJAX Lecture 26 Robb T. Koether Hampden-Sydney College Fri, Mar 21, 2014 Robb T. Koether (Hampden-Sydney College) AJAX Fri, Mar 21, 2014 1 / 16 1 AJAX 2 Http Requests 3 Request States 4 Handling the Response

More information

AJAX. Introduction. AJAX: Asynchronous JavaScript and XML

AJAX. Introduction. AJAX: Asynchronous JavaScript and XML AJAX 1 2 Introduction AJAX: Asynchronous JavaScript and XML Popular in 2005 by Google Create interactive web applications Exchange small amounts of data with the server behind the scenes No need to reload

More information

Part of this connection identifies how the response can / should be provided to the client code via the use of a callback routine.

Part of this connection identifies how the response can / should be provided to the client code via the use of a callback routine. What is AJAX? In one sense, AJAX is simply an acronym for Asynchronous JavaScript And XML In another, it is a protocol for sending requests from a client (web page) to a server, and how the information

More information

AJAX ASYNCHRONOUS JAVASCRIPT AND XML. Laura Farinetti - DAUIN

AJAX ASYNCHRONOUS JAVASCRIPT AND XML. Laura Farinetti - DAUIN AJAX ASYNCHRONOUS JAVASCRIPT AND XML Laura Farinetti - DAUIN Rich-client asynchronous transactions In 2005, Jesse James Garrett wrote an online article titled Ajax: A New Approach to Web Applications (www.adaptivepath.com/ideas/essays/archives/000

More information

AJAX: Asynchronous Event Handling Sunnie Chung

AJAX: Asynchronous Event Handling Sunnie Chung AJAX: Asynchronous Event Handling Sunnie Chung http://adaptivepath.org/ideas/ajax-new-approach-web-applications/ http://stackoverflow.com/questions/598436/does-an-asynchronous-call-always-create-call-a-new-thread

More information

CITS1231 Web Technologies. Ajax and Web 2.0 Turning clunky website into interactive mashups

CITS1231 Web Technologies. Ajax and Web 2.0 Turning clunky website into interactive mashups CITS1231 Web Technologies Ajax and Web 2.0 Turning clunky website into interactive mashups What is Ajax? Shorthand for Asynchronous JavaScript and XML. Coined by Jesse James Garrett of Adaptive Path. Helps

More information

AJAX. Lab. de Bases de Dados e Aplicações Web MIEIC, FEUP 2010/11. Sérgio Nunes

AJAX. Lab. de Bases de Dados e Aplicações Web MIEIC, FEUP 2010/11. Sérgio Nunes AJAX Lab. de Bases de Dados e Aplicações Web MIEIC, FEUP 2010/11 Sérgio Nunes Server calls from web pages using JavaScript call HTTP data Motivation The traditional request-response cycle in web applications

More information

A.A. 2008/09. What is Ajax?

A.A. 2008/09. What is Ajax? Internet t Software Technologies AJAX IMCNE A.A. 2008/09 Gabriele Cecchetti What is Ajax? AJAX stands for Asynchronous JavaScript And XML. AJAX is a type of programming made popular in 2005 by Google (with

More information

Web 2.0 and Security

Web 2.0 and Security Web 2.0 and Security Web 2.0 and Security 1. What is Web 2.0? On the client: Scripting the XMLHttpRequest object On the server: REST Web Services Mash-ups ups of Web Services used together to create novel

More information

AJAX(Asynchronous Javascript + XML) Creating client-side dynamic Web pages

AJAX(Asynchronous Javascript + XML) Creating client-side dynamic Web pages AJAX(Asynchronous Javascript + XML) Creating client-side dynamic Web pages AJAX = Asynchronous JavaScript and XML.AJAX is not a new programming language, but a new way to use existing standards. AJAX is

More information

Concurrent Programming. CS105 Programming Languages Supplement

Concurrent Programming. CS105 Programming Languages Supplement Concurrent Programming CS105 Programming Languages Supplement Outline Introduction Categories Concepts Semaphores Monitors Message Passing Statement level concurrency Introduction Definitions Process:

More information

TIME SCHEDULE MODULE TOPICS PERIODS. HTML Document Object Model (DOM) and javascript Object Notation (JSON)

TIME SCHEDULE MODULE TOPICS PERIODS. HTML Document Object Model (DOM) and javascript Object Notation (JSON) COURSE TITLE : ADVANCED WEB DESIGN COURSE CODE : 5262 COURSE CATEGORY : A PERIODS/WEEK : 4 PERIODS/SEMESTER : 52 CREDITS : 4 TIME SCHEDULE MODULE TOPICS PERIODS 1 HTML Document Object Model (DOM) and javascript

More information

Ajax Ajax Ajax = Asynchronous JavaScript and XML Using a set of methods built in to JavaScript to transfer data between the browser and a server in the background Reduces the amount of data that must be

More information

Term Paper. P r o f. D r. E d u a r d H e i n d l. H o c h s c h u l e F u r t w a n g e n U n i v e r s i t y. P r e s e n t e d T o :

Term Paper. P r o f. D r. E d u a r d H e i n d l. H o c h s c h u l e F u r t w a n g e n U n i v e r s i t y. P r e s e n t e d T o : Version: 0.1 Date: 02.05.2009 Author(s): Doddy Satyasree AJAX Person responsable: Doddy Satyasree Language: English Term Paper History Version Status Date 0.1 Draft Version created 02.05.2009 0.2 Final

More information

AJAX Programming Overview. Introduction. Overview

AJAX Programming Overview. Introduction. Overview AJAX Programming Overview Introduction Overview In the world of Web programming, AJAX stands for Asynchronous JavaScript and XML, which is a technique for developing more efficient interactive Web applications.

More information

Use of PHP for DB Connection. Middle and Information Tier

Use of PHP for DB Connection. Middle and Information Tier Client: UI HTML, JavaScript, CSS, XML Use of PHP for DB Connection Middle Get all books with keyword web programming PHP Format the output, i.e., data returned from the DB SQL DB Query Access/MySQL 1 2

More information

Web Application Security

Web Application Security Web Application Security Rajendra Kachhwaha rajendra1983@gmail.com September 23, 2015 Lecture 13: 1/ 18 Outline Introduction to AJAX: 1 What is AJAX 2 Why & When use AJAX 3 What is an AJAX Web Application

More information

AJAX: Rich Internet Applications

AJAX: Rich Internet Applications AJAX: Rich Internet Applications Web Programming Uta Priss ZELL, Ostfalia University 2013 Web Programming AJAX Slide 1/27 Outline Rich Internet Applications AJAX AJAX example Conclusion More AJAX Search

More information

2/6/2012. Rich Internet Applications. What is Ajax? Defining AJAX. Asynchronous JavaScript and XML Term coined in 2005 by Jesse James Garrett

2/6/2012. Rich Internet Applications. What is Ajax? Defining AJAX. Asynchronous JavaScript and XML Term coined in 2005 by Jesse James Garrett What is Ajax? Asynchronous JavaScript and XML Term coined in 2005 by Jesse James Garrett http://www.adaptivepath.com/ideas/essays/archives /000385.php Ajax isn t really new, and isn t a single technology

More information

Contents. Demos folder: Demos\14-Ajax. 1. Overview of Ajax. 2. Using Ajax directly. 3. jquery and Ajax. 4. Consuming RESTful services

Contents. Demos folder: Demos\14-Ajax. 1. Overview of Ajax. 2. Using Ajax directly. 3. jquery and Ajax. 4. Consuming RESTful services Ajax Contents 1. Overview of Ajax 2. Using Ajax directly 3. jquery and Ajax 4. Consuming RESTful services Demos folder: Demos\14-Ajax 2 1. Overview of Ajax What is Ajax? Traditional Web applications Ajax

More information

WebApp development. Outline. Web app structure. HTML basics. 1. Fundamentals of a web app / website. Tiberiu Vilcu

WebApp development. Outline. Web app structure. HTML basics. 1. Fundamentals of a web app / website. Tiberiu Vilcu Outline WebApp development Tiberiu Vilcu Prepared for EECS 411 Sugih Jamin 20 September 2017 1 2 Web app structure HTML basics Back-end: Web server Database / data storage Front-end: HTML page CSS JavaScript

More information

Ajax Ajax Ajax = Asynchronous JavaScript and XML Using a set of methods built in to JavaScript to transfer data between the browser and a server in the background Reduces the amount of data that must be

More information

Overview. CMSC 330: Organization of Programming Languages. Concurrency. Multiprocessors. Processes vs. Threads. Computation Abstractions

Overview. CMSC 330: Organization of Programming Languages. Concurrency. Multiprocessors. Processes vs. Threads. Computation Abstractions CMSC 330: Organization of Programming Languages Multithreaded Programming Patterns in Java CMSC 330 2 Multiprocessors Description Multiple processing units (multiprocessor) From single microprocessor to

More information

Informatica 3. Marcello Restelli. Laurea in Ingegneria Informatica Politecnico di Milano 9/15/07 10/29/07

Informatica 3. Marcello Restelli. Laurea in Ingegneria Informatica Politecnico di Milano 9/15/07 10/29/07 Informatica 3 Marcello Restelli 9/15/07 10/29/07 Laurea in Ingegneria Informatica Politecnico di Milano Structuring the Computation Control flow can be obtained through control structure at instruction

More information

CS312: Programming Languages. Lecture 21: JavaScript

CS312: Programming Languages. Lecture 21: JavaScript CS312: Programming Languages Lecture 21: JavaScript Thomas Dillig Thomas Dillig, CS312: Programming Languages Lecture 21: JavaScript 1/25 Why Discuss JavaScript? JavaScript is very widely used and growing

More information

Use of PHP for DB Connection. Middle and Information Tier. Middle and Information Tier

Use of PHP for DB Connection. Middle and Information Tier. Middle and Information Tier Use of PHP for DB Connection 1 2 Middle and Information Tier PHP: built in library functions for interfacing with the mysql database management system $id = mysqli_connect(string hostname, string username,

More information

Why Discuss JavaScript? CS312: Programming Languages. Lecture 21: JavaScript. JavaScript Target. What s a Scripting Language?

Why Discuss JavaScript? CS312: Programming Languages. Lecture 21: JavaScript. JavaScript Target. What s a Scripting Language? Why Discuss JavaScript? CS312: Programming Languages Lecture 21: JavaScript Thomas Dillig JavaScript is very widely used and growing Any AJAX application heavily relies on JavaScript JavaScript also has

More information

Module 5 JavaScript, AJAX, and jquery. Module 5. Module 5 Contains 2 components

Module 5 JavaScript, AJAX, and jquery. Module 5. Module 5 Contains 2 components Module 5 JavaScript, AJAX, and jquery Module 5 Contains 2 components Both the Individual and Group portion are due on Monday October 30 th Start early on this module One of the most time consuming modules

More information

10.1 Overview of Ajax

10.1 Overview of Ajax 10.1 Overview of Ajax - History - Possibility began with the nonstandard iframe element, which appeared in IE4 and Netscape 4 - An iframe element could be made invisible and could be used to send asynchronous

More information

Concurrency COMS W4115. Prof. Stephen A. Edwards Spring 2002 Columbia University Department of Computer Science

Concurrency COMS W4115. Prof. Stephen A. Edwards Spring 2002 Columbia University Department of Computer Science Concurrency COMS W4115 Prof. Stephen A. Edwards Spring 2002 Columbia University Department of Computer Science Concurrency Multiple, simultaneous execution contexts. Want to walk and chew gum at the same

More information

Implementing Coroutines. Faking Coroutines in Java

Implementing Coroutines. Faking Coroutines in Java Concurrency Coroutines Concurrency COMS W4115 Prof. Stephen A. Edwards Spring 2002 Columbia University Department of Computer Science Multiple, simultaneous execution contexts. Want to walk and chew gum

More information

RKN 2015 Application Layer Short Summary

RKN 2015 Application Layer Short Summary RKN 2015 Application Layer Short Summary HTTP standard version now: 1.1 (former 1.0 HTTP /2.0 in draft form, already used HTTP Requests Headers and body counterpart: answer Safe methods (requests): GET,

More information

Copyright Descriptor Systems, Course materials may not be reproduced in whole or in part without prior written consent of Joel Barnum

Copyright Descriptor Systems, Course materials may not be reproduced in whole or in part without prior written consent of Joel Barnum Ajax The notion of asynchronous request processing using the XMLHttpRequest object has been around for several years, but the term "AJAX" was coined by Jesse James Garrett of Adaptive Path. You can read

More information

CS 5142 Scripting Languages

CS 5142 Scripting Languages CS 5142 Scripting Languages 10/16/2015 Web Applications Databases 1 Outline Stateful Web Applications AJAX 2 Concepts Scope in Server-Side Scripts Request $_GET, $_POST global $g; Session $_SESSION Application

More information

Chapter 5 Concurrency: Mutual Exclusion and Synchronization

Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles Chapter 5 Concurrency: Mutual Exclusion and Synchronization Seventh Edition By William Stallings Designing correct routines for controlling concurrent

More information

IT 540 Operating Systems ECE519 Advanced Operating Systems

IT 540 Operating Systems ECE519 Advanced Operating Systems IT 540 Operating Systems ECE519 Advanced Operating Systems Prof. Dr. Hasan Hüseyin BALIK (5 th Week) (Advanced) Operating Systems 5. Concurrency: Mutual Exclusion and Synchronization 5. Outline Principles

More information

Web Programming Paper Solution (Chapter wise)

Web Programming Paper Solution (Chapter wise) What is valid XML document? Design an XML document for address book If in XML document All tags are properly closed All tags are properly nested They have a single root element XML document forms XML tree

More information

Resource management. Real-Time Systems. Resource management. Resource management

Resource management. Real-Time Systems. Resource management. Resource management Real-Time Systems Specification Implementation Verification Mutual exclusion is a general problem that exists at several levels in a real-time system. Shared resources internal to the the run-time system:

More information

Using Development Tools to Examine Webpages

Using Development Tools to Examine Webpages Chapter 9 Using Development Tools to Examine Webpages Skills you will learn: For this tutorial, we will use the developer tools in Firefox. However, these are quite similar to the developer tools found

More information

A synchronous J avascript A nd X ml

A synchronous J avascript A nd X ml A synchronous J avascript A nd X ml The problem AJAX solves: How to put data from the server onto a web page, without loading a new page or reloading the existing page. Ajax is the concept of combining

More information

AJAX. Ajax: Asynchronous JavaScript and XML *

AJAX. Ajax: Asynchronous JavaScript and XML * AJAX Ajax: Asynchronous JavaScript and XML * AJAX is a developer's dream, because you can: Read data from a web server - after the page has loaded Update a web page without reloading the page Send data

More information

Chapter 5 Concurrency: Mutual Exclusion. and. Synchronization. Operating Systems: Internals. and. Design Principles

Chapter 5 Concurrency: Mutual Exclusion. and. Synchronization. Operating Systems: Internals. and. Design Principles Operating Systems: Internals and Design Principles Chapter 5 Concurrency: Mutual Exclusion and Synchronization Seventh Edition By William Stallings Designing correct routines for controlling concurrent

More information

CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring Lecture 8: Semaphores, Monitors, & Condition Variables

CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring Lecture 8: Semaphores, Monitors, & Condition Variables CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring 2004 Lecture 8: Semaphores, Monitors, & Condition Variables 8.0 Main Points: Definition of semaphores Example of use

More information

MultiThreading 07/01/2013. Session objectives. Introduction. Introduction. Advanced Java Programming Course

MultiThreading 07/01/2013. Session objectives. Introduction. Introduction. Advanced Java Programming Course Advanced Java Programming Course MultiThreading By Võ Văn Hải Faculty of Information Technologies Industrial University of Ho Chi Minh City Session objectives Introduction Creating thread Thread class

More information

Advanced Java Programming Course. MultiThreading. By Võ Văn Hải Faculty of Information Technologies Industrial University of Ho Chi Minh City

Advanced Java Programming Course. MultiThreading. By Võ Văn Hải Faculty of Information Technologies Industrial University of Ho Chi Minh City Advanced Java Programming Course MultiThreading By Võ Văn Hải Faculty of Information Technologies Industrial University of Ho Chi Minh City Session objectives Introduction Creating thread Thread class

More information

Concurrent Programming

Concurrent Programming Concurrency Concurrent Programming A sequential program has a single thread of control. Its execution is called a process. A concurrent program has multiple threads of control. They may be executed as

More information

Part I: Communication and Networking

Part I: Communication and Networking Review what we learned Part I: Communication and Networking Communication and Networking: Week 5-6, Lectures 2-7 Lecture 1 OSI vs TCP/IP model OSI model Protocols TCP/IP model Application FTP SMTP HTTP

More information

Comet and WebSocket Web Applications How to Scale Server-Side Event-Driven Scenarios

Comet and WebSocket Web Applications How to Scale Server-Side Event-Driven Scenarios Comet and WebSocket Web Applications How to Scale Server-Side Event-Driven Scenarios Simone Bordet sbordet@intalio.com 1 Agenda What are Comet web applications? Impacts of Comet web applications WebSocket

More information

User Interaction: jquery

User Interaction: jquery User Interaction: jquery Assoc. Professor Donald J. Patterson INF 133 Fall 2012 1 jquery A JavaScript Library Cross-browser Free (beer & speech) It supports manipulating HTML elements (DOM) animations

More information

G Programming Languages Spring 2010 Lecture 13. Robert Grimm, New York University

G Programming Languages Spring 2010 Lecture 13. Robert Grimm, New York University G22.2110-001 Programming Languages Spring 2010 Lecture 13 Robert Grimm, New York University 1 Review Last week Exceptions 2 Outline Concurrency Discussion of Final Sources for today s lecture: PLP, 12

More information

Ajax. Ronald J. Glotzbach

Ajax. Ronald J. Glotzbach Ajax Ronald J. Glotzbach What is AJAX? Asynchronous JavaScript and XML Ajax is not a technology Ajax mixes well known programming techniques in an uncommon way Enables web builders to create more appealing

More information

Process Management And Synchronization

Process Management And Synchronization Process Management And Synchronization In a single processor multiprogramming system the processor switches between the various jobs until to finish the execution of all jobs. These jobs will share the

More information

Dealing with Issues for Interprocess Communication

Dealing with Issues for Interprocess Communication Dealing with Issues for Interprocess Communication Ref Section 2.3 Tanenbaum 7.1 Overview Processes frequently need to communicate with other processes. In a shell pipe the o/p of one process is passed

More information

Developing a Web Server Platform with SAPI support for AJAX RPC using JSON

Developing a Web Server Platform with SAPI support for AJAX RPC using JSON 94 Developing a Web Server Platform with SAPI support for AJAX RPC using JSON Assist. Iulian ILIE-NEMEDI Informatics in Economy Department, Academy of Economic Studies, Bucharest Writing a custom web server

More information

Threads Chapter 5 1 Chapter 5

Threads Chapter 5 1 Chapter 5 Threads Chapter 5 1 Chapter 5 Process Characteristics Concept of Process has two facets. A Process is: A Unit of resource ownership: a virtual address space for the process image control of some resources

More information

Introduction to Concurrent Software Systems. CSCI 5828: Foundations of Software Engineering Lecture 08 09/17/2015

Introduction to Concurrent Software Systems. CSCI 5828: Foundations of Software Engineering Lecture 08 09/17/2015 Introduction to Concurrent Software Systems CSCI 5828: Foundations of Software Engineering Lecture 08 09/17/2015 1 Goals Present an overview of concurrency in software systems Review the benefits and challenges

More information

Concurrency in Java Prof. Stephen A. Edwards

Concurrency in Java Prof. Stephen A. Edwards Concurrency in Java Prof. Stephen A. Edwards The Java Language Developed by James Gosling et al. at Sun Microsystems in the early 1990s Originally called Oak, first intended application was as an OS for

More information

Operating System Support

Operating System Support Teaching material based on Distributed Systems: Concepts and Design, Edition 3, Addison-Wesley 2001. Copyright George Coulouris, Jean Dollimore, Tim Kindberg 2001 email: authors@cdk2.net This material

More information

JAVA and J2EE UNIT - 4 Multithreaded Programming And Event Handling

JAVA and J2EE UNIT - 4 Multithreaded Programming And Event Handling JAVA and J2EE UNIT - 4 Multithreaded Programming And Event Handling Multithreaded Programming Topics Multi Threaded Programming What are threads? How to make the classes threadable; Extending threads;

More information

27/04/2012. We re going to build Multithreading Application. Objectives. MultiThreading. Multithreading Applications. What are Threads?

27/04/2012. We re going to build Multithreading Application. Objectives. MultiThreading. Multithreading Applications. What are Threads? Objectives MultiThreading What are Threads? Interrupting threads Thread properties By Võ Văn Hải Faculty of Information Technologies Summer 2012 Threads priorities Synchronization Callables and Futures

More information

Group 1. SAJAX: The Road to Secure and Efficient Applications. - Final Project Report -

Group 1. SAJAX: The Road to Secure and Efficient Applications. - Final Project Report - Group 1 SAJAX: The Road to Secure and Efficient Applications - Final Project Report - Thu Do, Matt Henry, Peter Knolle, Ahmad Yasin George Mason University, 2006/07/15 SAJAX: The Road to Secure and Efficient

More information

Concept of a process

Concept of a process Concept of a process In the context of this course a process is a program whose execution is in progress States of a process: running, ready, blocked Submit Ready Running Completion Blocked Concurrent

More information

Ch 9: Control flow. Sequencers. Jumps. Jumps

Ch 9: Control flow. Sequencers. Jumps. Jumps Ch 9: Control flow Sequencers We will study a number of alternatives traditional sequencers: sequential conditional iterative jumps, low-level sequencers to transfer control escapes, sequencers to transfer

More information

jquery and AJAX

jquery and AJAX jquery and AJAX http://www.flickr.com/photos/pmarkham/3165964414/ Dynamic HTML (DHTML) Manipulating the web page's structure is essential for creating a highly responsive UI Two main approaches Manipulate

More information

Lecture notes Lectures 1 through 5 (up through lecture 5 slide 63) Book Chapters 1-4

Lecture notes Lectures 1 through 5 (up through lecture 5 slide 63) Book Chapters 1-4 EE445M Midterm Study Guide (Spring 2017) (updated February 25, 2017): Instructions: Open book and open notes. No calculators or any electronic devices (turn cell phones off). Please be sure that your answers

More information

CMSC 433 Programming Language Technologies and Paradigms. Concurrency

CMSC 433 Programming Language Technologies and Paradigms. Concurrency CMSC 433 Programming Language Technologies and Paradigms Concurrency What is Concurrency? Simple definition Sequential programs have one thread of control Concurrent programs have many Concurrency vs.

More information

Introduction to Concurrent Software Systems. CSCI 5828: Foundations of Software Engineering Lecture 12 09/29/2016

Introduction to Concurrent Software Systems. CSCI 5828: Foundations of Software Engineering Lecture 12 09/29/2016 Introduction to Concurrent Software Systems CSCI 5828: Foundations of Software Engineering Lecture 12 09/29/2016 1 Goals Present an overview of concurrency in software systems Review the benefits and challenges

More information

Real-Time Systems. Lecture #4. Professor Jan Jonsson. Department of Computer Science and Engineering Chalmers University of Technology

Real-Time Systems. Lecture #4. Professor Jan Jonsson. Department of Computer Science and Engineering Chalmers University of Technology Real-Time Systems Lecture #4 Professor Jan Jonsson Department of Computer Science and Engineering Chalmers University of Technology Real-Time Systems Specification Resource management Mutual exclusion

More information

Intro To Javascript. Intro to Web Development

Intro To Javascript. Intro to Web Development Intro To Javascript Intro to Web Development Preamble I don't like JavaScript But with JS your feelings don't matter. Browsers don't work well with any other language so you have to write code that either:

More information

XML. Jonathan Geisler. April 18, 2008

XML. Jonathan Geisler. April 18, 2008 April 18, 2008 What is? IS... What is? IS... Text (portable) What is? IS... Text (portable) Markup (human readable) What is? IS... Text (portable) Markup (human readable) Extensible (valuable for future)

More information

AJAX: The Basics CISC 282 March 25, 2014

AJAX: The Basics CISC 282 March 25, 2014 AJAX: The Basics CISC 282 March 25, 2014 Synchronous Communication User and server take turns waiting User requests pages while browsing Waits for server to respond Waits for the page to load in the browser

More information

JavaScript Programming

JavaScript Programming JavaScript Programming Course ISI-1337B - 5 Days - Instructor-led, Hands on Introduction Today, JavaScript is used in almost 90% of all websites, including the most heavilytrafficked sites like Google,

More information

Oracle WebLogic Portal

Oracle WebLogic Portal Oracle WebLogic Portal Client-Side Developer s Guide 10g Release 3 (10.3) September 2008 Oracle WebLogic Portal Client-Side Developer s Guide, 10g Release 3 (10.3) Copyright 2008, Oracle and/or its affiliates.

More information

ajax1.html 1/2 lectures/7/src/ ajax1.html 2/2 lectures/7/src/

ajax1.html 1/2 lectures/7/src/ ajax1.html 2/2 lectures/7/src/ ajax1.html 1/2 3: ajax1.html 5: Gets stock quote from quote1.php via Ajax, displaying result with alert(). 6: 7: David J. Malan 8: Dan Armendariz 9: Computer Science E-75 10: Harvard Extension School 11:

More information

CS533 Concepts of Operating Systems. Jonathan Walpole

CS533 Concepts of Operating Systems. Jonathan Walpole CS533 Concepts of Operating Systems Jonathan Walpole Introduction to Threads and Concurrency Why is Concurrency Important? Why study threads and concurrent programming in an OS class? What is a thread?

More information

High Performance Computing Course Notes Shared Memory Parallel Programming

High Performance Computing Course Notes Shared Memory Parallel Programming High Performance Computing Course Notes 2009-2010 2010 Shared Memory Parallel Programming Techniques Multiprocessing User space multithreading Operating system-supported (or kernel) multithreading Distributed

More information

AJAX Programming Chris Seddon

AJAX Programming Chris Seddon AJAX Programming Chris Seddon seddon-software@keme.co.uk 2000-12 CRS Enterprises Ltd 1 2000-12 CRS Enterprises Ltd 2 What is Ajax? "Asynchronous JavaScript and XML" Originally described in 2005 by Jesse

More information

Programming for Digital Media. Lecture 7 JavaScript By: A. Mousavi and P. Broomhead SERG, School of Engineering Design, Brunel University, UK

Programming for Digital Media. Lecture 7 JavaScript By: A. Mousavi and P. Broomhead SERG, School of Engineering Design, Brunel University, UK Programming for Digital Media Lecture 7 JavaScript By: A. Mousavi and P. Broomhead SERG, School of Engineering Design, Brunel University, UK 1 Topics Ajax (Asynchronous JavaScript and XML) What it is and

More information

AJAX: Introduction CISC 282 November 27, 2018

AJAX: Introduction CISC 282 November 27, 2018 AJAX: Introduction CISC 282 November 27, 2018 Synchronous Communication User and server take turns waiting User requests pages while browsing Waits for server to respond Waits for the page to load in the

More information

CT51 WEB TECHNOLOGY ALCCS-FEB 2014

CT51 WEB TECHNOLOGY ALCCS-FEB 2014 Q.1 a. What is the purpose of Marquee tag? Text included within the tag moves continuously from right to left. For e.g. The globe is moving It is used actually to highlight

More information

An Introduction to AJAX. By : I. Moamin Abughazaleh

An Introduction to AJAX. By : I. Moamin Abughazaleh An Introduction to AJAX By : I. Moamin Abughazaleh How HTTP works? Page 2 / 25 Classical HTTP Process Page 3 / 25 1. The visitor requests a page 2. The server send the entire HTML, CSS and Javascript code

More information

Chapter 6: Process Synchronization

Chapter 6: Process Synchronization Chapter 6: Process Synchronization Objectives Introduce Concept of Critical-Section Problem Hardware and Software Solutions of Critical-Section Problem Concept of Atomic Transaction Operating Systems CS

More information

Concurrency: State Models & Design Patterns

Concurrency: State Models & Design Patterns Concurrency: State Models & Design Patterns Practical Session Week 02 1 / 13 Exercises 01 Discussion Exercise 01 - Task 1 a) Do recent central processing units (CPUs) of desktop PCs support concurrency?

More information

Introduction to Ajax

Introduction to Ajax Introduction to Ajax with Bob Cozzi What is AJAX? Asynchronous JavaScript and XML A J a X Asynchronous data retrieval using the XMLHttpRequest object from JavaScript Data is retrieved from the server as

More information

OS06: Monitors in Java

OS06: Monitors in Java OS06: Monitors in Java Based on Chapter 4 of [Hai17] Jens Lechtenbörger Computer Structures and Operating Systems 2018 1 Introduction 1.1 OS Plan ˆ OS Motivation (Wk 23) ˆ OS Introduction (Wk 23) ˆ Interrupts

More information

Inter-process communication (IPC)

Inter-process communication (IPC) Inter-process communication (IPC) We have studied IPC via shared data in main memory. Processes in separate address spaces also need to communicate. Consider system architecture both shared memory and

More information

CSE Traditional Operating Systems deal with typical system software designed to be:

CSE Traditional Operating Systems deal with typical system software designed to be: CSE 6431 Traditional Operating Systems deal with typical system software designed to be: general purpose running on single processor machines Advanced Operating Systems are designed for either a special

More information

CIS233J Java Programming II. Threads

CIS233J Java Programming II. Threads CIS233J Java Programming II Threads Introduction The purpose of this document is to introduce the basic concepts about threads (also know as concurrency.) Definition of a Thread A thread is a single sequential

More information

Lecture 8 (7.5?): Javascript

Lecture 8 (7.5?): Javascript Lecture 8 (7.5?): Javascript Dynamic web interfaces forms are a limited interface

More information

! The final is at 10:30 am, Sat 6/4, in this room. ! Open book, open notes. ! No electronic devices. ! No food. ! Assignment 7 due 10pm tomorrow

! The final is at 10:30 am, Sat 6/4, in this room. ! Open book, open notes. ! No electronic devices. ! No food. ! Assignment 7 due 10pm tomorrow Announcements ECS 89 6/1! The final is at 10:30 am, Sat 6/4, in this room! Open book, open notes! No electronic devices! No food! Assignment 7 due 10pm tomorrow! No late Assignment 7 s! Fill out course

More information

CS A331 Programming Language Concepts

CS A331 Programming Language Concepts CS A331 Programming Language Concepts Lecture 12 Alternative Language Examples (General Concurrency Issues and Concepts) March 30, 2014 Sam Siewert Major Concepts Concurrent Processing Processes, Tasks,

More information