SlideShare a Scribd company logo
Part	
  2	
  :	
  Code	
  Reading	
  
of	
  

F9	
  Microkernel	
  

Scheduling	
  
ben6	
  
2013-­‐11-­‐18	
  
F9	
  

Agenda	
  

•  Brief	
  of	
  F9	
  Microkernel	
  Scheduling	
  
•  All	
  about	
  Algorithms	
  
•  Scheduling	
  Code	
  reading	
  
F9	
  

Agenda	
  

•  Brief	
  of	
  F9	
  Microkernel	
  Scheduling	
  
•  All	
  about	
  Algorithms	
  
•  Scheduling	
  Code	
  reading	
  
F9	
  Microkernel	
  Overview	
  
•  an	
  experimental	
  microkernel	
  used	
  to	
  construct	
  
flexible	
  embedded	
  systems	
  inspired	
  by	
  famous	
  L4	
  
microkernel.	
  	
  
•  The	
  moMvaMon	
  of	
  F9	
  microkernel	
  is	
  to	
  deploy	
  
modern	
  kernel	
  techniques	
  to	
  support	
  	
  
–  running	
  real-­‐Mme	
  and	
  Mme-­‐sharing	
  applicaMons	
  (ex:	
  	
  
wireless	
  communicaMons)	
  for	
  ARM	
  Cortex-­‐M	
  series	
  
microprocessors	
  with	
  efficiency	
  (performance	
  +	
  
power	
  consumpMon)	
  	
  
–  security	
  (memory	
  protecMon	
  +	
  isolated	
  execuMon)	
  
CharacterisMcs	
  
•  Energy	
  efficient	
  scheduling	
  
•  Tickless	
  Mmer	
  
Mckless	
  scheduler	
  
•  F9	
  implements	
  a	
  Mckless	
  scheduler	
  which	
  implies	
  
the	
  dynamic	
  Mmer.	
  
•  You	
  can	
  track	
  the	
  development	
  here:	
  
	
  
hWps://github.com/southernbear/RIOT/wiki/
Development	
  
•  F9	
  follows	
  some	
  concepts	
  about	
  TiROS	
  for	
  
Mckless:	
  
	
  	
  	
  	
  hWp://Mros.sourceforge.net/
F9	
  

Agenda	
  

•  Brief	
  of	
  F9	
  Microkernel	
  Scheduling	
  
•  All	
  about	
  Algorithms	
  
•  Scheduling	
  Code	
  reading	
  
Tickless	
  Scheduling
•  Reference	
  concept	
  of	
  TiROS	
  
•  TiROS	
  avoids	
  most	
  context-­‐switching	
  
overhead	
  costs	
  by	
  eliminaMng	
  periodic	
  Mcks.	
  
•  Most	
  embedded	
  real-­‐Mme	
  OSes,	
  a	
  trade	
  off	
  
between	
  high	
  Mme-­‐resoluMon	
  (by	
  increasing	
  
Mck	
  frequency)	
  and	
  overhead.	
  
•  TiROS	
  does	
  not	
  use	
  Mcks	
  and	
  achieves	
  high-­‐
Mme	
  resoluMon	
  with	
  very	
  low	
  overhead.
F9	
  

Agenda	
  

•  Brief	
  of	
  F9	
  Microkernel	
  Scheduling	
  
•  All	
  about	
  Algorithms	
  
•  Scheduling	
  Code	
  reading	
  
Scheduling	
  related	
  code	
  
• 
• 
• 
• 
• 
• 
• 

ipc.c	
  
kMmer.c	
  
sched.c	
  	
  	
  	
  	
  (most	
  important)	
  
so]irq.c	
  
syscall.c	
  
systhread.c	
  
thread.c	
  
KMmer_handler	
  

Timer	
  handler	
  in	
  ISR	
  
vector	
  table	
  
kMmer_handler	
  
Hardware	
  interrupt	
  
trigger	
  ktmer_handler	
  
Plaborm/irq.h:	
  schedule_in_irq	
  

Trigger	
  point	
  of	
  
scheduling	
  which	
  while	
  
