multiprocessor systems modeling of program modeling concepts · program modeling concepts:...

26
2008 Chapter-6 L5: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc. 1 Program Modeling Concepts: Lesson-7: MODELING OF MULTIPROCESSOR SYSTEMS

Upload: phamhanh

Post on 18-Dec-2018

221 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: MULTIPROCESSOR SYSTEMS MODELING OF Program Modeling Concepts · Program Modeling Concepts: Lesson-7: MODELING OF MULTIPROCESSOR SYSTEMS. 2008 Chapter-6 L5: "Embedded Systems - Architecture,

2008 Chapter-6 L5: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

1

Program Modeling Concepts: Lesson-7: MODELING OF

MULTIPROCESSOR SYSTEMS

Page 2: MULTIPROCESSOR SYSTEMS MODELING OF Program Modeling Concepts · Program Modeling Concepts: Lesson-7: MODELING OF MULTIPROCESSOR SYSTEMS. 2008 Chapter-6 L5: "Embedded Systems - Architecture,

2008 Chapter-6 L5: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

2

Multiprocessor systemMultiprocessor system� A multiprocessor system uses two

or more processors for faster execution of the (i) Program functions, (ii) tasks or (iii) single instruction multiple data instructions

Page 3: MULTIPROCESSOR SYSTEMS MODELING OF Program Modeling Concepts · Program Modeling Concepts: Lesson-7: MODELING OF MULTIPROCESSOR SYSTEMS. 2008 Chapter-6 L5: "Embedded Systems - Architecture,

2008 Chapter-6 L5: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

3

� Partitioned into the tasks or sets of instructions (or processes or threads) and the ISRs.

� The tasks and ISRs can run concurrently on different processors and by some mechanism the tasks can communicate with each other

� Multiple-instructions multiple- data instructions

� Very long instruction words (VLIWs)

A large complex programA large complex program

Page 4: MULTIPROCESSOR SYSTEMS MODELING OF Program Modeling Concepts · Program Modeling Concepts: Lesson-7: MODELING OF MULTIPROCESSOR SYSTEMS. 2008 Chapter-6 L5: "Embedded Systems - Architecture,

2008 Chapter-6 L5: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

4

Static scheduling of tasks and ISRs on two Static scheduling of tasks and ISRs on two processorsprocessors

PA

Processor

PB

processorSignal or message

Signal or message

Signal or message

Signal or message

Task3

ISR_B

ISR_A Task1

ISR_D Task4

ISR_C

Task2

Page 5: MULTIPROCESSOR SYSTEMS MODELING OF Program Modeling Concepts · Program Modeling Concepts: Lesson-7: MODELING OF MULTIPROCESSOR SYSTEMS. 2008 Chapter-6 L5: "Embedded Systems - Architecture,

2008 Chapter-6 L5: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

5

Static scheduling of tasks and ISRs on two Static scheduling of tasks and ISRs on two cores of same processorcores of same processor

Core_A

Core_B

Interrupt

Signal or message

Interrupt

Signal or message

Task4

ISR_A

Task1 Task2

ISR_C ISR_D

Task3

ISR_B

Interrupt Interrupt

Signal or message

Signal or message

Page 6: MULTIPROCESSOR SYSTEMS MODELING OF Program Modeling Concepts · Program Modeling Concepts: Lesson-7: MODELING OF MULTIPROCESSOR SYSTEMS. 2008 Chapter-6 L5: "Embedded Systems - Architecture,

2008 Chapter-6 L5: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

6

Static schedulingStatic scheduling� Means that a compiler compiles such that

the codes are run on different processors or processing units as per the schedule decided and this schedule remains static during the program run even if a processor waits for the others to finish the scheduled processing

Page 7: MULTIPROCESSOR SYSTEMS MODELING OF Program Modeling Concepts · Program Modeling Concepts: Lesson-7: MODELING OF MULTIPROCESSOR SYSTEMS. 2008 Chapter-6 L5: "Embedded Systems - Architecture,

2008 Chapter-6 L5: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

7

The Multiprocessor System memoryThe Multiprocessor System memory--interface Modelsinterface Models

• Share the same address space through a common bus (tight coupling)

• Processors have different autonomous address spaces (like in a network) as well as shared data sets and arrays, called loose coupling .

Page 8: MULTIPROCESSOR SYSTEMS MODELING OF Program Modeling Concepts · Program Modeling Concepts: Lesson-7: MODELING OF MULTIPROCESSOR SYSTEMS. 2008 Chapter-6 L5: "Embedded Systems - Architecture,

2008 Chapter-6 L5: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

8

Tight Coupling of two processor to a common memory

