DOC PREVIEW
UMD CMSC 433 - Multithreaded Input Stream

This preview shows page 1 out of 2 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

1MultithreadedInputStreamCMSC 433, project 3Purpose• InputStream wrapper• Used when reading stream iscomputationally expensive• might want to do it in backgroundDesign• InputStream wrapper• Background thread reads from input– stores in buffer(s)• read calls read from buffer(s) if filled– otherwise, reads directly from inputinbackgroundthreadBuffer Queueread requestseither/oronly ifcurrent buffer and queue is emptycurrentbufferDataflowread function• If current buffer empty– Try to dequeue buffer from buffer queue– make result new current buffer• Does current buffer contain data?– if so, fulfill request out of current buffer• else, try to read data directlyNotes:• read should not hold lock for entireoperation– don’t hold lock while copying data2background thread• loop– get lock– read from in into new buffer– put buffer into buffer queue– release lock– if buffer queue had been empty• sleep for 10 milliseconds• allow foreground thread to read


View Full Document

UMD CMSC 433 - Multithreaded Input Stream

Documents in this Course
Trace 1

Trace 1

62 pages

Reflection

Reflection

137 pages

Testing

Testing

25 pages

Paradigms

Paradigms

10 pages

Testing

Testing

17 pages

Java RMI

Java RMI

17 pages

Java RMI

Java RMI

17 pages

Java RMI

Java RMI

17 pages

Trace 1

Trace 1

46 pages

Jini

Jini

4 pages

Final

Final

15 pages

Java RMI

Java RMI

13 pages

Testing

Testing

16 pages

Load more
Download Multithreaded Input Stream
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Multithreaded Input Stream and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Multithreaded Input Stream 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?