IRQ	
  event	
  occurs	
  

include/plaborm/irq.h	
  
IRQ_HANDLER	
  

include/plaborm/irq.h	
  
context_switch	
  

include/plaborm/irq.h	
  
Scheduler	
  slots
•  sched.h

sched.h	
  

	
  26	
  typedef	
  struct	
  sched_slot	
  {	
  
	
  27	
  	
  	
  	
  	
  tcb_t	
  *ss_scheduled;	
  
	
  28	
  	
  	
  	
  	
  sched_handler_t	
  ss_handler;	
  
	
  29	
  }	
  sched_slot_t;	
  
sched_slot_t	
  

ss_scheduled	
  
ss_handler

Priority	
  in	
  order	
  
Schedule	
  handler	
  

typedef	
  tcb_t	
  *(*sched_handler_t)(struct	
  sched_slot	
  *slot);	
  
Select	
  target	
  thread	
  

ss_handler	
  is	
  used	
  
while	
  currnt	
  slot	
  
thread	
  is	
  empty	
  or	
  
not	
  runnable	
  
thread_state_t	
  

Only	
  scheduling	
  for	
  T_RUNNABLE	
  State	
  
Thread	
  control	
  block	
  

TCB	
  using	
  by	
  schedule	
  slots	
  
__NAKED	
  
•  __aWribute__((naked))	
  

Using	
  While	
  IRQ	
  funcMon	
  

Use	
  this	
  aWribute	
  on	
  the	
  ARM,	
  AVR,	
  MCORE,	
  MSP430,	
  NDS32,	
  RL78,	
  RX	
  and	
  SPU	
  
ports	
  to	
  indicate	
  that	
  the	
  specified	
  funcMon	
  does	
  not	
  need	
  prologue/epilogue	
  
sequences	
  generated	
  by	
  the	
  compiler.	
  	
  
	
  
It	
  is	
  up	
  to	
  the	
  programmer	
  to	
  provide	
  these	
  sequences.	
  	
  
	
  
The	
  only	
  statements	
  that	
  can	
  be	
  safely	
  included	
  in	
  naked	
  funcMons	
  are	
  asm	
  
statements	
  that	
  do	
  not	
  have	
  operands.	
  	
  
	
  
All	
  other	
  statements,	
  including	
  declaraMons	
  of	
  local	
  variables,	
  if	
  statements,	
  and	
  so	
  
forth,	
  should	
  be	
  avoided.	
  Naked	
  funcMons	
  should	
  be	
  used	
  to	
  implement	
  the	
  body	
  of	
  
an	
  assembly	
  funcMon,	
  while	
  allowing	
  the	
  compiler	
  to	
  construct	
  the	
  requisite	
  
funcMon	
  declaraMon	
  for	
  the	
  assembler.	
  	
  
kMmer	
  event	
  scheduling	
  
schedule_slot_set_handler	
  
thread.c	
  
Conclusion	
  
•  F9	
  Microkernel	
  uses	
  following	
  concepts	
  
–  Tickless	
  Scheduling	
  
–  Dynamic	
  Timer	
  
To	
  archive	
  energy	
  efficiency	
  scheduling	
  
Discussions	
  

F9	
  

?	
  
Kernel	
  line	
  of	
  code	
  for	
  reading	
  

Kernel	
  C	
  code	
  line:	
  2183	
  
Git	
  head:	
  4d87f204252d57525f9cd93f163ca5225cc34bb7	
  
References	
  
•  F9	
  Microkernel	
  source	
  code	
  and	
  introducMon	
  
•  hWps://github.com/southernbear/RIOT/wiki/Development	
  
•  TiROS	
  for	
  Mckless	
  hWp://Mros.sourceforge.net/	
  
•  GCC	
  Naked	
  AWribute	
  

	
  

More Related Content

