SlideShare a Scribd company logo
Resource Sharing in Real-Time
Uni/Multiprocessor Embedded Systems
Sara Afshar
sara.afshar@mdh.se
Stockhol
m
Umeå
Göteborg
Malmö
Västerås
Eskilstuna
About Me!
• BSc. in Electrical Engineering in Tabriz University
• Master in Intelligent Embedded Systems
• Mälardalen University, Västerås, Sweden
• Currently, PhD candidate (3rd year)
• Research topic:
Resource sharing in real-time multiprocessors
About MRTC!
Professors: 29
Senior researchers: 52
PhD Students: 76
Research Groups: 16
Reference: www.es.mdh.se
Outline
• Embedded systems
• Real-time systems
• Scheduling and timing analysis
• Resource sharing in uniprocessors
• Multiprocessors
• Open problems
Daily Computers
• A special-purpose computer
• Computers perform the functionality
Embedded Systems
A special-purpose computer that performs a few
dedicated functions, usually with very specific
requirements.
Real-Time Systems
Embedded systems:
– Specialized
– Efficient
But in many cases it is not enough. The system
has to react to the environment at the right time
instance.
Timing Requirements
Real-Time System
Non-Real-Time Systems
Real-Time Systems
The system does the right thing
The system does the right thing It is on-time
&
Example
Airbag example (a very classical example!)
time
Too early Too late
Collision
Real-Time ≠ Fast
Real-Time = Predictable
Hard vs. Soft Real-Time
Each program has a deadline which should not
be missed.
Hard Real-Time
– Missing the deadline cause catastrophe
– E.g., automotive, airplane, industrial control
Soft-Real-Time
– Can miss some deadlines
– E.g., TV, video streaming
Real-Time Tasks
• Program is written by means of different tasks
• On a single-core processor two tasks cannot execute
in parallel
– Some tasks are preempted in order that all tasks execute on time
– Scheduler is responsible to schedule tasks in a processor
sens
Task A
sens sens sens sens
sens sens sens sens sens
Real-Time Tasks
Periodic Tasks: repeat in periodic intervals
e.g., control loops, sensor reading, etc.
Execute Execute ExecuteSleeping Sleeping
𝑇𝑖 𝑇𝑖
Real-Time Tasks
Aperiodic Task: tasks may arrive at any point in
time
e.g., alarm tasks, emergency button, etc.
Execute
The task executes once
An interrupt
event occurs,
e.g., a button
is pushed!
Task may be
trigerred
again at some
point in time!
Real-Time Tasks
Sporadic Task: Similar to aperiodic tasks, however,
minimum time for task’s next activation is known
e.g., task handling keyboard input- minimum time
between pressing two keys known
Minimum inter arrival time = known
Execute𝑇𝑖
Execute
?
Scheduling
The process of deciding the execution order of real-
time tasks, depends of the priority of the task.
There are different mechanism to do that.
Task A misses its deadline Both deadlines are met
Scheduling algorithms
Scheduling algorithms
• Fixed Priority
– RM: smaller priod higher priority
– DM: smaller deadline higher priority
• Dynamic Priority
– EDF: earliest deadline first
Task Model
𝑎𝑖
𝐷𝑖
𝑓𝑖𝑇𝑖
• Arrival time (release time): 𝑎𝑖 = 1
• Execution time: 𝐶𝑖 = 3
• Finishing time: 𝑓𝑖 =7
• Deadline: 𝐷𝑖 = 7
• Period: 𝑇𝑖 = 8
• Response time: 𝑅𝑖 = 𝑓𝑖 − 𝑎𝑖 = 6
𝜏𝑖 𝜏𝑖 𝜏𝑖
Response Time Analysis
A A A A A
H H H H
Response Time of Task A
Ready
time of A
Finishing
time of A
W𝑅 𝐴 = 𝐶𝐴 + ∀𝑗∈ℎ𝑝(𝐴)
𝑊𝑅 𝐴
𝑇 𝑗
× 𝐶𝑗
Interference from higher
priority tasks
Worst-case response time
Resource Sharing
• Some tasks are independent
• Some tasks are aware of each other
– E.g., using a shared memory
– E.g., two tasks writing in a same buffer
Resource Sharing
• Tasks may use hardware/software components
such as a database, hard-drive, sensor etc.
PROBLEM
critical section = part of the task execution that access to a resource
• In real-time systems, semaphore-based locking
synchronization techniques handles mutually-
exclusive access to resources among tasks
– Every task that wants to use a resource first has to lock the resource,
use it and then unlock (release) the resource
Resource Sharing
critical section
Resource Sharing
• Tasks may experience delay due to resource
sharing
– E.g., the task that needs the same resource has to wait for the resource to
be released by other tasks
critical section
BLOCK
Resource Sharing
• Blocking can endanger system correctness
– Priority inversion: a high priority task (in this example task 1) is
forced to wait for a lower priority task (in this example task 2) for an
unbounded amount of time
http://www.idt.mdh.se/kurser/CDT315/index.php?choice=contents
critical section
high priority task already missed its
deadline due to extra waiting for
middle prio. task
Task 1: priority = Low
Task 2 priority = Middle
Task 3: priority = High
deadline
extra delay due to normal execution
of middle prio. task which can be
considerably long compared to
critical sections
high prio. task requests the same
resource which is not available and
is blocked
high prio. task arrives and
preempt the low priority task
middle prio. task
arrives and preempts
low priority task
low prio. task continues
middle prio. task finishes
low prio. task continues and
then releases th resource
Resource Sharing
• Blocking can endanger system correctness
– Priority inversion: high priority task is forced to wait for a lower
priority task for an unbounded amount of time
• Mars Pathfinder
– Landing on July 4, 1997
– Pathfinder experiences repeated resets after staring gathering of
meteorological data.
– Resets caused by timing overruns when using shared communication
buss- a classical case of priority inversion problem.
PIP
• Priority Inheritance Protocol (PIP)
– High priority task cannot be delayed by middle priority task
http://www.idt.mdh.se/kurser/CDT315/index.php?choice=contents
critical section
Task 1: priority = Low
Low priority task
inherits priotiy of
high priority task
Middle priority task arrives
prio. = Low prio. = High prio. = Low
Task 2 priority = Middle
Task 3: priority = High
Low priority task
gets back its own
priotiy
:high priority task meets its deadline
deadline
Synchronization Protocols
• PIP: priority inversion
• PCP: deadlock, chain blocking
• IPIP, IPCP, SRP: blocking only in the beginning
Ready time of A
• By enabling resource sharing, a blocking term is added to the worst-case
response time of a task
Response Time Analysis
A A A A A
H H H H
Response Time of Task A
Finishing time of A
L
W𝑅 𝐴 = 𝐶𝐴 + 𝐵𝐴 + ∀𝑗∈ℎ𝑝(𝐴)
𝑊𝑅 𝐴
𝑇 𝑗
× 𝐶𝑗
Blocking incurred to task A
Power Wall Problem
[Patterson & Hennessy]
Multiprocessors
• Integration of multiple processors on a chip
• Multiprocessors platforms have become
popular in the industry
– Power consumption
– Performance
Multiprocessors
• Integration of multiple processors on a chip
• Multiprocessors platforms have become
popular in the industry
– Power consumption
– Performance
• Migrating to multiprocessor technology
– Immature scheduling and synchronization techniques
– Over simplification
Multiprocessor Scheduling
• Partitioned scheduling:
– Tasks are fixed assigned to processors in design time
– Each processor has its own scheduler and ready queue
– Task migration among processors is not allowed in run-time
local ready queues
per-processor schedulers
processors
Multiprocessor Scheduling
• Global scheduling
– Only one scheduler and one ready queue
– Scheduler assign tasks to processors in run-time
– Task migration among processors is allowed
global ready queue
global scheduler
processors
Multiprocessor Scheduling
• Hybrid scheduling, semi-partitioned scheduling
– Combination of partitioned and global scheduling
• Most tasks are fixed assigned to processor in design time
• A few tasks can migrate among processors in run-time
– Benefits from advantages of both approaches
…
task partitions local ready queues
per-processor schedulers
…
…
processors
partitioned task
migrating task
Resource Sharing
critical section
L
M
H
P1
P2
• More complex problem in multiprocessors
– Remote Blocking is added besides local blocking
deadline
!:high priority task misses its deadline
Response Time Analysis
W𝑅𝑖 = 𝐶𝑖 + 𝐵𝑖 + ∀𝑗∈ℎ𝑝(𝑖)
𝑊𝑅 𝑖
𝑇 𝑗
× 𝐶𝑗
• Two type of blocking in multiprocessors:
– Local blocking
– Remote blocking
𝐵𝑖
𝐿
𝐵𝑖
𝑅
Synchronization Protocol
• Various synchronization protocols:
– MSRP: P-EDF
– M-BWI: G-EDF
– FMLP short: P/G-EDF
– MrsP: P-FP
– MPCP: P-RM
– FMLP long: P/G-EDF
– OMLP: P/G-EDF, P-FP
– MSOS: P-FP
Synchronization Protocol
• Queue type: access priority to the resource
– FIFO, LIFO, PR-Based, Hybrid
• Task behavior during waiting
– Spin-based, suspension-based
• Task priority changes
– Inherited, boosted
Synchronization Protocol
• These protocols proposed for global and
partitioned scheduling
• No protocol for hybrid (semi-partitioned)
scheduling
Our Contributions
4
Semi-Partitioned Scheduling
• Partitioned tasks: tasks that are fixed assigned to
processors and execute only on those processors, i.e.,
they fit (utilization-wise) on processors during
partitioning (𝜏1, … , 𝜏8)
• Migrating tasks: Task(s) that do(es) not fit on any
processor (𝜏9)
𝜏1
𝜏2
𝜏3
𝜏4
𝜏5
𝜏6
𝜏7
𝑃1 𝑃2 𝑃3
𝜏8
𝜏9
Semi-Partitioned Scheduling
• Migrating tasks split among processors which can
provide capacity remained from partitioning (𝜏9 splits
among processors 1 to 3)
𝜏1
𝜏2
𝜏3
𝜏4
𝜏5
𝜏6
𝜏7
𝑃1 𝑃2 𝑃3
𝜏8
𝜏9
Resource Sharing
• Variation in execution time of tasks
• May cause critical sections to happen at any point during
task execution
• In case of semi-partitioned scheduling, critical sections may
happen in any part of a split task and therefore on any
processor that the task is split over
cs1
P1 P2
cs2
P3
cs2
P1 P2
cs1
P3 P1 P2
cs1
P3
cs2
cs1
Case 1 Case 2 Case 3
Resource Sharing
• Therefore, in semi-partitioned scheduling,
existing synchronization protocols cannot be
used directly
cs1
P1 P2
cs2
P3
cs2
P1 P2
cs1
P3 P1 P2
cs1
P3
cs2
cs1
Case 1 Case 2 Case 3
Centralized Solution
• Critical sections migrate to marked processor
• Advantages:
– Centralize resource access
– Remote blocking on marked processor
• Disadvantages:
– Extra migration overhead
P1 P2
Rs

