Example #1
0
        static void Main(string[] args)
        {
            MultipleArrayMemoryManagementUnit.SetMemoryManagementUnitType();
            //BoundedMemoryManagementUnit.SetMemoryManagementUnitType(1000);
            //SwappingMemoryManagementUnit.SetMemoryManagementUnitType(150);
            FileStream fs = new FileStream("Debug.txt", FileMode.Create);

            Debug.Listeners.Add(new TextWriterTraceListener(Console.Out));
            Debug.Listeners.Add(new TextWriterTraceListener(fs));
            Random        rnd = new Random();
            SortingThread st  = new SortingThread();

            int[] a   = new int[100];
            int[] b   = new int[100];
            int   idx = 0;

            for (idx = 0; idx < a.Length; idx++)
            {
                a[idx] = rnd.Next(1000);
            }
            st.CopyFrom(a);
            Debug.WriteLine(st);
            st.Start();
            Thread.Sleep(2000);
            st.Join();
            st.CopyTo(b);
            Debug.WriteLine(st);
            Debug.Assert(VerifySort(a, b));
            Debug.Close();
        }
 //singleton implementation
 public static void SetMemoryManagementUnitType()
 {
     m_mmuInstance = new MultipleArrayMemoryManagementUnit();
 }