smp basics n.
Skip this Video
Download Presentation
SMP Basics

Loading in 2 Seconds...

play fullscreen
1 / 12

SMP Basics - PowerPoint PPT Presentation

  • Uploaded on

SMP Basics. KeyStone Training Multicore Applications Literature Number: SPRPxxx . Questions. What is SMP, what are its advantages How threads are created, how do they share memories. Definition of SMP

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'SMP Basics' - thora

Download Now An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
smp basics

SMP Basics

KeyStone Training

Multicore Applications

Literature Number: SPRPxxx



What is SMP, what are its advantages

How threads are created, how do they share memories


Definition of SMP

(Symmetric MultiProcessing) A multiprocessing architecture in which multiple CPUs, residing in one cabinet, share the same memory. SMP systems provide scalability. As business increases, additional CPUs can be added to absorb the increased transaction volume.SMP systems range from two to as many as 32 or more processors. However, if one CPU fails, the entire SMP system is down. Clusters of two or more SMP systems can be used to provide high availability (fault resilience). If one SMP system fails, the others continue to operate.


smp work

A Pool of ResourcesOne of the CPUs boots the system and loads the SMP operating system, which brings the other CPUs online. There is only one instance of the operating system and one instance of the application in memory. The operating system uses the CPUs as a pool of processing resources, all executing simultaneously, either processing data or in an idle loop waiting to do something.Whatever Can Be OverlappedSMP speeds up the processes that can be overlapped such as running multiple applications simultaneously. If an application is multithreaded, which allows for concurrent operations within the application itself, then SMP can improve the performance of that single application.

SMP work

smp high points
SMP high points
  • A single operating system
  • An application can be distributed between multiple cores
  • Memories can be global to all threads or local to each thread
  • Pthreads provide the parallelism

A process is created by the operating system to run an application. Starting a process requires a great amount of overhead

A process might have multiple procedures each one is somewhat independent from other procedures. A system that can schedule these procedures in an efficient way is multi-thread system

A thread is defined as an independent stream of instructions that can be scheduled to run as such by the operating system and requires much less overhead than a process

POSIX threads (pthreads) is an IEEE standard that defines portable (between different hardware) threads



Pthreads are defined as a set of C language programming types and procedure calls, implemented with a pthread.h header/include file and a thread library

In terms of performance cost, pthreads require much less resources to be created and managed

All threads within a process share the same address space. Inter-thread communication is more efficient and easier than inter-process communication.


parallel pthreads

Several common models for threaded programs exist:

    • Master/slaves: a single thread, the master assigns work to other threads, the slaves. Typically, the master handles all input and parcels out work to the other tasks. At least two forms of the master/slaves model are common: static slaves pool and dynamic slaves pool.
    • Pipeline: a task is broken into a series of sub-operations, each of which is handled in series, but concurrently, by a different thread. An automobile assembly line best describes this model.
    • Peer: similar to the master/slave model, but after the main thread creates other threads, it participates in the work.

Parallel pthreads

memory model

All threads have access to the same global, shared memory

  • Threads also have their own private data
  • Programmers are responsible for synchronizing access (protecting) globally shared data.

Memory Model

memory protection mutex

Mutex is an abbreviation for "mutual exclusion"

A mutex variable is a "lock" (a semaphore), protecting access to a shared data resource to prevent “race” conditions

Using MUTEX ensures that when a thread lock a mutex variable, no other thread can access the same variable until the mutex is released

Memory protection MUTEX

condition variables

Condition variables behave like flags, they enable synchronization between threads based on variable value but without the needs to explicitly pull the flag value

The thread gives resources to other threads until the condition variable is ready

A condition variable is always used in conjunction with a mutex lock.

Condition Variables

smp demo

SMP demo

Part of the release at


Need to add

   #include <time.h>

 #include <linux/sched.h>