⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unlimited.txt

📁 RTEMS (Real-Time Executive for Multiprocessor Systems) is a free open source real-time operating sys
💻 TXT
📖 第 1 页 / 共 2 页
字号:
    unsigned32 allocation_size -          When auto_extend is true, it is the value in the Configuration      table and is the number of objects the object's information      tables are extended or shrunk.   unsigned32 size -         The size of the object. It is used to calculate the size of      memory required to be allocated when extending the table.   unsigned32 inactive -         The number of elements on the Inactive chain.   unsigned32 *inactive_per_block -         Pointer to a table of counts of the inactive objects from a      block on the Inactive chain. It is used to know which blocks are      all free and therefore can be returned to the heap.   void **object_blocks -         Pointer to a table of pointers to the object data. The table      holds the pointer used to return a block to the heap when      shrinking the object's information tables.o Changes to Existing Object Functions  Two functions prototypes are added. They are :   _Objects_Extend_information,   _Objects_Shrink_information   _Object_Allocate, and    _Object_Free  The last were inlined, how-ever now they are not as they are too  complex to implement as macros now.o Object Inline and Macro Changes  The functions :   _Object_Allocate, and    _Object_Free  are now not inlined. The function :   _Objects_Get_local_object, and   _Objects_Set_local_object  have been added. There was no provided interface to allow an API to  get/set an objects local pointer given an index. The POSIX code  should be updated to use this interface.  The function :   _Objects_Get_information  has been moved to be an inline function. It is used in the get  object call which the API uses for every object reference.o Object Initialisation  The function _Objects_Initialize_information has been changed to  initialisation of the information structure's fields then call the  new function _Objects_Extend_information.    The first block of objects is always allocated and never  released. This means with the auto-extend flag set to true the user  still sees the same behaviour expected without this change. That is  the number objects specified in the Configuration table is the  number of object allocated during RTEMS initialisation. If not  enough memory is found during this initial extend a fatal error  occurs. The fatal error only occurs for this case of extending the  object's information tables.o Object Information Extend  The _Object_Information_Extend is a new function. It takes some of  the code form the old _Object_Initialize_information function. The  function extends an object's information base.  Extending the first time is a special case. The function assumes the  maximum index will be less than the minimum index. This means the  minimum index must be greater than 0 at initialisation. The other  special case made is coping the tables from the old location to the  new location. The first block case is trapped and tables are  initialised instead. Workspace allocation for the first block is  tested for an if the first block the allocate or fatal error call is  made. This traps an RTEMS initialise allocation error.  The remainder of the code deals with all cases of extending the  object's information.  The current block count is first determined, then a scan of the  object_block table is made to locate a free slot. Blocks can be  freed in any order. The index base for the block is also determined.  If the index base is greater than the maximum index, the tables must  grow. To grow the tables, a new larger memory block is allocated and  the tables copied. The object's information structure is then  updated to point to the new tables. The tables are allocated in one  memory block from the work-space heap. The single block is then  broken down in the required tables.  Once the tables are copied, and the new extended parts initialised  the table pointers in the object's information structure are  updated. This is protected by masking interrupts.  The old table's memory block is returned to the heap.  The names table and object is allocated. This again is a single  block which is divided.  The objects are initialised onto a local Inactive chain. They are  then copied to the object's Inactive chain to complete the  initialisation.o Object Informtation Shrink  The _Object_Shrink_information function is new. It is required to  scan all the blocks to see which one has no objects allocated. The  last object freed might not belong to a block which is completely  free.  Once a block is located, the Inactive chain is interated down  looking for objects which belong to the block of object being  released.  Once the Inactive chain scan is complete the names table and object  memory is returned to the work-space heap and the table references cleared.  XXX - I am not sure if this should occur if better protection or  different code to provide better protection.  The information tables do not change size. Once extended they never  shrink.o Object Allocation  The _Objects_Allocate attempts to get an object from the Inactive  chain. If auto-extend mode is not enabled no further processing  occurs. The extra overhead for this implemetation is the function is  not inlined and check of a boolean occurs. It should effect the  timing figures.  If auto-extend is enabled, a further check is made to see if the get  from the Inactive chain suceeded in getting an object. If it failed  a call is made to extend the object's information tables.  The get from the Inactive chain is retried. The result of this is  returned to the user. A failure here is the users problem.o Object Free  The _Objects_Free puts the object back onto the Inactive  chain. Again if auto-extend mode is not enabled no further  processing occurs and performance overhead will low.  If auto-extend mode is enabled, a check is to see if the number of  Inactive objects is one and a half times the allocation size. If  there are that many free objects an attempt is made to shrink the  object's information.o Object Index and the Get Function  The existing code allocates the number of object specified in the  configuration table, how-ever it makes the local_table have one more  element. This is the slot for an id of 0. The 0 slot is always a  NULL providing a simple check for a 0 id for object classes.  The existing _Objects_Get code removes the minimum id, which I think  could only be 1 from the index, then adds one for the 0 slot.  This change removes this index adjustment code in _Objects_Get.  The extend information starts the index count when scanning for free  blocks at the minumun index. This means the base index for a block  will always be adjusted by the minimum index. The extend information  function only ever allocates the allocation size of  objects. Finially the object's local_table size is the maximum plus  the minumum index size. The maximum is really the maximum index.  This means the values in the object's information structure and  tables do not need the index adjustments which existed before.o The Test  A new sample test, unlimited is provided. It attempts to test this  change.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -