This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Tutorial on Thread Programming in Java Part I: Summary of the main functions of the programs dataRec - stimulate the data records in a database - dataRec: key_id (key of a record), value (value for this record), state (idle, read, write)- op_read() - atomic read operation- op_write() - atomic operation for this dataRec readTrans – the thread to stimulate a read transaction writeTrans – the thread to stimulate a write transaction ReadWriteTest - generate read / write transactions to access to the database Part II: Some Simple Questions about the Programs Draw a simple diagram to show the flow and relations of the programs How to create a thread? How to achieve mutual exclusion? How to make a thread to wait? How to wake up a waiting thread? How to make a thread to sleep for a specific period of time? When will the system terminate a thread? How to terminate a thread? Part III: Simple Enhancement Currently, the client program generates a sequence of read and write operations to access to the data items. You may modify the program such that a user inputs read and write operations to access to the data items. Each user may input several read/write operations accessing to different data items. Each user input is terminated with the character input several read/write operations accessing to different data items....
View Full Document
- Spring '10
- Central processing unit, Computer program, dataRec