1
i

2
i
marked
processor

2
i 
2
i

2
i
P2
P1
migration overhead
non-split tasks
split task
Decentralized Solution
• Critical sections served where they occur
• Advantages:
– Decreased migration overhead
• Disadvantages:
– Introduced blocking to local tasks
– Increases remote blocking non-split tasks
split task
P1 P2
Rs

1
i

2
i

2
i 
2
i
P2
P1Rs

1
i 
1
i
Analysis
• Local blocking due to local resources
𝐵𝑖,1 = min{𝑛𝑖
𝐺
+ 1,
𝜌 𝑖<𝜌 𝑗
𝑇𝑖
𝑇𝑗
+ 1 𝑛𝑗
𝐿
(𝜏𝑖)} max
𝜌 𝑖<𝜌 𝑗
𝜋 𝑖,𝜋 𝑗∈𝑃 𝑘
𝑅 𝑙∈𝑅 𝑃 𝑘
𝐿
𝜌 𝑖≤𝑐𝑒𝑖𝑙(𝑅 𝑙)
{𝐶𝑠𝑗,𝑙}
𝑐𝑒𝑖𝑙 𝑅𝑙 = max{𝜌2 𝜏2 ∈ 𝜏𝑙,1}
Analysis
• Local blocking due to global resources
𝐵𝑖,2 =
∀𝜌 𝑗<𝜌𝑖
𝜏 𝑖,𝜏 𝑗 𝜖𝑃 𝑘
min{𝑛𝑖
𝐺
+ 1, (
𝑇𝑖
𝑇𝑗
+ 1)𝑛𝑗
𝐺
} max
𝑅 𝑞∈𝑅 𝑃 𝑘
𝐺
{𝐶𝑠𝑗,𝑞}
Analysis
• Remote blocking due to lower priority tasks
𝐵𝑖,3 =
∀𝑅 𝑞∈𝑅 𝑃 𝑘
𝐺
𝜏 𝑖 𝜖𝜏 𝑞,𝑘
𝑛𝑖,𝑞
𝐺
max
∀𝜌 𝑗<𝜌𝑖
𝜏 𝑗 𝜖𝜏 𝑞,𝑟
𝑘≠𝑟
{𝐶𝑠𝑗,𝑞 + 𝜌ℎ,𝑗 𝑅 𝑞
′
max
𝜏 𝑡∈𝑃𝑟
𝜌 𝑡>𝜌 𝑗
𝑅 𝑠∈𝑅 𝑟
𝐺
𝑠≠𝑞
{𝐶𝑠𝑡,𝑠}}
Analysis
• Remote blocking due to higher priority tasks
𝐵𝑖,4 =
∀𝑅 𝑞∈𝑅 𝑃 𝑘
𝐺
𝜏 𝑖 𝜖𝜏 𝑞,𝑘
∀𝜌 𝑗>𝜌 𝑖
𝜏 𝑗 𝜖𝜏 𝑞,𝑟
𝑘≠𝑟
𝑛𝑗,𝑞
𝐺
(
𝑇𝑖
𝑇𝑗
+ 1)(𝐶𝑠𝑗,𝑞 + 𝜌ℎ,𝑗 𝑅 𝑞
′ max
𝜏 𝑡∈𝑃𝑟
𝜌 𝑡>𝜌 𝑡𝑗
𝑅 𝑠∈𝑅 𝑟
𝐺
𝑠≠𝑞
{𝐶𝑠𝑡,𝑠})
Evaluation results
(a) Overhead = 0 µs
(b) Overhead = 140 µs
0,0
0,1
0,2
0,3
0,4
0,5
0,6
0,7
0,8
0,9
1,0
5 25 45 65 85 105 125 145 165 185 205
Schedulability
Critical Section Length (µs)
MLPS
NMLPS
0,0
0,1
0,2
0,3
0,4
0,5
0,6
0,7
0,8
0,9
1,0
5 25 45 65 85 105 125 145 165 185 205
Schedulability
Critical Section Length (µs)
MLPS
NMLPS
: centralized solution
: decentralized solution
: centralized solution
: decentralized solution
Details in Paper
“A Resource Sharing under Multiprocessor Semi-
Partitioned Scheduling.”
Sara Afshar, Farhang Nemati, Thomas Nolte. In proceedings of the
18th IEEE International Conference on Embedded and Real-Time
Computing Systems and Applications (RTCSA), 2012, August.
Open Problems
• Improving synchronization techniques
– Improving of analysis
– Improving of protocols
• Blocking aware partitioning
• Compositional scheduling
THANK YOU!
54

