MCP-S11-02 - LECTURE 2 CONCURRENT PROGRAMMING MODELS NYU Multicore Programming Class Spring 2011 [email protected] 1 NYU Multicore Programming

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

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

Unformatted text preview: LECTURE 2 - CONCURRENT PROGRAMMING MODELS NYU Multicore Programming Class, Spring 2011 [email protected] 1 NYU Multicore Programming, Spring 2011 • Programming models for Multicores • Thread execution model • A simple concurrent queue • Case study: architecture of a HTTP server M o d e l s T h r e a d s Q u e u Today’s agenda Questions are welcome, anytime. u e NYU Multicore Programming, Spring 2011 2 C a s e S t u d y • “Multiple-instruction-multiple-data” (Flynn’s taxonomy) • Memory architecture varies • Layers of caches • Private or shared to cores • Uniform or non-uniform access • More details in the lectures about memory M o d e l s Multicores: a category of parallel computers NYU Multicore Programming, Spring 2011 3 • For now, let’s keep in mind that all cores can access all memory equally (even if latencies are not) • Keep all the cores busy! • Break down a problem in smaller tasks • Perform tasks as independently as possible or with little synchronization • Always try to reduce the number and duration of sequential (non-parallelizable) tasks • Your code would only go as fast as the duration of your sequential tasks M o d e l s How to program for multicores? Easier said than done… Let’s try it. • Your code would scale with the number of cores to the proportion of its parallelizable tasks (Amdhal’s law) 4 NYU Multicore Programming, Spring 2011 • Some level of language support (from a full-blown special language to annotations in an existing language) that identify tasks (smaller units of indivisible code) within program • Processes • Blocks of code • Fork/Join • Co-routines M o d e l s Identifying (mostly) independent tasks Schedule them as concurrently as possible NYU Multicore Programming, Spring 2011 5 • Synchronize the tasks via • Shared memory • Message passing • Marks a portion of code as “block” • Schedules the block to be executed in a given execution queue • Parallelism is obtained by scheduling blocks in different queues • Example: libdispatch / GCD x= ^{ … a block of code } M o d e l s Blocks of Code NYU Multicore Programming, Spring 2011 6 dispatch( a_queue, x ) •...
View Full Document

This note was uploaded on 09/09/2011 for the course COMPUTER S MCP-S11 taught by Professor Robertgrimm during the Spring '11 term at NJIT.

Page1 / 27

MCP-S11-02 - LECTURE 2 CONCURRENT PROGRAMMING MODELS NYU Multicore Programming Class Spring 2011 [email protected] 1 NYU Multicore Programming

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

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