Page 9: MULTIPROCESSOR SYSTEMS MODELING OF Program Modeling Concepts · Program Modeling Concepts: Lesson-7: MODELING OF MULTIPROCESSOR SYSTEMS. 2008 Chapter-6 L5: "Embedded Systems - Architecture,

2008 Chapter-6 L5: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

9

Loose Coupling of two processor to a common memory

Page 10: MULTIPROCESSOR SYSTEMS MODELING OF Program Modeling Concepts · Program Modeling Concepts: Lesson-7: MODELING OF MULTIPROCESSOR SYSTEMS. 2008 Chapter-6 L5: "Embedded Systems - Architecture,

2008 Chapter-6 L5: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

10

The Multiprocessor System The Multiprocessor System Programming Programming Model NeedsModel Needs

� Partition the program into tasks or sets of instructions between the various processors

� Schedule the instructions over the available processor times and resources so that there is optimum performance.

Page 11: MULTIPROCESSOR SYSTEMS MODELING OF Program Modeling Concepts · Program Modeling Concepts: Lesson-7: MODELING OF MULTIPROCESSOR SYSTEMS. 2008 Chapter-6 L5: "Embedded Systems - Architecture,

2008 Chapter-6 L5: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

11

• Partition of processes, instruction sets and instruction(s)

• Schedule the instructions, SIMDs, MIMDs, and VLIWs within each process and scheduling them for each processor

• Concurrent processing of processes on each processor

The Multiprocessor System The Multiprocessor System Programming Model NeedsProgramming Model Needs

Page 12: MULTIPROCESSOR SYSTEMS MODELING OF Program Modeling Concepts · Program Modeling Concepts: Lesson-7: MODELING OF MULTIPROCESSOR SYSTEMS. 2008 Chapter-6 L5: "Embedded Systems - Architecture,

2008 Chapter-6 L5: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

12

• Concurrent processing on each superscalar unit and pipeline in the processor

• Static scheduling by compiler, analogous to the scheduling in a superscalar processor.

The Multiprocessor System The Multiprocessor System Programming Model NeedsProgramming Model Needs

Page 13: MULTIPROCESSOR SYSTEMS MODELING OF Program Modeling Concepts · Program Modeling Concepts: Lesson-7: MODELING OF MULTIPROCESSOR SYSTEMS. 2008 Chapter-6 L5: "Embedded Systems - Architecture,

2008 Chapter-6 L5: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

13

• Hardware scheduling, for example, whether static scheduling of hardware (processors and memories) is feasible or not [It is simpler and its use depends on the types of instructions when it does not affect the system performance.]

The Multiprocessor System The Multiprocessor System Programming Model NeedsProgramming Model Needs

Page 14: MULTIPROCESSOR SYSTEMS MODELING OF Program Modeling Concepts · Program Modeling Concepts: Lesson-7: MODELING OF MULTIPROCESSOR SYSTEMS. 2008 Chapter-6 L5: "Embedded Systems - Architecture,

2008 Chapter-6 L5: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

14

• Static scheduling issue [For example, when the performance is not affected and when the processing actions are predictable and synchronous.]

The Multiprocessor System The Multiprocessor System Programming Model NeedsProgramming Model Needs

Page 15: MULTIPROCESSOR SYSTEMS MODELING OF Program Modeling Concepts · Program Modeling Concepts: Lesson-7: MODELING OF MULTIPROCESSOR SYSTEMS. 2008 Chapter-6 L5: "Embedded Systems - Architecture,

2008 Chapter-6 L5: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

15

• Synchronising issues, synchronisation means use of inter -processor or process communications (IPCs) such that there is a definite order (precedence) in which the computations are fired on any processor in multiprocessor system.

The Multiprocessor System The Multiprocessor System Programming Model NeedsProgramming Model Needs

Page 16: MULTIPROCESSOR SYSTEMS MODELING OF Program Modeling Concepts · Program Modeling Concepts: Lesson-7: MODELING OF MULTIPROCESSOR SYSTEMS. 2008 Chapter-6 L5: "Embedded Systems - Architecture,

2008 Chapter-6 L5: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

16

• Dynamic scheduling issues [For example, when the performance is affected when there are interrupts and when the services to the tasks are asynchronous. It is also relevant when there is preemptive scheduling as that is also asynchronous.]

The Multiprocessor System The Multiprocessor System Programming Model NeedsProgramming Model Needs

Page 17: MULTIPROCESSOR SYSTEMS MODELING OF Program Modeling Concepts · Program Modeling Concepts: Lesson-7: MODELING OF MULTIPROCESSOR SYSTEMS. 2008 Chapter-6 L5: "Embedded Systems - Architecture,

2008 Chapter-6 L5: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

17

Methods of scheduling and Methods of scheduling and synchronisingsynchronisingthe execution of instructions, the execution of instructions, SIMDsSIMDs, , MIMDsMIMDs, and , and VLIWsVLIWs� Scheduling is done after analyzing the