More Related Content

PPT
Real-Time Operating Systems
PDF
RTOS - Real Time Operating Systems
PDF
Real Time Systems
PPT
RTOS Basic Concepts
PPT
RT linux
PDF
Task communication
PPTX
Communication And Synchronization In Distributed Systems
PPTX
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT I Core of Embedded Systems
Real-Time Operating Systems
RTOS - Real Time Operating Systems
Real Time Systems
RTOS Basic Concepts
RT linux
Task communication
Communication And Synchronization In Distributed Systems
SYBSC IT SEM IV EMBEDDED SYSTEMS UNIT I Core of Embedded Systems

What's hot (20)

PPT
Mutual-Exclusion Algorithm.ppt
PPTX
PDF
IEEE 802.11 Architecture and Services
PPT
Isdn networking
PPT
Rtos Concepts
PPTX
WORKFLOW OF THE PROCESS IN SPM
PPTX
Embedded system design process
PPT
Real Time Operating system (RTOS) - Embedded systems
PPTX
PPT
security in wireless sensor networks
DOCX
Embedded System
PPT
Quality attributes of Embedded Systems
PPTX
wireless network IEEE 802.11
PDF
Unit II Arm7 Thumb Instruction
PPT
Mobile ad hoc networks (manets)
PPT
Wsn 08
PDF
IoT Physical Devices and End Points.pdf
PPTX
Rtos concepts
PPTX
SDN( Software Defined Network) and NFV(Network Function Virtualization) for I...
PPTX
Improving of software processes
Mutual-Exclusion Algorithm.ppt
IEEE 802.11 Architecture and Services
Isdn networking
Rtos Concepts
WORKFLOW OF THE PROCESS IN SPM
Embedded system design process
Real Time Operating system (RTOS) - Embedded systems
security in wireless sensor networks
Embedded System
Quality attributes of Embedded Systems
wireless network IEEE 802.11
Unit II Arm7 Thumb Instruction
Mobile ad hoc networks (manets)
Wsn 08
IoT Physical Devices and End Points.pdf
Rtos concepts
SDN( Software Defined Network) and NFV(Network Function Virtualization) for I...
Improving of software processes
Ad

