1 / 7

Embedded Xinu Kernel Programming

Embedded Xinu Kernel Programming. bina@buffalo.edu University at Buffalo. Topics. Creating a task/thread Ready/adding to the queue Resched /no rescheduling Semaphores of synchronization and mutual exclusion Memory operation errors including memory leak. Memory leaks etc.

Download Presentation

Embedded Xinu Kernel Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Embedded Xinu Kernel Programming bina@buffalo.edu University at Buffalo Amrita-UB-MSES-2013-13

  2. Topics Creating a task/thread Ready/adding to the queue Resched/no rescheduling Semaphores of synchronization and mutual exclusion Memory operation errors including memory leak Amrita-UB-MSES-2013-13

  3. Memory leaks etc. See http://www.ibm.com/developerworks/aix/library/au-toughgame/ IBM developer works is good source of valuable information Good practices while working with small footprint systems Though there are tools available to detect most of these, it is always good to know the best practices in any technology and field Amrita-UB-MSES-2013-13

  4. Known Pitfalls • These are some of the prominent pitfalls while working with memory at low level • Uninitialized memory char *p = malloc (10); memset(p,’\0’,10); • Memory overwrite char *name = (char *) malloc(11); // Assign some value to name memcpy ( p,name,11); • Memory overead char *ptr = (char *)malloc(10); char name[20] ; memcpy( name,ptr,20); Amrita-UB-MSES-2013-13

  5. Known Pitfalls (contd.) • Memory leak: reassignment char *memoryArea = malloc(10); char *newArea = malloc(10); memoryArea = newArea; • Memory leak: freeing the parent area first free(memoryArea); //wrong //correct method is given below free( memoryArea->newArea); free(memoryArea); Amrita-UB-MSES-2013-13

  6. Known Pitfalls (contd.) • Improper handling of return functions char *func ( ) { return malloc(20); // make sure to memset this location to ‘\0’… } void callingFunc ( ) { func( ); // Problem lies here } Amrita-UB-MSES-2013-13

  7. Summary We discussed some things to pay attention to when designing systems at low level and deal with dynamic memory management. This is especially critical for small embedded systems with limited memory. Memory leaks are serious problem resulting in dramatic system slow down at runtime. Amrita-UB-MSES-2013-13

More Related