Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 3340 Windows Programming Prog4 Test2 1. 2 Program5 Due Friday, March 27.

Similar presentations


Presentation on theme: "CS 3340 Windows Programming Prog4 Test2 1. 2 Program5 Due Friday, March 27."— Presentation transcript:

1 CS 3340 Windows Programming Prog4 Test2 1

2 2 Program5 Due Friday, March 27

3 ADT: Database Total ReaderCount WriterCount DataObj (for Monitor) 3 TotalValue (Get & Set) IncreaseReaderCount DecreaseReaderCount IncreaseWriterCount DecreaseWriterCount TheDatabaseStatus (ReadOnly) LockDataObj ReleaseDataObj The properties/methods don’t enforce mutual exclusion.

4 ADT: Database Does not guarantee any specific rules to access the database. It provides all necessary methods so the clients can enforce different rules to access the database. 4

5 ADT: ReaderWriter Will enforce the following rules to access the database: Readers can share the database. Writers require exclusive access to the database. First In First Out (FIFO) rule. 5

6 ADT: ReaderWriter FIFOQueue _database endProgram _thread _passMag _mainForm _ReaderWriterEvent _rondomGenerator 6 TheDatabase (WriteOnly) WakeupNextWhenExiting FinishReadWrite DisplayMsg (WriteOnly) MainForm (WriteOnly) ID (ReadOnly) Type (ReadOnly) Spinup Wakeup Run (MustOverride)

7 ADT: Reader Sub-class of ReaderWriter Overriding the following: Type ID Run 7

8 ADT: Writer Sub-class of ReaderWriter Overriding the following: Type ID Run 8

9 Invoking Delegate ‘ Cannot do it this way! _passMag.Invoke(ID, state, _database.TotalValue) ‘ Must ask the main form to invoke the delegate! _mainForm.Invoke(_passMsg, ID, state, _database.TotalValue) 9

10 ADT: ReaderWriterForm txtTotal lstWaiting lstWorking txtLog btnNewReader btnNewWriter btnExit dummyThread Delegate 10 FormLoad (Sub New) Create a Database object for ReaderWriter Class Delegate Sub New Reader set MainForm & DisplayMsg New Writer set MainForm & DisplayMsg Exit

11 Final Exam (Test4) Threads! 11

12 Project VB Grader Threads Assembly Midterm grade B (A-) or above. Email me by Wednesday. 12


Download ppt "CS 3340 Windows Programming Prog4 Test2 1. 2 Program5 Due Friday, March 27."

Similar presentations


Ads by Google