Viewers also liked (20)

PPTX
(Slides) Task scheduling algorithm for multicore processor system for minimiz...
PPT
TASK SCHEDULING ON ADAPTIVE MULTI-CORE
PDF
Partitioning CCGrid 2012
PPTX
C# Parallel programming
PPT
Scheduling for cloud systems with multi level data locality
PPTX
Wait-free data structures on embedded multi-core systems
PDF
Kernel Recipes 2016 - Understanding a Real-Time System (more than just a kernel)
PPTX
Python Programming Essentials - M16 - Control Flow Statements and Loops
PPT
6 multiprogramming & time sharing
PPTX
Introduction to Parallel and Distributed Computing
PPTX
Real time system in Multicore/Multiprocessor system
PPTX
Python Programming Essentials - M18 - Modules and Packages
PPT
10 Multicore 07
PPT
Real time scheduling - basic concepts
PPTX
Batch operating system
PPTX
Memory allocation for real time operating system
PPS
Critical Chain Project Management
PPT
Distributed & parallel system
PDF
Using Python Packages - An Overview
PDF
Multicore scheduling in automotive ECUs
(Slides) Task scheduling algorithm for multicore processor system for minimiz...
TASK SCHEDULING ON ADAPTIVE MULTI-CORE
Partitioning CCGrid 2012
C# Parallel programming
Scheduling for cloud systems with multi level data locality
Wait-free data structures on embedded multi-core systems
Kernel Recipes 2016 - Understanding a Real-Time System (more than just a kernel)
Python Programming Essentials - M16 - Control Flow Statements and Loops
6 multiprogramming & time sharing
Introduction to Parallel and Distributed Computing
Real time system in Multicore/Multiprocessor system
Python Programming Essentials - M18 - Modules and Packages
10 Multicore 07
Real time scheduling - basic concepts
Batch operating system
Memory allocation for real time operating system
Critical Chain Project Management
Distributed & parallel system
Using Python Packages - An Overview
Multicore scheduling in automotive ECUs
Ad

Similar to Sara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time Systems (20)

