Challenges in multi core programming by Nishigandha Wankhade


Published on

Published in: Education
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Challenges in multi core programming by Nishigandha Wankhade

  1. 1. CHALLENGES IN MULTI-CORE PROGRAMMING -by Ms. Nishigandha Wankhade
  2. 2. Outline      Sequential Model Concurrency Challenges of concurrency New Libraries for C++ Developers Processor Architecture Challenges Challenges in Multi-core Programming 2/27/2014 2
  3. 3. SEQUENTIAL MODELS  A model in which instructions are executed one at a time.  Computer perform each step in specific order.  Program is divided into multiple tasks.  Computer programs set up in story form Beginning , Middle and End  All the tasks in program are in one file.  All tasks are interdependent.  Ex: Let A, B, C and D are four tasks. Then B starts only after completing task A. Then after finishing the task B the C starts and so on…. Challenges in Multi-core Programming 2/27/2014 3
  4. 4. CONCURRENCY  Two tasks are said to be concurrent if they occur within the same time interval.  They do not mean that the tasks are executing at the same instance.  They might be executing at the same hour but at different period of interval.  EX: A and B are two concurrent tasks means- A might execute for some fraction of seconds then B might execute for some fraction of seconds. Again the task A execute, so on.......  Concurrent tasks can execute in MULTIPROCESSING ENVIRONMENT. Challenges in Multi-core Programming a SINGLE 2/27/2014 or 4
  5. 5. CONCURRENCY  Single Processing Environment:  Context Switching :  It is a process of storing and restoring the execution state so that multiple processes can share the same processor in a given period of time.  Multiprocessing Environment:  Depends on No. of FREE Processors.  Developer deals with following challenges:  1. Software Development  2. Software Deployment  3. Software maintenance Challenges in Multi-core Programming 2/27/2014 5
  6. 6. SOFTWARE DEVELOPMENT  It happens from developing device drivers to large scale Ntire applications.  Its size and scope vary to large extent. So, challenges are in creating multiprocessing and multithreading applications.  Carried out in various phases [ SDLC]. Challenges in Multi-core Programming 2/27/2014 6
  7. 7. SOFTWARE DEVELOPMENT  SDLC ACTIVITIES DESCRIPTION Requirement specification Agreement between developer and the client. What s/w must do and Constrains are specified. Design Specifications are model using s/w design. It determines the INTERNAL STRUCTURE. 2 approaches- architectural design and detailed design. Implementation Detailed design is translated to the programming code. Testing and Evaluation Exercising s/w in order to uncover the errors and improve the quality of s/w. Maintenance After delivery of s/w. Modifications are done to correct errors, to improve performance. Challenges in Multi-core Programming 2/27/2014 7
  8. 8. SOFTWARE DEVELOPMENT METHODOLOGY S/W DEVELOPMENT METHODOLOGIES DESCRIPTION CORE ACTIVITIES Agile Part of functionality is delivered at some time interval Planning, requirement analysis, design, implementation, testing and documentation Build and Fix s/w is build and modifications are done many times as needed Build initial version, modify as per customer’s requirements, At each iteration developer inform the client about time required. Client selects the desire feature Requirement gathering, specification, architectural design, implementation and integration, delivery s/w developed in increments. Integrated module by module Requirement gathering, specification, architectural design, build loop  Extreme Programming Incremental Challenges in Multi-core Programming 2/27/2014 8
  9. 9. SOFTWARE DEVELOPMENT METHODOLOGY S/W DEVELOPMENT METHODOLOGIES  Object Oriented DESCRIPTION Objects are identified and with them s/w is designed At each iteration prototype of the Rapid prototyping system is developed. Interaction with client. Spiral Structured Waterfall CORE ACTIVITIES Requirement gathering, OO analysis, OO design, implementation and integration Rapid prototyping, specifications, design, implementation, integration, maintenance, retirement. Iterative model like incremental. Emphasis on risk analysis and verification at each phase Planning, risk analysis, evaluation Top down approach. Requirement analysis, design, Implementation, testing, development. c/as linear sequential model Rrq. Gathering and specification, design, imple, integration, 9 maintenance, retirement 2/27/2014 Challenges in Multi-core Programming
  10. 10. CHALLENGES OF S/W DEVELOPMENT  1) S/W Decomposition: -> WBS & Architectural Artifacts (AAs) -> Decomposition is written in form of PROBLEM & SOLUTION CHALLENGES OF S/W DECOMPOSITION: 1) multiple ways to rep[resent a problem and its solution 2) making sure that decomposition is complete and correct. -> Finding right model for decomposition. Challenges in Multi-core Programming 2/27/2014 10
  11. 11. CHALLENGES OF S/W DEVELOPMENT  2) Task To Task Communication: -> IPC ? -> Managing IPC: POSIX support six basic mechanisms to accomplish communication between processes. 1) Files with lock and unlock facility 2) Pipes 3) Shared Memory 4) Message Queues 5) Semaphore (use variables) 6) Sockets Challenges in Multi-core Programming 2/27/2014 11
  12. 12. CHALLENGES OF S/W DEVELOPMENT  3) Concurrent Access To Data Or Resources By Multiple Tasks Or Agents: Three commonly occurring problems while executing the instructions concurrently:-> 1) Data race: When two or more tasks are attempting to update the data resource at the same time, the race condition occurs which is called as data race. 2) Deadlock: It is a situation in which two or more tasks are waiting for the other to finish so that they can acquire the resources. 3) Indefinite postponement: In this one or more tasks are waiting for some event or condition to occur and if that condition or event never occurs. Challenges in Multi-core Programming 2/27/2014 12
  13. 13. CHALLENGES OF S/W DEVELOPMENT  4) Identifying Relationship Between Concurrently Executing Tasks: Four basic relationships 1) Start to Start 2) Finish to Start 3) Start to Finish 4) Finish to Finish 5) Controlling resource contention between tasks 6) Determining sufficient no. of processes or threads Challenges in Multi-core Programming 2/27/2014 13
  14. 14. CHALLENGES OF S/W DEVELOPMENT  7 & 8) Finding reliable and reproducible debugging and testing -> Testing & debugging in sequential model. -> Difficult to produce exact content of parallel or concurrent tasks because of OS-scheduling policies, dynamic workload, process or thread priorities etc. -> Multiprocessing and multithreaded applications are nondeterministic in nature. That is recreation of the same sequence of events of these type of applications in order to test or debug the program is NOT POSSIBLE AT ALL. -> Finding the right debugger or profiler * state of the kernel process and system calls. * attach or detach a process or thread. 14
  15. 15. CHALLENGES OF S/W DEVELOPMENT 9) Communicating the designs having multiprocessing components. -> UML (Unified Modeling Language) -> System Architecture (Structural Diagrams): 1) Component diagram: Represent the dependencies and organization among a set of physical modules. 2) Deployment diagram: shows runtime configuration of processing nodes, hardware and software components in a system. -> Behavioral Diagrams: 1) State diagram 2) Sequence diagram 3) Activity diagram 4) Collaboration diagram 15
  16. 16. CHALLENGES OF S/W DEVELOPMENT 10) Implementing multiprocessing and multithreading in C++. -> C++ does not include any keyword primitives for parallelism. -> How can we implement the multiprocessing or multithreading applications using C++? (By using libraries) Challenges in Multi-core Programming 2/27/2014 16
  17. 17. NEW LIBRARIES FOR C++ DEVELOPERS 1) System Libraries: -> Provides by O.S. itself -> Ex: POSIX thread Library. It contains the set of system calls that support parallelism. -> POSIX ( Portable O. S. Interface for Unix) * POSIX threads * POSIX spawn function * The exec() family of functions 2/27/2014 17
  18. 18. PROCESSOR ARCHITECTURE CHALLENGES Four popularly used multi-core architectures1) Opteron 2) Cell 3) UltraSparc T1 4) Intel Core-2 -> These different architectures translate to different sets of compiler switches and directives. -> For this, it is necessary that the developer must be familiar with the use of compiler and linker specific features. -> In some cases multiple types of compilers needed to generate single executable program. -> But for taking the advantage of particular architecture we can make the s/w non-portable. -> So, taking most advantage of Multicore architecture without affecting the portability of the s/w application is the real challenge of processor architecture. 2/27/2014 18
  19. 19. REFERENCE  1) “Professional Multicore Programming: Design and Implementation for C++ Developers “, Wiley India Edition, ISBN: 978-81-265-1875-3. 19