PDF
F9 microkernel code reading part 4 memory management
PDF
F9 Microkernel code reading - part 1
PDF
Learn How to Develop Embedded System for ARM @ 2014.12.22 JuluOSDev
PDF
Linux on ARM 64-bit Architecture
PDF
Let's Play STM32
PPTX
Linux Kernel Booting Process (1) - For NLKB
PPTX
Tiny ML for spark Fun Edge
PDF
ARM AAE - Architecture
F9 microkernel code reading part 4 memory management
F9 Microkernel code reading - part 1
Learn How to Develop Embedded System for ARM @ 2014.12.22 JuluOSDev
Linux on ARM 64-bit Architecture
Let's Play STM32
Linux Kernel Booting Process (1) - For NLKB
Tiny ML for spark Fun Edge
ARM AAE - Architecture

What's hot (20)

PDF
AAME ARM Techcon2013 006v02 Implementation Diversity
PPTX
ARM Architecture in Details
PPT
Linux Kernel Image
PPTX
Arm v8 instruction overview android 64 bit briefing
PDF
2 introduction to arm architecture
PDF
AAME ARM Techcon2013 003v02 Software Development
PDF
AAME ARM Techcon2013 005v02 System Startup
PDF
ds894-zynq-ultrascale-plus-overview
PPT
An Overview Study on 32-bit MCU MB91460 Series and its Peripherals
PDF
AAME ARM Techcon2013 004v02 Debug and Optimization
PDF
ARM AAE - Memory Systems
PDF
Q4.11: ARM Technology Update Plenary
PDF
ARM AAE - Developing Code for ARM
PDF
HKG18-110 - net_mdev: Fast path user space I/O
PDF
ARM AAE - System Issues
PDF
BKK16-303 96Boards - TV Platform
PPTX
Scalable Matrix Multiplication for the 16 Core Epiphany Co-Processor
PPTX
U-Boot presentation 2013
PDF
A-LOOP: AMP system: 2-cores ARM Cortex A9/Linux OS and 4-cores Leon3/Linux OS...
PPTX
GCC for ARMv8 Aarch64
AAME ARM Techcon2013 006v02 Implementation Diversity
ARM Architecture in Details
Linux Kernel Image
Arm v8 instruction overview android 64 bit briefing
2 introduction to arm architecture
AAME ARM Techcon2013 003v02 Software Development
AAME ARM Techcon2013 005v02 System Startup
ds894-zynq-ultrascale-plus-overview
An Overview Study on 32-bit MCU MB91460 Series and its Peripherals
AAME ARM Techcon2013 004v02 Debug and Optimization
ARM AAE - Memory Systems
Q4.11: ARM Technology Update Plenary
ARM AAE - Developing Code for ARM
HKG18-110 - net_mdev: Fast path user space I/O
ARM AAE - System Issues
BKK16-303 96Boards - TV Platform
Scalable Matrix Multiplication for the 16 Core Epiphany Co-Processor
U-Boot presentation 2013
A-LOOP: AMP system: 2-cores ARM Cortex A9/Linux OS and 4-cores Leon3/Linux OS...
GCC for ARMv8 Aarch64
Ad

Viewers also liked (8)

PDF
While software engineer meets 3d printer
PDF
C&cpu
PDF
Tdd with python unittest for embedded c
PDF
Sf 160 kjs manual
PDF
Audi a6 adr
PPTX
F9 microkernel app development part 2 gpio meets led
PDF
Develop Your Own Operating System
PDF
Hype vs. Reality: The AI Explainer
While software engineer meets 3d printer
C&cpu
Tdd with python unittest for embedded c
Sf 160 kjs manual
Audi a6 adr
F9 microkernel app development part 2 gpio meets led
Develop Your Own Operating System
Hype vs. Reality: The AI Explainer
Ad

Similar to F9 Microkernel code reading part 2 scheduling (20)