PPT
Planificacion
PPT
06-scheduling.ppt including multiple CPUs
PPT
ESC UNIT 3.ppt
PDF
Hadoop scheduler
PPT
PPT
multiprocessor real_ time scheduling.ppt
PPTX
programming .pptx
PPTX
Operating system 31 multiple processor scheduling
PPT
Lecture1
PPT
Operating Systems Process Scheduling Algorithms
PPT
10-MultiprocessorScheduling chapter8.ppt
PPT
cs1311lecture25wdl.ppt
PPT
Sceduling
PDF
Section05 scheduling
PPTX
Real Time System
PPTX
Chapter 3 - Operating System Scheduling.pptx
PDF
Ch5 process synchronization
PPTX
Operating system
PPTX
Cpu scheduling
Planificacion
06-scheduling.ppt including multiple CPUs
ESC UNIT 3.ppt
Hadoop scheduler
multiprocessor real_ time scheduling.ppt
programming .pptx
Operating system 31 multiple processor scheduling
Lecture1
Operating Systems Process Scheduling Algorithms
10-MultiprocessorScheduling chapter8.ppt
cs1311lecture25wdl.ppt
Sceduling
Section05 scheduling
Real Time System
Chapter 3 - Operating System Scheduling.pptx
Ch5 process synchronization
Operating system
Cpu scheduling

More from knowdiff (16)

PPTX
Ut talk feb 2017
PDF
Ali khalili: Towards an Open Linked Data-based Infrastructure for Studying Sc...
PPTX
Amin Milani Fard: Directed Model Inference for Testing and Analysis of Web Ap...
PDF
Knowledge based economy and power of crowd sourcing
PDF
Amin tayyebi: Big Data and Land Use Change Science
PDF
Mehdi Rezagholizadeh: Image Sensor Modeling: Color Measurement at Low Light L...
PPTX
Seyed Mehdi mohaghegh: Modelling material use within the low carbon energy pa...
PDF
Narjess Afzaly: Model Your Problem with Graphs and Generate your objects
PDF
Computational methods applications in air pollution modeling (Dr. Yadghar)
PDF
Somaz Kolahi : Functional Dependencies: Redundancy Analysis and Correcting Vi...
PPT
Uncalibrated Image-Based Robotic Visual Servoing (knowdiff.net)
PPT
Knowdiff visiting lecturer 140 (Azad Shademan): Uncalibrated Image-Based Robo...
PPS
Mehran Shaghaghi: Quantum Mechanics Dilemmas
PPT
Hossein Taghavi : Codes on Graphs
PDF
Dr. Amir Nejat
PDF
Alborz
Ut talk feb 2017
Ali khalili: Towards an Open Linked Data-based Infrastructure for Studying Sc...
Amin Milani Fard: Directed Model Inference for Testing and Analysis of Web Ap...
Knowledge based economy and power of crowd sourcing
Amin tayyebi: Big Data and Land Use Change Science
Mehdi Rezagholizadeh: Image Sensor Modeling: Color Measurement at Low Light L...
Seyed Mehdi mohaghegh: Modelling material use within the low carbon energy pa...
Narjess Afzaly: Model Your Problem with Graphs and Generate your objects
Computational methods applications in air pollution modeling (Dr. Yadghar)
Somaz Kolahi : Functional Dependencies: Redundancy Analysis and Correcting Vi...
Uncalibrated Image-Based Robotic Visual Servoing (knowdiff.net)
Knowdiff visiting lecturer 140 (Azad Shademan): Uncalibrated Image-Based Robo...
Mehran Shaghaghi: Quantum Mechanics Dilemmas
Hossein Taghavi : Codes on Graphs
Dr. Amir Nejat
Alborz

Recently uploaded (20)

PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Spectroscopy.pptx food analysis technology
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Cloud computing and distributed systems.
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Electronic commerce courselecture one. Pdf
PDF
Approach and Philosophy of On baking technology
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
Big Data Technologies - Introduction.pptx
Encapsulation_ Review paper, used for researhc scholars
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Unlocking AI with Model Context Protocol (MCP)
Spectroscopy.pptx food analysis technology
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Advanced methodologies resolving dimensionality complications for autism neur...
Programs and apps: productivity, graphics, security and other tools
Dropbox Q2 2025 Financial Results & Investor Presentation
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Cloud computing and distributed systems.
The Rise and Fall of 3GPP – Time for a Sabbatical?
Mobile App Security Testing_ A Comprehensive Guide.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Electronic commerce courselecture one. Pdf
Approach and Philosophy of On baking technology
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
MIND Revenue Release Quarter 2 2025 Press Release
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Big Data Technologies - Introduction.pptx

