DOC PREVIEW
U of I CS 241 - Lecture notes

This preview shows page 1-2-3-4 out of 12 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CS 241 Section Week #12(04/30/09)Announcements• TA Final review:-Either Tuesday May 12, 2009 -Or Wednesday May 13, 2009(2:00pm - 4:00pm) || (6:30pm - 8:30pm) || (7:00pm - 9:00pm)(we will announce it on the newsgroup about time and location)• No Discussion Section next weekOutline•SMP5– Goal and Task–HTTP– Code Recap•HW2• Extra QuestionsSMP5SMP5Goal: Implement a simple content-filtering web proxy• Check the blacklist for blocked hostname• Add specific advertisement according to the domain typeSMP5 Tasks1. Set up TCP sockets with the client (web browser such as Firefox)2. Parse the request from the client to get the hostname, check whether that host is blacklisted 3. In case the host is not blacklisted, forward the request to the original server and then get the response back from the server4. Before forwarding the response to the client, look at the content type of the response• if the content is of type "text/html“, look at the domain type (org, com, net, edu, etc.) to put customized advertisement along with the original response from the serverHyperText Transfer ProtocolHTTP: Parsing the URLEach Uniform Resource Locator (URL) has three components:http://www.linux.org/info/faq1.htmlProtocol Host PathHTTPHypertext Transfer ProtocolDelivers virtually all files and resources on the World Wide WebUses Client-Server ModelHTTP transactionHTTP client opens a connection and sends a request to HTTP serverHTTP server returns a response messageSample HTTP exchangeScenarioClient wants to retrieve the file at the following URL (http://www.somehost.com/path/file.html)What a client doesClient opens a socket to the host www.somehost.com, port 80Client sends the following message through the socketGET /path/file.html HTTP/1.0From: [email protected]: www.somehost.comUser-Agent: HTTPTool/1.0[blank line here]Sample HTTP exchangeWhat a server doesServer responds through the same socketHTTP/1.0 200 OKDate: Mon, 17 Apr 2006 23:59:59 GMTContent-Type: text/htmlContent-Length: 1354<html><body>(more file contents)...</body></html>HTTP: Request and ResponseRequest or response message Format:1. A request or response line2. Zero or more header lines– Request: Host– Response: content-type3. A blank line (CRLF)4. An optional message body.Networking BasicsGeneric TCP Client & Server Code RecapClientsocket()connect()while (…) {send()/recv()}close()Serversocket()bind()listen()while (…) {accept()send()/recv()}close()Let’s take it one step at a time, starting with the client…Homework #2Q1: A server is 95% utilized. Assuming Poisson arrivals and exponentially distributed service times, if the average service rate is 10 requests/second, what is the average queuing time for an incoming request? a) 0.1 sec b) 0.95 sec c) 1.8 sec d) 1.9 sece) 2 secQ1: A server is 95% utilized. Assuming Poisson arrivals and exponentially distributed service times, if the average service rate is 10 requests/second, what is the average queuing time for an incoming request? a) 0.1 sec b) 0.95 secc) 1.8 sec d) 1.9 sece) 2 sec Q2: If the incoming request rate on the above server dropped until its average utilization became 90%, what is the average number of requests in the entire system? a) 0.9 b) 8.1 c) 9 d) 10b) e) None of the aboveQ2: If the incoming request rate on the above server dropped until its average utilization became 90%, what is the average number of requests in the entire system? a) 0.9 b) 8.1 c) 9 d) 10b) e) None of the aboveQ3: Please research disk scheduling policies and familiarize yourself with shortest seek time first (SSTF). Hint: SSTF is a disk scheduling policy that attempts to serve the closest track to the current track next. A disk head starts at track 60, when requests for the following tracks arrive simultaneously: 50, 58, 25, 70, 110. Which track is served by SSTF last? a) 25 b) 50 c) 58 d) 70 e) 110Q3: Please research disk scheduling policies and familiarize yourself with shortest seek time first (SSTF). Hint: SSTF is a disk scheduling policy that attempts to serve the closest track to the current track next. A disk head starts at track 60, when requests for the following tracks arrive simultaneously: 50, 58, 25, 70, 110. Which track is served by SSTF last? a) 25 b) 50 c) 58 d) 70 e) 110Q4: A file system uses 4-byte pointers to refer to locations of file blocks on disk. Each block is 1024 bytes. If the file index is not allowed to exceed 10 blocks in total, what approximately is the maximum allowable file size? (Below, 1KB = 1024bytes and 1MB = (1024)2bytes) a) 10 KB b) 256 KB c) 2.5 MB d) 40 MB e) None of the above Q4: A file system uses 4-byte pointers to refer to locations of file blocks on disk. Each block is 1024 bytes. If the file index is not allowed to exceed 10 blocks in total, what approximately is the maximum allowable file size? (Below, 1KB = 1024bytes and 1MB = (1024)2bytes) a) 10 KB b) 256 KB c) 2.5 MB d) 40 MB e) None of the above Q5: A 32-bit machine partitions its memory into 1024 byte pages. Approximately how long is the page table if it was loaded entirely in memory? Assume each entry in the table takes six bytes.a) 1 Mbytes b) 4 Mbytes c) 6 Mbytes d) 24 Mbytes c) None of the aboveQ5: A 32-bit machine partitions its memory into 1024 byte pages. Approximately how long is the page table if it was loaded entirely in memory? Assume each entry in the table takes six bytes.a) 1 Mbytes b) 4 Mbytes c) 6 Mbytes d) 24 Mbytes c) None of the above Q6: If the sizes of the largest available hole were compared across the following contiguous memory allocation policies, which policy will likely have the largest hole more often?a) Best fit b) Worst first c) First fit d) Next fit e) Random fitQ6: If the sizes of the largest available hole were compared across the following contiguous memory allocation policies, which policy will likely have the largest hole more often?a) Best fit b) Worst first c) First fit d) Next fit e) Random fitQ7: You are designing a NetFlix video server to serve movies from the “Oldies” category to clients via the Internet (you may assume that the set of movies in that category does not change). The server is optimized for sequential video streaming. Which of the following methods would you choose for movie file allocation? a) Contiguous b) Indexed c) Linked d) Linked Indexed e) Multilevel IndexedQ7: You are designing a NetFlix video server to serve movies from the “Oldies” category to clients via the Internet (you may assume that the set


View Full Document

U of I CS 241 - Lecture notes

Documents in this Course
Process

Process

28 pages

Files

Files

37 pages

File I/O

File I/O

52 pages

C Basics

C Basics

69 pages

Memory

Memory

23 pages

Threads

Threads

14 pages

Lecture

Lecture

55 pages

C Basics

C Basics

24 pages

Signals

Signals

27 pages

Memory

Memory

45 pages

Threads

Threads

47 pages

Threads

Threads

28 pages

LECTURE

LECTURE

45 pages

Threads

Threads

30 pages

Threads

Threads

55 pages

Files

Files

37 pages

SIGNALS

SIGNALS

22 pages

Files

Files

37 pages

Threads

Threads

14 pages

Threads

Threads

13 pages

Load more
Download Lecture notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture notes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?