lec17 - CS240: Programming in C Lecture 17: Threads Monday,...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
CS240: Programming in C Lecture 17: Threads Monday, April 18, 2011
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Concurrency and Parallelism 2 Concurrency is concerned with the management of logically simultaneous activities Best-fit job scheduling event handling (GUI) web server Parallelism is concerned with performance of concurrent activities weather forecasting simulations Monday, April 18, 2011
Background image of page 2
Why Concurrency? In a serial environment, consider the following simple example of a server, serving requests from clients (e.g., a web server and web clients) t = 0 request 1 request 2 Non-concurrent serial server Monday, April 18, 2011
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Let us process requests serially t = 6 t = 0 request 1 request 2 request 1 request 2 t = 8 request 1 request 2 Total completion time = 8 units, Average service time = (6 + 8)/2 = 7 units Monday, April 18, 2011
Background image of page 4
Try a concurrent server now! t = 0 request 1 request 2 t = 1 request 1 request 2 t = 2 request 1 request 2 Monday, April 18, 2011
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
We reduced mean service time! t = 3 t = 4 t = 8 Total completion time = 8 units, Average service time = (4 + 8)/2 = 6 units Monday, April 18, 2011
Background image of page 6
Why Concurrency? The lesson from the example is quite simple: Not knowing anything about execution times, we can reduce average service time for requests by processing them concurrently! But what if I knew the service time for each
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/23/2012 for the course CS 240 taught by Professor Rego during the Spring '08 term at Purdue University-West Lafayette.

Page1 / 19

lec17 - CS240: Programming in C Lecture 17: Threads Monday,...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online