scheduling and synchronising options for the concurrent processing and scheduling of instructions, SIMDs, MIMDs and VLIWs

Page 18: MULTIPROCESSOR SYSTEMS MODELING OF Program Modeling Concepts · Program Modeling Concepts: Lesson-7: MODELING OF MULTIPROCESSOR SYSTEMS. 2008 Chapter-6 L5: "Embedded Systems - Architecture,

2008 Chapter-6 L5: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

18

Method 1 of concurrent processing Method 1 of concurrent processing � Schedule each task so that it is executed on

different processors and synchronise the tasks by some inter -processor communication mechanism

Page 19: MULTIPROCESSOR SYSTEMS MODELING OF Program Modeling Concepts · Program Modeling Concepts: Lesson-7: MODELING OF MULTIPROCESSOR SYSTEMS. 2008 Chapter-6 L5: "Embedded Systems - Architecture,

2008 Chapter-6 L5: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

19

Method 2 of concurrent processing Method 2 of concurrent processing � when an SMID or MIMD or VLIW instruction has

different data (for example, different coefficients in Filter example

� Each task is processed on different processors (tightly coupled processing) for different data.

� This is analogous to the execution of a VLIW in TMS320C6, a recent Texas Instruments DSP series processor.

� TMS320C6 employs two identical sets of four units and a VLIW instruction word can be within four and thirty-two bytes.

Page 20: MULTIPROCESSOR SYSTEMS MODELING OF Program Modeling Concepts · Program Modeling Concepts: Lesson-7: MODELING OF MULTIPROCESSOR SYSTEMS. 2008 Chapter-6 L5: "Embedded Systems - Architecture,

2008 Chapter-6 L5: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

20

Method of concurrent processingMethod of concurrent processing� TMS320C6 has instruction level parallelism

when a compiler schedules such that the processors run the different instruction elements into the different units in parallel.

� The compiler does static scheduling for VLIWs.

Page 21: MULTIPROCESSOR SYSTEMS MODELING OF Program Modeling Concepts · Program Modeling Concepts: Lesson-7: MODELING OF MULTIPROCESSOR SYSTEMS. 2008 Chapter-6 L5: "Embedded Systems - Architecture,

2008 Chapter-6 L5: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

21

Method 3Method 3� An alternate way is that a task-instruction is

executed on the same processor or different instructions of a task can be done on different processors (loosely coupled).

� A compiler schedules the various instructions of the tasks among the processors at an instance

Page 22: MULTIPROCESSOR SYSTEMS MODELING OF Program Modeling Concepts · Program Modeling Concepts: Lesson-7: MODELING OF MULTIPROCESSOR SYSTEMS. 2008 Chapter-6 L5: "Embedded Systems - Architecture,

2008 Chapter-6 L5: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

22

Performance costPerformance cost• Suppose one processor finishes

computations earlier than the other.• Performance cost is more if there is

idle time left from the available. time.

Page 23: MULTIPROCESSOR SYSTEMS MODELING OF Program Modeling Concepts · Program Modeling Concepts: Lesson-7: MODELING OF MULTIPROCESSOR SYSTEMS. 2008 Chapter-6 L5: "Embedded Systems - Architecture,

2008 Chapter-6 L5: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

23

� If one task needs to send a message to another and the other waits (blocks) till the message is received, performance cost is proportional to the waiting period.

Performance costPerformance cost

Page 24: MULTIPROCESSOR SYSTEMS MODELING OF Program Modeling Concepts · Program Modeling Concepts: Lesson-7: MODELING OF MULTIPROCESSOR SYSTEMS. 2008 Chapter-6 L5: "Embedded Systems - Architecture,

2008 Chapter-6 L5: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

24

SummarySummary

Page 25: MULTIPROCESSOR SYSTEMS MODELING OF Program Modeling Concepts · Program Modeling Concepts: Lesson-7: MODELING OF MULTIPROCESSOR SYSTEMS. 2008 Chapter-6 L5: "Embedded Systems - Architecture,

2008 Chapter-6 L5: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

25

We learnt � A multiprocessor system uses two or

more processors for faster execution of the (i) Program functions, (ii) tasks or (iii) single instruction multiple data instructions

� Partitioning of the processes and scheduling of processes on multiple processor can be static or dynamic

Page 26: MULTIPROCESSOR SYSTEMS MODELING OF Program Modeling Concepts · Program Modeling Concepts: Lesson-7: MODELING OF MULTIPROCESSOR SYSTEMS. 2008 Chapter-6 L5: "Embedded Systems - Architecture,

2008 Chapter-6 L5: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

26

End of Lesson 7 of Chapter 6End of Lesson 7 of Chapter 6