Пример #1
0
/* Print statistics about Pintos execution. */
static void
print_stats (void)
{
  timer_print_stats ();
  thread_print_stats ();
#ifdef FILESYS
  block_print_stats ();
#endif
  console_print_stats ();
  kbd_print_stats ();
  exception_print_stats ();
}
Пример #2
0
/* Initialize the swap_table */
void swap_table_init (struct swap_table *swap_table)
{
  lock_init ( &swap_table->lock_bitmap);
  lock_init ( &swap_table->lock_swap);
  swap_table->swap_block = block_get_role ( BLOCK_SWAP );
  block_print_stats ();
  if (swap_table->swap_block)
  {
    int pages_in_swap = 
      block_size (swap_table->swap_block) / SECTORS_PER_PAGE;
    swap_table->bitmap = bitmap_create (pages_in_swap);
    /* False means not occupied */
    bitmap_set_all (swap_table->bitmap, false);
    /* The first frame is reserved for stack growth */
    bitmap_set (swap_table->bitmap, 0, true);
  }
}