SlideShare ist ein Scribd-Unternehmen logo
1 von 56
Microkernel development: from project to implementation Rodrigo Maximiano Antunes de Almeida E-mail: rmaalmeida@gmail.com Twitter: @rmaalmeida Universidade Federal de Itajubá
Creative Commons License The work ” Microkernel development: from project to implementation ” of Rodrigo Maximiano Antunes de Almeida was licensed with  Creative Commons 3.0 – Attribution – Non Commercial – Share Alike license . Additional permission can be given by the author through direct contact using the e-mail: rmaalmeida@gmail.com
[object Object],[object Object]
//today topics ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object]
kernel_project ( 1 );
kernel_project ( 1 ); ,[object Object],[object Object],[object Object],[object Object]
kernel_project ( 1 ); ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
kernel_project ( 1 ); ,[object Object],[object Object]
kernel_project ( 1 ); ,[object Object],[object Object],[object Object],[object Object]
kernel_project ( 1 ); ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object]
concepts ( 2 ); ,[object Object]
concepts ( 2 ); ,[object Object],[object Object],[object Object],[object Object],[object Object]
concepts ( 2 ); //defining the type pointerTest //it is a pointer to function that: //  receives no parameter //  returns no parameter typedef   void   (* pointerTest )(void); //Function to be called void  nop  (void){  __asm NOP __endasm  } //creating an pointerTest variable; pointerTest   foo ; foo   =   nop ; (* foo )();  //calling the function via pointer
concepts ( 2 ); temporal_conditions ( 2.2 );
concepts ( 2 ); In the majority part of embedded systems, we need to guarantee that a function will be executed in a certain frequency. Some systems may even fail if these deadlines are not met.
concepts ( 2 ); ,[object Object],[object Object],[object Object],[object Object]
concepts ( 2 ); ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
concepts ( 2 ); ,[object Object],[object Object],[object Object]
concepts ( 2 ); ,[object Object]
concepts ( 2 ); ,[object Object],[object Object]
concepts ( 2 ); ,[object Object],[object Object],[object Object],[object Object],[object Object]
concepts ( 2 ); void_pointers ( 2.3 );
concepts ( 2 ); ,[object Object],[object Object],[object Object],[object Object]
concepts ( 2 ); char   * name   =   "Paulo" ; double   weight   =   87.5 ; unsigned   int   children   =   3 ; void   main   (void){ //its not printf, yet. print ( 0 ,   & name ); print ( 1 ,   & weight ); print ( 2 ,   & children ); }
concepts ( 2 ); void  print (int  option ; void * parameter ){ switch( option ){ case  0 : printf ( "%s" ,(char*) parameter ); break; case  1 : printf ( "%f" ,*((double*) parameter )); break; case  2 : printf ( "%d" ,*((unsigned int*) parameter )); break; } }
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
microkernel ( 3 ); init_kernel ( 3.0 );
microkernel ( 3 ); ,[object Object],[object Object],[object Object]
microkernel ( 3 ); //CONFIG.H code char at   0x300000   CONFIG1L   =   0x01 ;   // No prescaler used code char at   0x300001   CONFIG1H   =   0x0C ;   // HS: High Speed Cristal code char at   0x300003   CONFIG2H   =   0x00 ;   // Disabled-Controlled by SWDTEN bit  code char at   0x300006   CONFIG4L   =   0x00 ;   // Disabled low voltage programming //INT.H void   InicializaInterrupt (void); //TIMER.H char   FimTimer (void); void   AguardaTimer (void); void   ResetaTimer (unsigned   int   tempo ); void   InicializaTimer (void); //BASICO.H (only part of it) #define   SUCCESS   0 #define   FAIL   1 #define   REPEAT   2 //bit functions #define   BitFlp ( arg , bit )   (( arg )   ^=   ( 1 << bit ))   //special register information #define   PORTD   (*(volatile __near   unsigned   char*) 0xF83 ) #define   TRISC   (*(volatile   __near   unsigned   char*) 0xF94 )
microkernel ( 3 ); //first implementation kernel_example ( 3 + 1 / 10 );
microkernel ( 3 ); ,[object Object],[object Object],[object Object],//pointer function declaration typedef   void(* ptrFunc )(void); //process pool static   ptrFunc   pool [ 4 ];
microkernel ( 3 ); ,[object Object],void   tst1 (void){ printf ( &quot;Process 1&quot; ); } void   tst2 (void){ printf ( &quot;Process 2&quot; ); } void   tst3 (void){ printf ( &quot;Process 3&quot; ); }
microkernel ( 3 ); ,[object Object],[object Object],[object Object],[object Object],//kernel internal variables ptrFunc   pool [ 4 ]; int   end ; //kernel function's prototypes void   kernelInit (void); void   kernelAddProc (ptrFunc   newFunc ); void   kernelLoop (void);
microkernel ( 3 ); //kernel function's implementation void  kernelInit (void){ end  =  0 ; } void  kernelAddProc (ptrFunc  newFunc ){ if ( end  < 4 ){ pool [ end ] =  newFunc ; end ++; } }
microkernel ( 3 ); //kernel function's implementatio n void  kernelLoop (void){ int  i ; for(;;){ //cycle through the processes for( i = 0 ;  i < end ;  i ++){ (* pool [ i ])(); } } }
microkernel ( 3 ); //main loop void  main (void){ kernelInit (); kernelAddProc ( tst1 ); kernelAddProc ( tst2 ); kernelAddProc ( tst3 ); kernelLoop (); }
microkernel ( 3 ); ,[object Object]
microkernel ( 3 ); //second implementation //circular buffer and struct added kernel_example ( 3 + 2 / 10 );
microkernel ( 3 ); ,[object Object],[object Object],[object Object],[object Object],[object Object]
microkernel ( 3 ); //return code #define   SUCCESS   0 #define   FAIL   1 #define   REPEAT   2 //function pointer declaration typedef   char(* ptrFunc )(void); //process struct typedef   struct   { ptrFunc   function ; }   process ; process  pool [ POOL_SIZE ];
microkernel ( 3 ); char  kernelInit (void){ start  =  0 ; end  =  0 ; return  SUCCESS ; } char   kernelAddProc (process   newProc ){ //checking for free space if   (   (( end + 1 )% POOL_SIZE )   !=   start ){ pool [ end ]   =   newProc ; end   =   ( end + 1 )% POOL_SIZE ; return   SUCCESS ; } return   FAIL ; }
microkernel ( 3 ); void   kernelLoop (void){ int   i = 0 ; for(;;){ //Do we have any process to execute? if   ( start   !=   end ){ printf ( &quot;Ite. %d, Slot. %d: &quot; ,   i ,   start ); //check if there is need to reschedule if   ((*( pool [ start ]. Func ))()   ==   REPEAT ){ kernelAddProc ( pool [ start ]); } //prepare to get the next process;   start   =   ( start + 1 )% POOL_SIZE ; i ++;   // only for debug; } } }
microkernel ( 3 ); //vector of structs process  pool [ POOL_SIZE ]; //  pool[i] //  pool[i].func //  *(pool[i].func) // (*(pool[i].func))() //vetor of pointers for struct process*  pool [ POOL_SIZE ]; //  pool[i] //  pool[i].func //  pool[i]->func //  pool[i]->func()
microkernel ( 3 ); void   kernelLoop (void){ int   i = 0 ; for(;;){ //Do we have any process to execute? if   ( start   !=   end ){ printf ( &quot;Ite. %d, Slot. %d: &quot; ,   i ,   start ); //check if there is need to reschedule if   ( pool [ start ]-> Func ()   ==   REPEAT ){ kernelAddProc ( pool [ start ]); } //prepare to get the next process;   start   =   ( start + 1 )% POOL_SIZE ; i ++;   // only for debug; } } }
microkernel ( 3 ); ,[object Object],void   tst1 (void){ printf ( &quot;Process 1&quot; ); return   REPEAT ; } void   tst2 (void){ printf ( &quot;Process 2&quot; ); return   SUCCESS ; } void   tst3 (void){ printf ( &quot;Process 3&quot; ); return   REPEAT ; }
microkernel ( 3 ); void   main (void){ //declaring the processes process   p1   =   { tst1 }; process   p2   =   { tst2 }; process   p3   =   { tst3 }; kernelInit (); //Test if the process was added successfully if   ( kernelAddProc ( p1 )   ==   SUCCESS ){ printf ( &quot;1st process added&quot; );} if   ( kernelAddProc ( p2 )   ==   SUCCESS ){ printf ( &quot;2nd process added&quot; );} if   ( kernelAddProc ( p3 )   ==   SUCCESS ){ printf ( &quot;3rd process added&quot; );} kernelLoop (); }
microkernel ( 3 ); ,[object Object],[object Object],[object Object],Console Output: --------------------------- 1st process added 2nd process added 3rd process added Ite. 0, Slot. 0: Process 1 Ite. 1, Slot. 1: Process 2 Ite. 2, Slot. 2: Process 3 Ite. 3, Slot. 3: Process 1 Ite. 4, Slot. 0: Process 3 Ite. 5, Slot. 1: Process 1 Ite. 6, Slot. 2: Process 3 Ite. 7, Slot. 3: Process 1 Ite. 8, Slot. 0: Process 3 ... ---------------------------
microkernel ( 3 ); ,[object Object],[object Object],[object Object]
microkernel ( 3 ); ,[object Object],//process struct typedef   struct   { ptrFunc   function ; int   period ; int   start ; }   process ;
microkernel ( 3 ); ,[object Object],void   isr (void)  interrupt   1 { unsigned   char   i ; i   =   ini ; while( i != fim ){ if(( pool [ i ]. start )>( MIN_INT )){ pool [ i ]. start --; } i   =   ( i + 1 )% SLOT_SIZE ; } }
microkernel ( 3 ); ,[object Object],char   AddProc (process   newProc ){ //checking for free space if   (   (( end + 1 )% SLOT_SIZE )   !=   start ){ pool [ end ]   =   newProc ; //increment start timer with period pool [ end ]. start   +=   newProc . period ; end   =   ( end + 1 )% SLOT_SIZE ; return   SUCCESS ; } return   FAIL ; }
microkernel ( 3 ); if   ( start   !=   end ){ //Finding the process with the smallest start j   =   ( start + 1 )% SLOT _ SIZE ; next   =   start ; while ( j != end ){ if   ( pool [ j ]. start   <   pool [ next ]. start ){ next   =   j ; } j   =   ( j + 1 )% SLOT_SIZE ; } //exchanging positions in the pool tempProc   =   pool [ next ]; pool [ next ]   =   pool [ start ]; pool [ start ]   =   tempProc ; while( pool [ start ]. start > 0 ){ } //great place to use low power mode if   (   (*( pool [ ini ]. function ))()   ==   REPEAT   ){ AddProc (&( vetProc [ ini ])); } ini   =   ( ini + 1 )% SLOT_SIZE ; }
//today topics ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
“ Don't Reinvent The Wheel, Unless You Plan on Learning More About Wheels” Jeff Atwood Microkernel development: from project to implementation Rodrigo Maximiano Antunes de Almeida E-mail: rmaalmeida@gmail.com Twitter: @rmaalmeida Universidade Federal de Itajubá

Weitere ähnliche Inhalte

Was ist angesagt?

LLVM Register Allocation
LLVM Register AllocationLLVM Register Allocation
LLVM Register AllocationWang Hsiangkai
 
Protocol handler in Gecko
Protocol handler in GeckoProtocol handler in Gecko
Protocol handler in GeckoChih-Hsuan Kuo
 
Operating Systems - Process Synchronization and Deadlocks
Operating Systems - Process Synchronization and DeadlocksOperating Systems - Process Synchronization and Deadlocks
Operating Systems - Process Synchronization and DeadlocksMukesh Chinta
 
Ownership System in Rust
Ownership System in RustOwnership System in Rust
Ownership System in RustChih-Hsuan Kuo
 
grsecurity and PaX
grsecurity and PaXgrsecurity and PaX
grsecurity and PaXKernel TLV
 
CSharp for Unity Day2
CSharp for Unity Day2CSharp for Unity Day2
CSharp for Unity Day2Duong Thanh
 
Contiki introduction I.
Contiki introduction I.Contiki introduction I.
Contiki introduction I.Dingxin Xu
 
Global Interpreter Lock: Episode I - Break the Seal
Global Interpreter Lock: Episode I - Break the SealGlobal Interpreter Lock: Episode I - Break the Seal
Global Interpreter Lock: Episode I - Break the SealTzung-Bi Shih
 
Java util concurrent
Java util concurrentJava util concurrent
Java util concurrentRoger Xia
 
Effective Modern C++ - Item 35 & 36
Effective Modern C++ - Item 35 & 36Effective Modern C++ - Item 35 & 36
Effective Modern C++ - Item 35 & 36Chih-Hsuan Kuo
 
Process Synchronization
Process SynchronizationProcess Synchronization
Process Synchronizationvinay arora
 
Instruction Combine in LLVM
Instruction Combine in LLVMInstruction Combine in LLVM
Instruction Combine in LLVMWang Hsiangkai
 
Semaphores OS Basics
Semaphores OS BasicsSemaphores OS Basics
Semaphores OS BasicsShijin Raj P
 
The Ring programming language version 1.8 book - Part 88 of 202
The Ring programming language version 1.8 book - Part 88 of 202The Ring programming language version 1.8 book - Part 88 of 202
The Ring programming language version 1.8 book - Part 88 of 202Mahmoud Samir Fayed
 
Concurrency Concepts in Java
Concurrency Concepts in JavaConcurrency Concepts in Java
Concurrency Concepts in JavaDoug Hawkins
 
Exploiting the Linux Kernel via Intel's SYSRET Implementation
Exploiting the Linux Kernel via Intel's SYSRET ImplementationExploiting the Linux Kernel via Intel's SYSRET Implementation
Exploiting the Linux Kernel via Intel's SYSRET Implementationnkslides
 

Was ist angesagt? (20)

LLVM Register Allocation
LLVM Register AllocationLLVM Register Allocation
LLVM Register Allocation
 
OSCh7
OSCh7OSCh7
OSCh7
 
Protocol handler in Gecko
Protocol handler in GeckoProtocol handler in Gecko
Protocol handler in Gecko
 
Machine Trace Metrics
Machine Trace MetricsMachine Trace Metrics
Machine Trace Metrics
 
6 Synchronisation
6 Synchronisation6 Synchronisation
6 Synchronisation
 
Operating Systems - Process Synchronization and Deadlocks
Operating Systems - Process Synchronization and DeadlocksOperating Systems - Process Synchronization and Deadlocks
Operating Systems - Process Synchronization and Deadlocks
 
Ownership System in Rust
Ownership System in RustOwnership System in Rust
Ownership System in Rust
 
grsecurity and PaX
grsecurity and PaXgrsecurity and PaX
grsecurity and PaX
 
CSharp for Unity Day2
CSharp for Unity Day2CSharp for Unity Day2
CSharp for Unity Day2
 
Contiki introduction I.
Contiki introduction I.Contiki introduction I.
Contiki introduction I.
 
Global Interpreter Lock: Episode I - Break the Seal
Global Interpreter Lock: Episode I - Break the SealGlobal Interpreter Lock: Episode I - Break the Seal
Global Interpreter Lock: Episode I - Break the Seal
 
Java util concurrent
Java util concurrentJava util concurrent
Java util concurrent
 
Effective Modern C++ - Item 35 & 36
Effective Modern C++ - Item 35 & 36Effective Modern C++ - Item 35 & 36
Effective Modern C++ - Item 35 & 36
 
Monitors
MonitorsMonitors
Monitors
 
Process Synchronization
Process SynchronizationProcess Synchronization
Process Synchronization
 
Instruction Combine in LLVM
Instruction Combine in LLVMInstruction Combine in LLVM
Instruction Combine in LLVM
 
Semaphores OS Basics
Semaphores OS BasicsSemaphores OS Basics
Semaphores OS Basics
 
The Ring programming language version 1.8 book - Part 88 of 202
The Ring programming language version 1.8 book - Part 88 of 202The Ring programming language version 1.8 book - Part 88 of 202
The Ring programming language version 1.8 book - Part 88 of 202
 
Concurrency Concepts in Java
Concurrency Concepts in JavaConcurrency Concepts in Java
Concurrency Concepts in Java
 
Exploiting the Linux Kernel via Intel's SYSRET Implementation
Exploiting the Linux Kernel via Intel's SYSRET ImplementationExploiting the Linux Kernel via Intel's SYSRET Implementation
Exploiting the Linux Kernel via Intel's SYSRET Implementation
 

Ähnlich wie Microkernel Development

Contiki introduction II-from what to how
Contiki introduction II-from what to howContiki introduction II-from what to how
Contiki introduction II-from what to howDingxin Xu
 
Implementing of classical synchronization problem by using semaphores
Implementing of classical synchronization problem by using semaphoresImplementing of classical synchronization problem by using semaphores
Implementing of classical synchronization problem by using semaphoresGowtham Reddy
 
#define ENABLE_COMMANDER#define ENABLE_REPORTER#include c.docx
#define ENABLE_COMMANDER#define ENABLE_REPORTER#include c.docx#define ENABLE_COMMANDER#define ENABLE_REPORTER#include c.docx
#define ENABLE_COMMANDER#define ENABLE_REPORTER#include c.docxkatherncarlyle
 
GPU Programming on CPU - Using C++AMP
GPU Programming on CPU - Using C++AMPGPU Programming on CPU - Using C++AMP
GPU Programming on CPU - Using C++AMPMiller Lee
 
Jdk 7 4-forkjoin
Jdk 7 4-forkjoinJdk 7 4-forkjoin
Jdk 7 4-forkjoinknight1128
 
Ive posted 3 classes after the instruction that were given at star.pdf
Ive posted 3 classes after the instruction that were given at star.pdfIve posted 3 classes after the instruction that were given at star.pdf
Ive posted 3 classes after the instruction that were given at star.pdfdeepaarora22
 
The following code is an implementation of the producer consumer pro.pdf
The following code is an implementation of the producer consumer pro.pdfThe following code is an implementation of the producer consumer pro.pdf
The following code is an implementation of the producer consumer pro.pdfmarketing413921
 
finalprojtemplatev5finalprojtemplate.gitignore# Ignore the b
finalprojtemplatev5finalprojtemplate.gitignore# Ignore the bfinalprojtemplatev5finalprojtemplate.gitignore# Ignore the b
finalprojtemplatev5finalprojtemplate.gitignore# Ignore the bChereCheek752
 
Linux kernel debugging
Linux kernel debuggingLinux kernel debugging
Linux kernel debuggingJungMinSEO5
 
Linux Timer device driver
Linux Timer device driverLinux Timer device driver
Linux Timer device driver艾鍗科技
 
week3_srcDoWhileLoopFactorial.javaweek3_srcDoWhileLoopFactoria.docx
week3_srcDoWhileLoopFactorial.javaweek3_srcDoWhileLoopFactoria.docxweek3_srcDoWhileLoopFactorial.javaweek3_srcDoWhileLoopFactoria.docx
week3_srcDoWhileLoopFactorial.javaweek3_srcDoWhileLoopFactoria.docxalanfhall8953
 
Other Approaches (Concurrency)
Other Approaches (Concurrency)Other Approaches (Concurrency)
Other Approaches (Concurrency)Sri Prasanna
 
Embedded JavaScript
Embedded JavaScriptEmbedded JavaScript
Embedded JavaScriptJens Siebert
 
Instruction1. Please read the two articles. (Kincheloe part 1 &.docx
Instruction1. Please read the two articles. (Kincheloe part 1 &.docxInstruction1. Please read the two articles. (Kincheloe part 1 &.docx
Instruction1. Please read the two articles. (Kincheloe part 1 &.docxcarliotwaycave
 
Parallel Programming With Dot Net
Parallel Programming With Dot NetParallel Programming With Dot Net
Parallel Programming With Dot NetNeeraj Kaushik
 
PQTimer.java A simple driver program to run timing t.docx
  PQTimer.java     A simple driver program to run timing t.docx  PQTimer.java     A simple driver program to run timing t.docx
PQTimer.java A simple driver program to run timing t.docxjoyjonna282
 
ISCA Final Presentaiton - Compilations
ISCA Final Presentaiton -  CompilationsISCA Final Presentaiton -  Compilations
ISCA Final Presentaiton - CompilationsHSA Foundation
 
RTOS implementation
RTOS implementationRTOS implementation
RTOS implementationRajan Kumar
 

Ähnlich wie Microkernel Development (20)

Contiki introduction II-from what to how
Contiki introduction II-from what to howContiki introduction II-from what to how
Contiki introduction II-from what to how
 
Implementing of classical synchronization problem by using semaphores
Implementing of classical synchronization problem by using semaphoresImplementing of classical synchronization problem by using semaphores
Implementing of classical synchronization problem by using semaphores
 
#define ENABLE_COMMANDER#define ENABLE_REPORTER#include c.docx
#define ENABLE_COMMANDER#define ENABLE_REPORTER#include c.docx#define ENABLE_COMMANDER#define ENABLE_REPORTER#include c.docx
#define ENABLE_COMMANDER#define ENABLE_REPORTER#include c.docx
 
GPU Programming on CPU - Using C++AMP
GPU Programming on CPU - Using C++AMPGPU Programming on CPU - Using C++AMP
GPU Programming on CPU - Using C++AMP
 
Jdk 7 4-forkjoin
Jdk 7 4-forkjoinJdk 7 4-forkjoin
Jdk 7 4-forkjoin
 
Ive posted 3 classes after the instruction that were given at star.pdf
Ive posted 3 classes after the instruction that were given at star.pdfIve posted 3 classes after the instruction that were given at star.pdf
Ive posted 3 classes after the instruction that were given at star.pdf
 
The following code is an implementation of the producer consumer pro.pdf
The following code is an implementation of the producer consumer pro.pdfThe following code is an implementation of the producer consumer pro.pdf
The following code is an implementation of the producer consumer pro.pdf
 
finalprojtemplatev5finalprojtemplate.gitignore# Ignore the b
finalprojtemplatev5finalprojtemplate.gitignore# Ignore the bfinalprojtemplatev5finalprojtemplate.gitignore# Ignore the b
finalprojtemplatev5finalprojtemplate.gitignore# Ignore the b
 
Linux kernel debugging
Linux kernel debuggingLinux kernel debugging
Linux kernel debugging
 
Linux Timer device driver
Linux Timer device driverLinux Timer device driver
Linux Timer device driver
 
week3_srcDoWhileLoopFactorial.javaweek3_srcDoWhileLoopFactoria.docx
week3_srcDoWhileLoopFactorial.javaweek3_srcDoWhileLoopFactoria.docxweek3_srcDoWhileLoopFactorial.javaweek3_srcDoWhileLoopFactoria.docx
week3_srcDoWhileLoopFactorial.javaweek3_srcDoWhileLoopFactoria.docx
 
Other Approaches (Concurrency)
Other Approaches (Concurrency)Other Approaches (Concurrency)
Other Approaches (Concurrency)
 
Embedded JavaScript
Embedded JavaScriptEmbedded JavaScript
Embedded JavaScript
 
Sycl 1.2 Reference Card
Sycl 1.2 Reference CardSycl 1.2 Reference Card
Sycl 1.2 Reference Card
 
Instruction1. Please read the two articles. (Kincheloe part 1 &.docx
Instruction1. Please read the two articles. (Kincheloe part 1 &.docxInstruction1. Please read the two articles. (Kincheloe part 1 &.docx
Instruction1. Please read the two articles. (Kincheloe part 1 &.docx
 
Lec05 buffers basic_examples
Lec05 buffers basic_examplesLec05 buffers basic_examples
Lec05 buffers basic_examples
 
Parallel Programming With Dot Net
Parallel Programming With Dot NetParallel Programming With Dot Net
Parallel Programming With Dot Net
 
PQTimer.java A simple driver program to run timing t.docx
  PQTimer.java     A simple driver program to run timing t.docx  PQTimer.java     A simple driver program to run timing t.docx
PQTimer.java A simple driver program to run timing t.docx
 
ISCA Final Presentaiton - Compilations
ISCA Final Presentaiton -  CompilationsISCA Final Presentaiton -  Compilations
ISCA Final Presentaiton - Compilations
 
RTOS implementation
RTOS implementationRTOS implementation
RTOS implementation
 

Mehr von Rodrigo Almeida

Embedded systems design @ defcon 2015
Embedded systems design @ defcon 2015Embedded systems design @ defcon 2015
Embedded systems design @ defcon 2015Rodrigo Almeida
 
Embedded systems development Defcon 19
Embedded systems development Defcon 19Embedded systems development Defcon 19
Embedded systems development Defcon 19Rodrigo Almeida
 
As diferentes engenharias
As diferentes engenhariasAs diferentes engenharias
As diferentes engenhariasRodrigo Almeida
 
Testing de software en instrumentos de pesar de funcionamiento no automatico ...
Testing de software en instrumentos de pesar de funcionamiento no automatico ...Testing de software en instrumentos de pesar de funcionamiento no automatico ...
Testing de software en instrumentos de pesar de funcionamiento no automatico ...Rodrigo Almeida
 
Seguridad de sistemas embebidos para el ámbito regulado - Alejandro Bertello ...
Seguridad de sistemas embebidos para el ámbito regulado - Alejandro Bertello ...Seguridad de sistemas embebidos para el ámbito regulado - Alejandro Bertello ...
Seguridad de sistemas embebidos para el ámbito regulado - Alejandro Bertello ...Rodrigo Almeida
 
Cryptology - Antônio Lacerda
Cryptology - Antônio LacerdaCryptology - Antônio Lacerda
Cryptology - Antônio LacerdaRodrigo Almeida
 
Troca de contexto segura em sistemas operacionais embarcados utilizando de té...
Troca de contexto segura em sistemas operacionais embarcados utilizando de té...Troca de contexto segura em sistemas operacionais embarcados utilizando de té...
Troca de contexto segura em sistemas operacionais embarcados utilizando de té...Rodrigo Almeida
 
Troca de contexto segura em sistemas operacionais embarcados utilizando técni...
Troca de contexto segura em sistemas operacionais embarcados utilizando técni...Troca de contexto segura em sistemas operacionais embarcados utilizando técni...
Troca de contexto segura em sistemas operacionais embarcados utilizando técni...Rodrigo Almeida
 
Troca de contexto segura em sistemas operacionais embarcados utilizando técni...
Troca de contexto segura em sistemas operacionais embarcados utilizando técni...Troca de contexto segura em sistemas operacionais embarcados utilizando técni...
Troca de contexto segura em sistemas operacionais embarcados utilizando técni...Rodrigo Almeida
 
Projeto de uma controladora de drivers
Projeto de uma controladora de driversProjeto de uma controladora de drivers
Projeto de uma controladora de driversRodrigo Almeida
 
Desenvolvimento de drivers para sistemas embarcados
Desenvolvimento de drivers para sistemas embarcadosDesenvolvimento de drivers para sistemas embarcados
Desenvolvimento de drivers para sistemas embarcadosRodrigo Almeida
 
Kernel com requisitos temporais
Kernel com requisitos temporaisKernel com requisitos temporais
Kernel com requisitos temporaisRodrigo Almeida
 
Definição de processos
Definição de processosDefinição de processos
Definição de processosRodrigo Almeida
 
Conceitos de ponteiros struct e buffers
Conceitos de ponteiros struct e buffersConceitos de ponteiros struct e buffers
Conceitos de ponteiros struct e buffersRodrigo Almeida
 
Introdução aos sistemas operacionais embarcados
Introdução aos sistemas operacionais embarcadosIntrodução aos sistemas operacionais embarcados
Introdução aos sistemas operacionais embarcadosRodrigo Almeida
 
Segurança de sistemas: invasões, engenharia reversa e análise de virus
Segurança de sistemas: invasões, engenharia reversa e análise de virusSegurança de sistemas: invasões, engenharia reversa e análise de virus
Segurança de sistemas: invasões, engenharia reversa e análise de virusRodrigo Almeida
 
Utilizando um Display de LCD
Utilizando um Display de LCDUtilizando um Display de LCD
Utilizando um Display de LCDRodrigo Almeida
 

Mehr von Rodrigo Almeida (20)

Embedded systems design @ defcon 2015
Embedded systems design @ defcon 2015Embedded systems design @ defcon 2015
Embedded systems design @ defcon 2015
 
Embedded systems development Defcon 19
Embedded systems development Defcon 19Embedded systems development Defcon 19
Embedded systems development Defcon 19
 
As diferentes engenharias
As diferentes engenhariasAs diferentes engenharias
As diferentes engenharias
 
Testing de software en instrumentos de pesar de funcionamiento no automatico ...
Testing de software en instrumentos de pesar de funcionamiento no automatico ...Testing de software en instrumentos de pesar de funcionamiento no automatico ...
Testing de software en instrumentos de pesar de funcionamiento no automatico ...
 
Seguridad de sistemas embebidos para el ámbito regulado - Alejandro Bertello ...
Seguridad de sistemas embebidos para el ámbito regulado - Alejandro Bertello ...Seguridad de sistemas embebidos para el ámbito regulado - Alejandro Bertello ...
Seguridad de sistemas embebidos para el ámbito regulado - Alejandro Bertello ...
 
Cryptology - Antônio Lacerda
Cryptology - Antônio LacerdaCryptology - Antônio Lacerda
Cryptology - Antônio Lacerda
 
Troca de contexto segura em sistemas operacionais embarcados utilizando de té...
Troca de contexto segura em sistemas operacionais embarcados utilizando de té...Troca de contexto segura em sistemas operacionais embarcados utilizando de té...
Troca de contexto segura em sistemas operacionais embarcados utilizando de té...
 
Troca de contexto segura em sistemas operacionais embarcados utilizando técni...
Troca de contexto segura em sistemas operacionais embarcados utilizando técni...Troca de contexto segura em sistemas operacionais embarcados utilizando técni...
Troca de contexto segura em sistemas operacionais embarcados utilizando técni...
 
Troca de contexto segura em sistemas operacionais embarcados utilizando técni...
Troca de contexto segura em sistemas operacionais embarcados utilizando técni...Troca de contexto segura em sistemas operacionais embarcados utilizando técni...
Troca de contexto segura em sistemas operacionais embarcados utilizando técni...
 
Projeto de uma controladora de drivers
Projeto de uma controladora de driversProjeto de uma controladora de drivers
Projeto de uma controladora de drivers
 
Desenvolvimento de drivers para sistemas embarcados
Desenvolvimento de drivers para sistemas embarcadosDesenvolvimento de drivers para sistemas embarcados
Desenvolvimento de drivers para sistemas embarcados
 
Kernel com requisitos temporais
Kernel com requisitos temporaisKernel com requisitos temporais
Kernel com requisitos temporais
 
Kernel cooperativo
Kernel cooperativoKernel cooperativo
Kernel cooperativo
 
Definição de processos
Definição de processosDefinição de processos
Definição de processos
 
Ponteiros de Função
Ponteiros de FunçãoPonteiros de Função
Ponteiros de Função
 
Conceitos de ponteiros struct e buffers
Conceitos de ponteiros struct e buffersConceitos de ponteiros struct e buffers
Conceitos de ponteiros struct e buffers
 
Introdução aos sistemas operacionais embarcados
Introdução aos sistemas operacionais embarcadosIntrodução aos sistemas operacionais embarcados
Introdução aos sistemas operacionais embarcados
 
Segurança de sistemas: invasões, engenharia reversa e análise de virus
Segurança de sistemas: invasões, engenharia reversa e análise de virusSegurança de sistemas: invasões, engenharia reversa e análise de virus
Segurança de sistemas: invasões, engenharia reversa e análise de virus
 
Comunicação serial
Comunicação serialComunicação serial
Comunicação serial
 
Utilizando um Display de LCD
Utilizando um Display de LCDUtilizando um Display de LCD
Utilizando um Display de LCD
 

Kürzlich hochgeladen

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 

Kürzlich hochgeladen (20)

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 

Microkernel Development

  • 1. Microkernel development: from project to implementation Rodrigo Maximiano Antunes de Almeida E-mail: rmaalmeida@gmail.com Twitter: @rmaalmeida Universidade Federal de Itajubá
  • 2. Creative Commons License The work ” Microkernel development: from project to implementation ” of Rodrigo Maximiano Antunes de Almeida was licensed with Creative Commons 3.0 – Attribution – Non Commercial – Share Alike license . Additional permission can be given by the author through direct contact using the e-mail: rmaalmeida@gmail.com
  • 3.
  • 4.
  • 5.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15. concepts ( 2 ); //defining the type pointerTest //it is a pointer to function that: // receives no parameter // returns no parameter typedef void (* pointerTest )(void); //Function to be called void nop (void){ __asm NOP __endasm } //creating an pointerTest variable; pointerTest foo ; foo = nop ; (* foo )(); //calling the function via pointer
  • 16. concepts ( 2 ); temporal_conditions ( 2.2 );
  • 17. concepts ( 2 ); In the majority part of embedded systems, we need to guarantee that a function will be executed in a certain frequency. Some systems may even fail if these deadlines are not met.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24. concepts ( 2 ); void_pointers ( 2.3 );
  • 25.
  • 26. concepts ( 2 ); char * name = &quot;Paulo&quot; ; double weight = 87.5 ; unsigned int children = 3 ; void main (void){ //its not printf, yet. print ( 0 , & name ); print ( 1 , & weight ); print ( 2 , & children ); }
  • 27. concepts ( 2 ); void print (int option ; void * parameter ){ switch( option ){ case 0 : printf ( &quot;%s&quot; ,(char*) parameter ); break; case 1 : printf ( &quot;%f&quot; ,*((double*) parameter )); break; case 2 : printf ( &quot;%d&quot; ,*((unsigned int*) parameter )); break; } }
  • 28.
  • 29. microkernel ( 3 ); init_kernel ( 3.0 );
  • 30.
  • 31. microkernel ( 3 ); //CONFIG.H code char at 0x300000 CONFIG1L = 0x01 ; // No prescaler used code char at 0x300001 CONFIG1H = 0x0C ; // HS: High Speed Cristal code char at 0x300003 CONFIG2H = 0x00 ; // Disabled-Controlled by SWDTEN bit code char at 0x300006 CONFIG4L = 0x00 ; // Disabled low voltage programming //INT.H void InicializaInterrupt (void); //TIMER.H char FimTimer (void); void AguardaTimer (void); void ResetaTimer (unsigned int tempo ); void InicializaTimer (void); //BASICO.H (only part of it) #define SUCCESS 0 #define FAIL 1 #define REPEAT 2 //bit functions #define BitFlp ( arg , bit ) (( arg ) ^= ( 1 << bit )) //special register information #define PORTD (*(volatile __near unsigned char*) 0xF83 ) #define TRISC (*(volatile __near unsigned char*) 0xF94 )
  • 32. microkernel ( 3 ); //first implementation kernel_example ( 3 + 1 / 10 );
  • 33.
  • 34.
  • 35.
  • 36. microkernel ( 3 ); //kernel function's implementation void kernelInit (void){ end = 0 ; } void kernelAddProc (ptrFunc newFunc ){ if ( end < 4 ){ pool [ end ] = newFunc ; end ++; } }
  • 37. microkernel ( 3 ); //kernel function's implementatio n void kernelLoop (void){ int i ; for(;;){ //cycle through the processes for( i = 0 ; i < end ; i ++){ (* pool [ i ])(); } } }
  • 38. microkernel ( 3 ); //main loop void main (void){ kernelInit (); kernelAddProc ( tst1 ); kernelAddProc ( tst2 ); kernelAddProc ( tst3 ); kernelLoop (); }
  • 39.
  • 40. microkernel ( 3 ); //second implementation //circular buffer and struct added kernel_example ( 3 + 2 / 10 );
  • 41.
  • 42. microkernel ( 3 ); //return code #define SUCCESS 0 #define FAIL 1 #define REPEAT 2 //function pointer declaration typedef char(* ptrFunc )(void); //process struct typedef struct { ptrFunc function ; } process ; process pool [ POOL_SIZE ];
  • 43. microkernel ( 3 ); char kernelInit (void){ start = 0 ; end = 0 ; return SUCCESS ; } char kernelAddProc (process newProc ){ //checking for free space if ( (( end + 1 )% POOL_SIZE ) != start ){ pool [ end ] = newProc ; end = ( end + 1 )% POOL_SIZE ; return SUCCESS ; } return FAIL ; }
  • 44. microkernel ( 3 ); void kernelLoop (void){ int i = 0 ; for(;;){ //Do we have any process to execute? if ( start != end ){ printf ( &quot;Ite. %d, Slot. %d: &quot; , i , start ); //check if there is need to reschedule if ((*( pool [ start ]. Func ))() == REPEAT ){ kernelAddProc ( pool [ start ]); } //prepare to get the next process; start = ( start + 1 )% POOL_SIZE ; i ++; // only for debug; } } }
  • 45. microkernel ( 3 ); //vector of structs process pool [ POOL_SIZE ]; // pool[i] // pool[i].func // *(pool[i].func) // (*(pool[i].func))() //vetor of pointers for struct process* pool [ POOL_SIZE ]; // pool[i] // pool[i].func // pool[i]->func // pool[i]->func()
  • 46. microkernel ( 3 ); void kernelLoop (void){ int i = 0 ; for(;;){ //Do we have any process to execute? if ( start != end ){ printf ( &quot;Ite. %d, Slot. %d: &quot; , i , start ); //check if there is need to reschedule if ( pool [ start ]-> Func () == REPEAT ){ kernelAddProc ( pool [ start ]); } //prepare to get the next process; start = ( start + 1 )% POOL_SIZE ; i ++; // only for debug; } } }
  • 47.
  • 48. microkernel ( 3 ); void main (void){ //declaring the processes process p1 = { tst1 }; process p2 = { tst2 }; process p3 = { tst3 }; kernelInit (); //Test if the process was added successfully if ( kernelAddProc ( p1 ) == SUCCESS ){ printf ( &quot;1st process added&quot; );} if ( kernelAddProc ( p2 ) == SUCCESS ){ printf ( &quot;2nd process added&quot; );} if ( kernelAddProc ( p3 ) == SUCCESS ){ printf ( &quot;3rd process added&quot; );} kernelLoop (); }
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54. microkernel ( 3 ); if ( start != end ){ //Finding the process with the smallest start j = ( start + 1 )% SLOT _ SIZE ; next = start ; while ( j != end ){ if ( pool [ j ]. start < pool [ next ]. start ){ next = j ; } j = ( j + 1 )% SLOT_SIZE ; } //exchanging positions in the pool tempProc = pool [ next ]; pool [ next ] = pool [ start ]; pool [ start ] = tempProc ; while( pool [ start ]. start > 0 ){ } //great place to use low power mode if ( (*( pool [ ini ]. function ))() == REPEAT ){ AddProc (&( vetProc [ ini ])); } ini = ( ini + 1 )% SLOT_SIZE ; }
  • 55.
  • 56. “ Don't Reinvent The Wheel, Unless You Plan on Learning More About Wheels” Jeff Atwood Microkernel development: from project to implementation Rodrigo Maximiano Antunes de Almeida E-mail: rmaalmeida@gmail.com Twitter: @rmaalmeida Universidade Federal de Itajubá