{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

MCP-S11-02 - LECTURE 2 CONCURRENT PROGRAMMING MODELS NYU...

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

View Full Document Right Arrow Icon
LECTURE 2 - CONCURRENT PROGRAMMING MODELS NYU Multicore Programming Class, Spring 2011 [email protected] 1 NYU Multicore Programming, Spring 2011
Image of page 1

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

View Full Document Right Arrow Icon
Programming models for Multicores Thread execution model A simple concurrent queue Case study: architecture of a HTTP server Models Threads Queu Today’s agenda Questions are welcome, anytime. ue NYU MulticoreProgramming, Spring 2011 2 Case Study
Image of page 2
“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 For now, let’s keep in mind that all cores can access all Models Multicores: a category of parallel computers NYU Multicore Programming, Spring 2011 3 memory equally (even if latencies are not)
Image of page 3

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

View Full Document Right Arrow Icon
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 Your code would scale with the number of cores to the Models How to program for multicores? Easier said than done… Let’s try it. proportion of its parallelizable tasks (Amdhal’slaw) 4 NYU Multicore Programming, Spring 2011
Image of page 4
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 Models Identifying (mostly) independent tasks Schedule them as concurrently as possible NYU Multicore Programming, Spring 2011 5 Synchronize the tasks via Shared memory Message passing
Image of page 5

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

View Full Document Right Arrow Icon
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 } dispatch( a_queue, x ) Models Blocks of Code NYU Multicore Programming, Spring 2011 6
Image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern