Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Consumer.hh

Go to the documentation of this file.
00001 
00020 // ===================================================================
00021 // Avoid multiple inclusion.
00022 #if !defined (_CONSUMER_HH)
00023 #define _CONSUMER_HH
00024 // ===================================================================
00025 
00026 
00027 
00028 // ===================================================================
00029 // INCLUDES
00030 
00031 #include <stdio.h>
00032 #include "Reference_Reader.hh"
00033 #include "Process.hh"
00034 #include "Task.hh"
00035 #include "types-and-constants.hh"
00036 // ===================================================================
00037 
00038 
00039 
00040 // ===================================================================
00041 // CLASS DEFINITION
00042 
00053 class Consumer {
00054 
00055 public: // CONSTRUCTOR & DESTRUCTOR
00056 
00067   Consumer (Reference_Reader* const reference_reader,
00068       const char* const kernel_pathname);
00069 
00075   virtual ~Consumer ();
00076 
00077 public: // METHODS
00078 
00085   void merge ();
00086 
00087 protected: // METHODS
00088 
00096   void synchronize ();
00097 
00106   Task* safe_task_ID_to_task (const task_ID_t task_ID);
00107 
00116   Process* safe_context_ID_to_process (const context_ID_t context_ID);
00117 
00131   bool safe_live (const task_ID_t task_ID);
00132 
00139   virtual_to_canonical_map_t*
00140   safe_file_ID_to_V2C_map (const file_ID_s& file_ID);
00141 
00148   virtual_to_canonical_map_t* safe_shm_ID_to_V2C_map
00149   (const shm_ID_t& shm_ID);
00150 
00159   void map_virtual_to_canonical
00160   (virtual_to_canonical_map_t* const map,
00161    const virtual_page_ID_t virtual_page_ID,
00162    canonical_page_s* const canonical_page);
00163 
00174   void read_kernel_record ();
00175 
00185   canonical_page_s* get_new_canonical_page (const page_type_t type);
00186 
00196   void delete_if_unused_page
00197   (canonical_page_s** const canonical_page_handle);
00198 
00209   void delete_if_defunct_process (Process** const process_handle);
00210 
00220   void delete_defunct_shm_segments ();
00221 
00238   void mark_if_defunct_shm_segment
00239   (const canonical_page_s* const canonical_page);
00240 
00250   void unlink_task_and_process (Task* const task);
00251 
00261   void make_kernel_active ();
00262 
00272   void make_user_active ();
00273 
00286   void handle_schedule ();
00287 
00295   void handle_fork ();
00296 
00307   void handle_exec ();
00308 
00317   void handle_exit ();
00318 
00330   void handle_context_assignment ();
00331 
00342   void handle_duplicate_range ();
00343 
00357   void handle_file_mmap_range ();
00358 
00368   void handle_anonymous_mmap_range ();
00369 
00380   void handle_shmat ();
00381 
00394   void handle_munmap_range ();
00395 
00407   void handle_complete_unmap (const context_ID_t context_ID);
00408 
00417   void handle_cow_unmap ();
00418 
00430   void handle_buffer_cache_allocation ();
00431 
00436   void handle_buffer_cache_deallocation ();
00437 
00446   void handle_file_cache_allocation ();
00447 
00457   void handle_file_cache_deallocation ();
00458 
00468   void handle_file_delete();
00469 
00478   void update_with_reference_record ();
00479 
00487   void update_with_kernel_record ();
00488 
00507   void lookup_canonical_page_ID
00508   (bool* return_V2C_mapping_exists,
00509    canonical_page_ID_t* const return_canonical_page_ID,
00510    const virtual_to_canonical_map_t* const map,
00511    const virtual_page_ID_t virtual_page_ID);
00512 
00513 protected: // VIRTUAL METHODS
00514 
00522   virtual Task* allocate_new_task ();
00523 
00531   virtual Process* allocate_new_process ();
00532 
00533 protected: // PURE VIRTUAL METHODS
00534 
00543   virtual void initialize () = 0;
00544 
00552   virtual void clean_up () = 0;
00553 
00564   virtual void act_on_reference_record () = 0;
00565 
00576   virtual void act_on_kernel_record () = 0;
00577 
00578 protected: // DATA
00579 
00582   Reference_Reader* reference_reader;
00583 
00585   FILE* kernel_stream;
00586 
00588   unsigned long long int number_reference_records;
00589 
00591   unsigned long long int number_kernel_records;
00592 
00594   canonical_page_ID_t next_canonical_page_ID;
00595 
00603   canonical_page_s* canonical_zero_page;
00604 
00612   reference_record_s* reference_record;
00613 
00621   kernel_record_s* kernel_record;
00622 
00632   Task* kernel_task;
00633 
00636   Task* scheduled_task;
00637 
00646   Task* active_task;
00647 
00655   process_ID_t next_process_ID;
00656 
00658   task_ID_to_Task_map_t task_ID_to_Task_map;
00659 
00661   context_ID_to_Process_map_t context_ID_to_Process_map;
00662 
00671   live_map_t live_map;
00672 
00675   file_ID_to_V2C_map_t file_ID_to_V2C_map;
00676 
00679   shm_ID_to_V2C_map_t shm_ID_to_V2C_map;
00680 
00683   defunct_shm_ID_map_t defunct_shm_ID_map;
00684 
00695   canonical_page_s canonical_buffer_cache_page;
00696 
00698   char buffer[BUFFER_SIZE];
00699 
00700 }; // class Consumer
00701 // ===================================================================
00702 
00703 
00704 
00705 // ===================================================================
00706 #endif // _CONSUMER_HH
00707 // ===================================================================

Generated on Fri Jan 31 10:33:34 2003 for Laplace-merge by doxygen1.3-rc2