PDF
F9: A Secure and Efficient Microkernel Built for Deeply Embedded Systems
PPTX
MODULE IV embedded (1).pptx
ODP
A tour of F9 microkernel and BitSec hypervisor
PPT
CSW355-OS-ch3-Selected (11111111111).ppt
PPTX
Processes and operating systems
PPTX
CS345 09 - Ch04 Threads operating system1.pptx
PDF
Operating System
PDF
seminar report
PDF
ch3cxxvnbcxnnbvccbmmvcbnnccbnnhfdddcbjkjjn.pdf
PPTX
UNIT II PPT.pptx
PDF
Linux Scheduler Latest_ viresh Kumar.pdf
PPTX
What is an Operating Systems?
PPT
Lec 06 processes part two pf operationg system .ppt
PPTX
Operating System
PDF
3 processes
PPTX
How Operating system works.
PDF
Unix++: Plan 9 from Bell Labs
PDF
Bedtime Stories on Operating Systems.pdf
DOCX
Uniprocessor SchedulingCsci 430, Spring 2018Texas A&
PPTX
RTOS _Timer , Event, Memory, Device, File & IO Systems Management_10-07-25.pptx
F9: A Secure and Efficient Microkernel Built for Deeply Embedded Systems
MODULE IV embedded (1).pptx
A tour of F9 microkernel and BitSec hypervisor
CSW355-OS-ch3-Selected (11111111111).ppt
Processes and operating systems
CS345 09 - Ch04 Threads operating system1.pptx
Operating System
seminar report
ch3cxxvnbcxnnbvccbmmvcbnnccbnnhfdddcbjkjjn.pdf
UNIT II PPT.pptx
Linux Scheduler Latest_ viresh Kumar.pdf
What is an Operating Systems?
Lec 06 processes part two pf operationg system .ppt
Operating System
3 processes
How Operating system works.
Unix++: Plan 9 from Bell Labs
Bedtime Stories on Operating Systems.pdf
Uniprocessor SchedulingCsci 430, Spring 2018Texas A&
RTOS _Timer , Event, Memory, Device, File & IO Systems Management_10-07-25.pptx

Recently uploaded (20)

DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
Big Data Technologies - Introduction.pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
sap open course for s4hana steps from ECC to s4
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Spectroscopy.pptx food analysis technology
PPTX
A Presentation on Artificial Intelligence
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Empathic Computing: Creating Shared Understanding
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Programs and apps: productivity, graphics, security and other tools
PPT
Teaching material agriculture food technology
The AUB Centre for AI in Media Proposal.docx
Big Data Technologies - Introduction.pptx
Network Security Unit 5.pdf for BCA BBA.
A comparative analysis of optical character recognition models for extracting...
Chapter 3 Spatial Domain Image Processing.pdf
sap open course for s4hana steps from ECC to s4
NewMind AI Weekly Chronicles - August'25-Week II
Assigned Numbers - 2025 - Bluetooth® Document
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Spectroscopy.pptx food analysis technology
A Presentation on Artificial Intelligence
Review of recent advances in non-invasive hemoglobin estimation
“AI and Expert System Decision Support & Business Intelligence Systems”
Empathic Computing: Creating Shared Understanding
Digital-Transformation-Roadmap-for-Companies.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
MYSQL Presentation for SQL database connectivity
Advanced methodologies resolving dimensionality complications for autism neur...
Programs and apps: productivity, graphics, security and other tools
Teaching material agriculture food technology

