public MemoryManagementUnit(PhysicalMemory physicalMemory, VirtualMemory virtualMemory)
        {
            _physicalMemory = physicalMemory;
            _virtualMemory  = virtualMemory;

            _pageTables = new Dictionary <int, PageTable>();

            _addedPagesInfo = new List <PageInfo>();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            button1.Enabled = false;

            int            sizeOfPhysicalMemory = Convert.ToInt32(numericUpDown1.Value);
            PhysicalMemory physicalMemory       = new PhysicalMemory(sizeOfPhysicalMemory);

            physicalMemory.PhysicalMemoryUpdatedEvent += OnPhysicalMemoryUpdated;

            for (int i = 0; i < sizeOfPhysicalMemory; ++i)
            {
                dataGridView1.Rows.Add();
                dataGridView1[0, i].Value = i;
                dataGridView1[1, i].Value = "Free";
            }

            int           sizeOfVirtualMemory = Convert.ToInt32(numericUpDown2.Value);
            VirtualMemory virtualMemory       = new VirtualMemory(sizeOfVirtualMemory);

            virtualMemory.VirtualMemoryUpdatedEvent += OnVirtualMemoryUpdated;

            for (int i = 0; i < sizeOfVirtualMemory; ++i)
            {
                dataGridView2.Rows.Add();
                dataGridView2[0, i].Value = "Free";
            }

            MemoryManagementUnit MMU = new MemoryManagementUnit(physicalMemory, virtualMemory);

            MMU.PageTableRequestEvent          += OnPageTableRequest;
            MMU.PageTableAnswerEvent           += OnPageTableAnswer;
            MMU.PageFaultOccuredEvent          += OnPageFaultOccured;
            MMU.PageFaultHandledEvent          += OnPageFaultHandled;
            MMU.PageAddedToPhysicalMemoryEvent += OnPageAddedToPhysicalMemory;
            MMU.PageReplacedEvent        += OnPageReplaced;
            MMU.ProcessFinishedWorkEvent += OnProcessFinishedWork;

            cpu = new CPU(Convert.ToInt32(numericUpDown3.Value), MMU);

            subThread = new Thread(Start);
            subThread.Start();
        }