Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

These are the Lecture Slides of Program Optimization for Multi Core Architectures which includes Triangular Lower Limits, Multiple Loop Limits, Dependence System Solvers, Single Equation, Simple Test, Extreme Value Test etc.Key important points are: Communication Architectures, Layered Architecture, Agenda, Shared Address, Message Passing, Convergence, Generic Architecture

Typology: Slides

2012/2013

Uploaded on 03/28/2013

ekanath
ekanath 🇮🇳

3.8

(4)

80 documents

1 / 7

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Objectives_template
file:///D|/...ary,%20Dr.%20Sanjeev%20K%20Aggrwal%20&%20Dr.%20Rajat%20Moona/Multi-core_Architecture/lecture%2040/40_1.htm[6/14/2012 12:15:18 PM]
Module 20: Multi-core Computing Multi-processor Scheduling
Lecture 40: Multi-core Computing Synchronization
The Lecture Contains:
Process Dispatching
Process Scheduling
Thread Scheduling
Anatomy of Downloading Window
The Producer-Consumer Problem
What is Wrong?
A Possible Scenario
Race Conditions
Critical Section Problem
Problem Abstraction
pf3
pf4
pf5

Partial preview of the text

Download COMPUT~1 and more Slides Computer Science in PDF only on Docsity!

Module 20: Multi-core Computing Multi-processor Scheduling

Lecture 40: Multi-core Computing Synchronization

The Lecture Contains:

Process Dispatching

Process Scheduling

Thread Scheduling

Anatomy of Downloading Window

The Producer-Consumer Problem

What is Wrong?

A Possible Scenario

Race Conditions

Critical Section Problem

Problem Abstraction

Module 20: Multi-core Computing Multi-processor Scheduling

Lecture 40: Multi-core Computing Synchronization

Process Dispatching

After assignment, deciding who is selected from among the pool of waiting processes Process dispatching. Single processor multiprogramming strategies may be counter-productive here. Priorities and process history may not be sufficient.

Process Scheduling

Single queue of processes or if multiple priority is used, multiple priority queues, all feeding into a common pool of processors. Multi-server queuing model: multiple-queue/single queue, multiple server system. Inference: Specific scheduling policy does not have much effect as the number of processors increase. Conclusion: Use FCFS with priority levels.

Module 20: Multi-core Computing Multi-processor Scheduling

Lecture 40: Multi-core Computing Synchronization

Anatomy of Downloading Window

The Producer-Consumer Problem

Produce(item_t item) { while (count==bufsz); buffer[in]=item; in=(in+1)%bufsz; count=count+1; }

Consume(item_t *item) { while(count==0); *item=buffer[out]; out=(out+1)%bufsz; count=count-1; } Shared Variables buffer, count

Module 20: Multi-core Computing Multi-processor Scheduling

Lecture 40: Multi-core Computing Synchronization

What is Wrong?

Variable count is shared. Both process read and modify this variable The assembly code for these two statement may be something like following:

//count=count+1 //count=count- P1: load R1,count C1: load R1,count P2: add R1,1 C2: sub R1, P3: store count,R1 C3: store count,R

Two processes run concurrently (Single or multiple CPUs)

A Possible Scenario

The producer and consumer processes may be scheduled in any order and may be preempted. Consider the following sequence of statements P1, CSwitch , C1, C2, C3, CSwitch , P2, P3.

Module 20: Multi-core Computing Multi-processor Scheduling

Lecture 40: Multi-core Computing Synchronization

Race Conditions

Situation when several concurrent processes operate on the same variable and the result of the computation depends upon the order in which they execut. In the preceding example, the value of count could be 4, 5 or 6. C1,P1,P2,P3,C2,C3 final value 4 C1,C2,C3,P1,P2,P3 final value 5 P1,C1,C2,C3,P2,P3 final value 6

Critical Section Problem

We model the problem using the notion of Critical Sections. Critical sections are with respect to the shared data. There are n processes, each sharing some common resource. Each wants to modify the common resource. For each process, define the region of code where it accesses a shared piece of data as a critical section. In a correct system of multiple cooperating processes, Only one process must be inside its critical section.

Problem Abstraction

Processes execute code similar to the following.

while (1) { Non critical code Entry code Critical Section Code Exit Code Non Critical Code }