F9 Microkernel code reading part 2 scheduling

  • 1. Part  2  :  Code  Reading   of   F9  Microkernel   Scheduling   ben6   2013-­‐11-­‐18  
  • 2. F9   Agenda   •  Brief  of  F9  Microkernel  Scheduling   •  All  about  Algorithms   •  Scheduling  Code  reading  
  • 3. F9   Agenda   •  Brief  of  F9  Microkernel  Scheduling   •  All  about  Algorithms   •  Scheduling  Code  reading  
  • 4. F9  Microkernel  Overview   •  an  experimental  microkernel  used  to  construct   flexible  embedded  systems  inspired  by  famous  L4   microkernel.     •  The  moMvaMon  of  F9  microkernel  is  to  deploy   modern  kernel  techniques  to  support     –  running  real-­‐Mme  and  Mme-­‐sharing  applicaMons  (ex:     wireless  communicaMons)  for  ARM  Cortex-­‐M  series   microprocessors  with  efficiency  (performance  +   power  consumpMon)     –  security  (memory  protecMon  +  isolated  execuMon)  
  • 5. CharacterisMcs   •  Energy  efficient  scheduling   •  Tickless  Mmer  
  • 6. Mckless  scheduler   •  F9  implements  a  Mckless  scheduler  which  implies   the  dynamic  Mmer.   •  You  can  track  the  development  here:     hWps://github.com/southernbear/RIOT/wiki/ Development   •  F9  follows  some  concepts  about  TiROS  for   Mckless:          hWp://Mros.sourceforge.net/
  • 7. F9   Agenda   •  Brief  of  F9  Microkernel  Scheduling   •  All  about  Algorithms   •  Scheduling  Code  reading  
  • 8. Tickless  Scheduling •  Reference  concept  of  TiROS   •  TiROS  avoids  most  context-­‐switching   overhead  costs  by  eliminaMng  periodic  Mcks.   •  Most  embedded  real-­‐Mme  OSes,  a  trade  off   between  high  Mme-­‐resoluMon  (by  increasing   Mck  frequency)  and  overhead.   •  TiROS  does  not  use  Mcks  and  achieves  high-­‐ Mme  resoluMon  with  very  low  overhead.
  • 9. F9   Agenda   •  Brief  of  F9  Microkernel  Scheduling   •  All  about  Algorithms   •  Scheduling  Code  reading  
  • 10. Scheduling  related  code   •  •  •  •  •  •  •  ipc.c   kMmer.c   sched.c          (most  important)   so]irq.c   syscall.c   systhread.c   thread.c  
  • 11. KMmer_handler   Timer  handler  in  ISR   vector  table  
  • 12. kMmer_handler   Hardware  interrupt   trigger  ktmer_handler  
  • 13. Plaborm/irq.h:  schedule_in_irq   Trigger  point  of   scheduling  which  while   IRQ  event  occurs   include/plaborm/irq.h  
  • 16. Scheduler  slots •  sched.h sched.h    26  typedef  struct  sched_slot  {    27          tcb_t  *ss_scheduled;    28          sched_handler_t  ss_handler;    29  }  sched_slot_t;   sched_slot_t   ss_scheduled   ss_handler Priority  in  order  
  • 17. Schedule  handler   typedef  tcb_t  *(*sched_handler_t)(struct  sched_slot  *slot);  
  • 18. Select  target  thread   ss_handler  is  used   while  currnt  slot   thread  is  empty  or   not  runnable  
  • 19. thread_state_t   Only  scheduling  for  T_RUNNABLE  State  
  • 20. Thread  control  block   TCB  using  by  schedule  slots  
  • 21. __NAKED   •  __aWribute__((naked))   Using  While  IRQ  funcMon   Use  this  aWribute  on  the  ARM,  AVR,  MCORE,  MSP430,  NDS32,  RL78,  RX  and  SPU   ports  to  indicate  that  the  specified  funcMon  does  not  need  prologue/epilogue   sequences  generated  by  the  compiler.       It  is  up  to  the  programmer  to  provide  these  sequences.       The  only  statements  that  can  be  safely  included  in  naked  funcMons  are  asm   statements  that  do  not  have  operands.       All  other  statements,  including  declaraMons  of  local  variables,  if  statements,  and  so   forth,  should  be  avoided.  Naked  funcMons  should  be  used  to  implement  the  body  of   an  assembly  funcMon,  while  allowing  the  compiler  to  construct  the  requisite   funcMon  declaraMon  for  the  assembler.    
  • 25. Conclusion   •  F9  Microkernel  uses  following  concepts   –  Tickless  Scheduling   –  Dynamic  Timer   To  archive  energy  efficiency  scheduling  
  • 27. Kernel  line  of  code  for  reading   Kernel  C  code  line:  2183   Git  head:  4d87f204252d57525f9cd93f163ca5225cc34bb7  
  • 28. References   •  F9  Microkernel  source  code  and  introducMon   •  hWps://github.com/southernbear/RIOT/wiki/Development   •  TiROS  for  Mckless  hWp://Mros.sourceforge.net/   •  GCC  Naked  AWribute