Sara Afshar: Scheduling and Resource Sharing in Multiprocessor Real-Time Systems

  • 1. Resource Sharing in Real-Time Uni/Multiprocessor Embedded Systems Sara Afshar sara.afshar@mdh.se
  • 2. Stockhol m Umeå Göteborg Malmö Västerås Eskilstuna About Me! • BSc. in Electrical Engineering in Tabriz University • Master in Intelligent Embedded Systems • Mälardalen University, Västerås, Sweden • Currently, PhD candidate (3rd year) • Research topic: Resource sharing in real-time multiprocessors
  • 3. About MRTC! Professors: 29 Senior researchers: 52 PhD Students: 76 Research Groups: 16 Reference: www.es.mdh.se
  • 4. Outline • Embedded systems • Real-time systems • Scheduling and timing analysis • Resource sharing in uniprocessors • Multiprocessors • Open problems
  • 5. Daily Computers • A special-purpose computer • Computers perform the functionality
  • 6. Embedded Systems A special-purpose computer that performs a few dedicated functions, usually with very specific requirements.
  • 7. Real-Time Systems Embedded systems: – Specialized – Efficient But in many cases it is not enough. The system has to react to the environment at the right time instance. Timing Requirements
  • 8. Real-Time System Non-Real-Time Systems Real-Time Systems The system does the right thing The system does the right thing It is on-time &
  • 9. Example Airbag example (a very classical example!) time Too early Too late Collision Real-Time ≠ Fast Real-Time = Predictable
  • 10. Hard vs. Soft Real-Time Each program has a deadline which should not be missed. Hard Real-Time – Missing the deadline cause catastrophe – E.g., automotive, airplane, industrial control Soft-Real-Time – Can miss some deadlines – E.g., TV, video streaming
  • 11. Real-Time Tasks • Program is written by means of different tasks • On a single-core processor two tasks cannot execute in parallel – Some tasks are preempted in order that all tasks execute on time – Scheduler is responsible to schedule tasks in a processor sens Task A sens sens sens sens sens sens sens sens sens
  • 12. Real-Time Tasks Periodic Tasks: repeat in periodic intervals e.g., control loops, sensor reading, etc. Execute Execute ExecuteSleeping Sleeping 𝑇𝑖 𝑇𝑖
  • 13. Real-Time Tasks Aperiodic Task: tasks may arrive at any point in time e.g., alarm tasks, emergency button, etc. Execute The task executes once An interrupt event occurs, e.g., a button is pushed! Task may be trigerred again at some point in time!
  • 14. Real-Time Tasks Sporadic Task: Similar to aperiodic tasks, however, minimum time for task’s next activation is known e.g., task handling keyboard input- minimum time between pressing two keys known Minimum inter arrival time = known Execute𝑇𝑖 Execute ?
  • 15. Scheduling The process of deciding the execution order of real- time tasks, depends of the priority of the task. There are different mechanism to do that. Task A misses its deadline Both deadlines are met
  • 17. Scheduling algorithms • Fixed Priority – RM: smaller priod higher priority – DM: smaller deadline higher priority • Dynamic Priority – EDF: earliest deadline first
  • 18. Task Model 𝑎𝑖 𝐷𝑖 𝑓𝑖𝑇𝑖 • Arrival time (release time): 𝑎𝑖 = 1 • Execution time: 𝐶𝑖 = 3 • Finishing time: 𝑓𝑖 =7 • Deadline: 𝐷𝑖 = 7 • Period: 𝑇𝑖 = 8 • Response time: 𝑅𝑖 = 𝑓𝑖 − 𝑎𝑖 = 6 𝜏𝑖 𝜏𝑖 𝜏𝑖
  • 19. Response Time Analysis A A A A A H H H H Response Time of Task A Ready time of A Finishing time of A W𝑅 𝐴 = 𝐶𝐴 + ∀𝑗∈ℎ𝑝(𝐴) 𝑊𝑅 𝐴 𝑇 𝑗 × 𝐶𝑗 Interference from higher priority tasks Worst-case response time
  • 20. Resource Sharing • Some tasks are independent • Some tasks are aware of each other – E.g., using a shared memory – E.g., two tasks writing in a same buffer
  • 21. Resource Sharing • Tasks may use hardware/software components such as a database, hard-drive, sensor etc. PROBLEM critical section = part of the task execution that access to a resource
  • 22. • In real-time systems, semaphore-based locking synchronization techniques handles mutually- exclusive access to resources among tasks – Every task that wants to use a resource first has to lock the resource, use it and then unlock (release) the resource Resource Sharing critical section
  • 23. Resource Sharing • Tasks may experience delay due to resource sharing – E.g., the task that needs the same resource has to wait for the resource to be released by other tasks critical section BLOCK
  • 24. Resource Sharing • Blocking can endanger system correctness – Priority inversion: a high priority task (in this example task 1) is forced to wait for a lower priority task (in this example task 2) for an unbounded amount of time http://www.idt.mdh.se/kurser/CDT315/index.php?choice=contents critical section high priority task already missed its deadline due to extra waiting for middle prio. task Task 1: priority = Low Task 2 priority = Middle Task 3: priority = High deadline extra delay due to normal execution of middle prio. task which can be considerably long compared to critical sections high prio. task requests the same resource which is not available and is blocked high prio. task arrives and preempt the low priority task middle prio. task arrives and preempts low priority task low prio. task continues middle prio. task finishes low prio. task continues and then releases th resource
  • 25. Resource Sharing • Blocking can endanger system correctness – Priority inversion: high priority task is forced to wait for a lower priority task for an unbounded amount of time • Mars Pathfinder – Landing on July 4, 1997 – Pathfinder experiences repeated resets after staring gathering of meteorological data. – Resets caused by timing overruns when using shared communication buss- a classical case of priority inversion problem.
  • 26. PIP • Priority Inheritance Protocol (PIP) – High priority task cannot be delayed by middle priority task http://www.idt.mdh.se/kurser/CDT315/index.php?choice=contents critical section Task 1: priority = Low Low priority task inherits priotiy of high priority task Middle priority task arrives prio. = Low prio. = High prio. = Low Task 2 priority = Middle Task 3: priority = High Low priority task gets back its own priotiy :high priority task meets its deadline deadline
  • 27. Synchronization Protocols • PIP: priority inversion • PCP: deadlock, chain blocking • IPIP, IPCP, SRP: blocking only in the beginning
  • 28. Ready time of A • By enabling resource sharing, a blocking term is added to the worst-case response time of a task Response Time Analysis A A A A A H H H H Response Time of Task A Finishing time of A L W𝑅 𝐴 = 𝐶𝐴 + 𝐵𝐴 + ∀𝑗∈ℎ𝑝(𝐴) 𝑊𝑅 𝐴 𝑇 𝑗 × 𝐶𝑗 Blocking incurred to task A
  • 30. Multiprocessors • Integration of multiple processors on a chip • Multiprocessors platforms have become popular in the industry – Power consumption – Performance
  • 31. Multiprocessors • Integration of multiple processors on a chip • Multiprocessors platforms have become popular in the industry – Power consumption – Performance • Migrating to multiprocessor technology – Immature scheduling and synchronization techniques – Over simplification
  • 32. Multiprocessor Scheduling • Partitioned scheduling: – Tasks are fixed assigned to processors in design time – Each processor has its own scheduler and ready queue – Task migration among processors is not allowed in run-time local ready queues per-processor schedulers processors
  • 33. Multiprocessor Scheduling • Global scheduling – Only one scheduler and one ready queue – Scheduler assign tasks to processors in run-time – Task migration among processors is allowed global ready queue global scheduler processors
  • 34. Multiprocessor Scheduling • Hybrid scheduling, semi-partitioned scheduling – Combination of partitioned and global scheduling • Most tasks are fixed assigned to processor in design time • A few tasks can migrate among processors in run-time – Benefits from advantages of both approaches … task partitions local ready queues per-processor schedulers … … processors partitioned task migrating task
  • 35. Resource Sharing critical section L M H P1 P2 • More complex problem in multiprocessors – Remote Blocking is added besides local blocking deadline !:high priority task misses its deadline
  • 36. Response Time Analysis W𝑅𝑖 = 𝐶𝑖 + 𝐵𝑖 + ∀𝑗∈ℎ𝑝(𝑖) 𝑊𝑅 𝑖 𝑇 𝑗 × 𝐶𝑗 • Two type of blocking in multiprocessors: – Local blocking – Remote blocking 𝐵𝑖 𝐿 𝐵𝑖 𝑅
  • 37. Synchronization Protocol • Various synchronization protocols: – MSRP: P-EDF – M-BWI: G-EDF – FMLP short: P/G-EDF – MrsP: P-FP – MPCP: P-RM – FMLP long: P/G-EDF – OMLP: P/G-EDF, P-FP – MSOS: P-FP
  • 38. Synchronization Protocol • Queue type: access priority to the resource – FIFO, LIFO, PR-Based, Hybrid • Task behavior during waiting – Spin-based, suspension-based • Task priority changes – Inherited, boosted
  • 39. Synchronization Protocol • These protocols proposed for global and partitioned scheduling • No protocol for hybrid (semi-partitioned) scheduling
  • 41. Semi-Partitioned Scheduling • Partitioned tasks: tasks that are fixed assigned to processors and execute only on those processors, i.e., they fit (utilization-wise) on processors during partitioning (𝜏1, … , 𝜏8) • Migrating tasks: Task(s) that do(es) not fit on any processor (𝜏9) 𝜏1 𝜏2 𝜏3 𝜏4 𝜏5 𝜏6 𝜏7 𝑃1 𝑃2 𝑃3 𝜏8 𝜏9
  • 42. Semi-Partitioned Scheduling • Migrating tasks split among processors which can provide capacity remained from partitioning (𝜏9 splits among processors 1 to 3) 𝜏1 𝜏2 𝜏3 𝜏4 𝜏5 𝜏6 𝜏7 𝑃1 𝑃2 𝑃3 𝜏8 𝜏9
  • 43. Resource Sharing • Variation in execution time of tasks • May cause critical sections to happen at any point during task execution • In case of semi-partitioned scheduling, critical sections may happen in any part of a split task and therefore on any processor that the task is split over cs1 P1 P2 cs2 P3 cs2 P1 P2 cs1 P3 P1 P2 cs1 P3 cs2 cs1 Case 1 Case 2 Case 3
  • 44. Resource Sharing • Therefore, in semi-partitioned scheduling, existing synchronization protocols cannot be used directly cs1 P1 P2 cs2 P3 cs2 P1 P2 cs1 P3 P1 P2 cs1 P3 cs2 cs1 Case 1 Case 2 Case 3
  • 45. Centralized Solution • Critical sections migrate to marked processor • Advantages: – Centralize resource access – Remote blocking on marked processor • Disadvantages: – Extra migration overhead P1 P2 Rs  1 i  2 i marked processor  2 i  2 i  2 i P2 P1 migration overhead non-split tasks split task
  • 46. Decentralized Solution • Critical sections served where they occur • Advantages: – Decreased migration overhead • Disadvantages: – Introduced blocking to local tasks – Increases remote blocking non-split tasks split task P1 P2 Rs  1 i  2 i  2 i  2 i P2 P1Rs  1 i  1 i
  • 47. Analysis • Local blocking due to local resources 𝐵𝑖,1 = min{𝑛𝑖 𝐺 + 1, 𝜌 𝑖<𝜌 𝑗 𝑇𝑖 𝑇𝑗 + 1 𝑛𝑗 𝐿 (𝜏𝑖)} max 𝜌 𝑖<𝜌 𝑗 𝜋 𝑖,𝜋 𝑗∈𝑃 𝑘 𝑅 𝑙∈𝑅 𝑃 𝑘 𝐿 𝜌 𝑖≤𝑐𝑒𝑖𝑙(𝑅 𝑙) {𝐶𝑠𝑗,𝑙} 𝑐𝑒𝑖𝑙 𝑅𝑙 = max{𝜌2 𝜏2 ∈ 𝜏𝑙,1}
  • 48. Analysis • Local blocking due to global resources 𝐵𝑖,2 = ∀𝜌 𝑗<𝜌𝑖 𝜏 𝑖,𝜏 𝑗 𝜖𝑃 𝑘 min{𝑛𝑖 𝐺 + 1, ( 𝑇𝑖 𝑇𝑗 + 1)𝑛𝑗 𝐺 } max 𝑅 𝑞∈𝑅 𝑃 𝑘 𝐺 {𝐶𝑠𝑗,𝑞}
  • 49. Analysis • Remote blocking due to lower priority tasks 𝐵𝑖,3 = ∀𝑅 𝑞∈𝑅 𝑃 𝑘 𝐺 𝜏 𝑖 𝜖𝜏 𝑞,𝑘 𝑛𝑖,𝑞 𝐺 max ∀𝜌 𝑗<𝜌𝑖 𝜏 𝑗 𝜖𝜏 𝑞,𝑟 𝑘≠𝑟 {𝐶𝑠𝑗,𝑞 + 𝜌ℎ,𝑗 𝑅 𝑞 ′ max 𝜏 𝑡∈𝑃𝑟 𝜌 𝑡>𝜌 𝑗 𝑅 𝑠∈𝑅 𝑟 𝐺 𝑠≠𝑞 {𝐶𝑠𝑡,𝑠}}
  • 50. Analysis • Remote blocking due to higher priority tasks 𝐵𝑖,4 = ∀𝑅 𝑞∈𝑅 𝑃 𝑘 𝐺 𝜏 𝑖 𝜖𝜏 𝑞,𝑘 ∀𝜌 𝑗>𝜌 𝑖 𝜏 𝑗 𝜖𝜏 𝑞,𝑟 𝑘≠𝑟 𝑛𝑗,𝑞 𝐺 ( 𝑇𝑖 𝑇𝑗 + 1)(𝐶𝑠𝑗,𝑞 + 𝜌ℎ,𝑗 𝑅 𝑞 ′ max 𝜏 𝑡∈𝑃𝑟 𝜌 𝑡>𝜌 𝑡𝑗 𝑅 𝑠∈𝑅 𝑟 𝐺 𝑠≠𝑞 {𝐶𝑠𝑡,𝑠})
  • 51. Evaluation results (a) Overhead = 0 µs (b) Overhead = 140 µs 0,0 0,1 0,2 0,3 0,4 0,5 0,6 0,7 0,8 0,9 1,0 5 25 45 65 85 105 125 145 165 185 205 Schedulability Critical Section Length (µs) MLPS NMLPS 0,0 0,1 0,2 0,3 0,4 0,5 0,6 0,7 0,8 0,9 1,0 5 25 45 65 85 105 125 145 165 185 205 Schedulability Critical Section Length (µs) MLPS NMLPS : centralized solution : decentralized solution : centralized solution : decentralized solution
  • 52. Details in Paper “A Resource Sharing under Multiprocessor Semi- Partitioned Scheduling.” Sara Afshar, Farhang Nemati, Thomas Nolte. In proceedings of the 18th IEEE International Conference on Embedded and Real-Time Computing Systems and Applications (RTCSA), 2012, August.
  • 53. Open Problems • Improving synchronization techniques – Improving of analysis – Improving of protocols • Blocking aware partitioning • Compositional scheduling