TRINITY CSCI 1321 - Parallel Collections and Actor Threads

Unformatted text preview:

Slide 1Slide 2Slide 3Slide 4Slide 5Slide 6Slide 7Parallel Collections and Actor Threads2-3-2012Opening DiscussionMinute essay commentsUsing threads in projects.Units and threads is a great place to use today's topic.Drawing is not parallel. Graphics is a bottleneck.Networking will automatically add an extra thread because of there is a blocking call that waits for new users.GUIs are MultithreadedAll events, including repainting, happen in an event thread.If you block the event thread, the GUI becomes non-responsive.Anything that will take much time should go in a separate thread.Parallel CollectionsScala 2.9 introduced scala.collection.parallel.The methods of these collections do their work in parallel.Covert from regular collections to parallel ones by calling the “par” method.Convert back with “seq”.Not all collections convert efficiently.Actor Threads and FuturesThe scala.actors library provides an alternative threading model we will explore in depth later on.For now there are two methods that simplify launching threads.Actor.actor(body: => Unit):ActorFutures.future[T](body: => T):Future[T]Use the first to launch code in a thread. Use the second if you want a return value.CodeLet's write some.Minute EssayQuestions about parallel before we move on to


View Full Document

TRINITY CSCI 1321 - Parallel Collections and Actor Threads

Documents in this Course
Recursion

Recursion

11 pages

Iterators

Iterators

10 pages

Actors

Actors

9 pages

Recursion

Recursion

15 pages

Recursion

Recursion

10 pages

Threads

Threads

7 pages

Trees

Trees

11 pages

Load more
Download Parallel Collections and Actor Threads
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 Parallel Collections and Actor Threads 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 Parallel Collections and Actor Threads 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?