*===========================================================================*/
PRIVATE void pm_init()
{
-/* Initialize the process manager. */
+/* Initialize the process manager.
+ * Memory use info is collected from the boot monitor, the kernel, and
+ * all processes compiled into the system image. Initially this information
+ * is put into an array mem_chunks. Elements of mem_chunks are struct memory,
+ * and hold base, size pairs in units of clicks. This array is small, there
+ * should be no more than 8 chunks. After the array of chunks has been built
+ * the contents are used to initialize the hole list. Space for the hole list
+ * is reserved as an array with twice as many elements as the maximum number
+ * of processes allowed. It is managed as a linked list, and elements of the
+ * array are struct hole, which, in addition to storage for a base and size in
+ * click units also contain space for a link, a pointer to another element.
+*/
int key, i, s;
static struct boot_image image[NR_BOOT_PROCS];
register struct boot_image *ip;
*/
if ((s=sys_getmonparams(monitor_params, sizeof(monitor_params))) != OK)
panic(__FILE__,"get monitor params failed",s);
+ get_mem_chunks(mem_chunks);
if ((s=sys_getkinfo(&kinfo)) != OK)
panic(__FILE__,"get kernel info failed",s);
- get_mem_chunks(mem_chunks);
/* Get the memory map of the kernel to see how much memory it uses. */
if ((s=get_mem_map(SYSTASK, mem_map)) != OK)