1 / 8

Midterm cps-5135g

Midterm cps-5135g. Video: http://goview.com/goldwyn/spring/play?method=playRecording&recordingId=512318ec-f3ac-41e0-8f17-e477dd06db90 Io Concurrency ( Coroutines ) Author: Austin Lansing Date: March 5 th , 2011. Io Concurrency Definitions. Io Concurrency Coroutines Coroutines

logan-frank
Download Presentation

Midterm cps-5135g

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Midterm cps-5135g Video: http://goview.com/goldwyn/spring/play?method=playRecording&recordingId=512318ec-f3ac-41e0-8f17-e477dd06db90 Io Concurrency (Coroutines) Author: Austin Lansing Date: March 5th, 2011

  2. Io Concurrency Definitions • Io Concurrency Coroutines • Coroutines • User Level Threads (as opposed to OS Threads) • Reduces strain on System Resources • Io capable of processing thousands of threads • Reference: http://www.iolanguage.com/scm/io/docs/reference/index.html#/Core/Core/Coroutine • http://www.iolanguage.com/scm/io/docs/IoGuide.html#Concurrency

  3. Scheduler • Scheduler Object • Responsible for resuming and yielding threads • Scheduler process threads as First Come First Serve • Scheduler yieldingCoros size = # of coroutines yielding • Reference • http://www.iolanguage.com/scm/io/docs/reference/index.html#/Core/Core/Scheduler • Try – Interactive Scripts (Scheduler)

  4. Actors • Actors • Object with own thread (coroutine) • Actors coroutine is used to process asyncronous message • Io Asyncronous messages can be sent to any object using futurSend command(@) or asyncSend command (@@) • Object becomes actor when it receives asyncronous message

  5. Io Concurrency - Futures • Futures • Send future to object using (@). • Futures return a value once asyncronous message completes • TRY IT – Interactive Scripts (Futures)

  6. Yield and YieldCoros • Yield • yields control of Coroutine, so other Coroutines can run • cObjyieldMethod := method(for(a, 1,10, a println; yield)) • Scheduler yieldingCoros • List of yielding coroutines. • Use the list method size to get # of yielding coroutines • while(Scheduler yieldingCoros size > 0, yield) //releases yielding coroutines

  7. Inspecting Io Concurrency Objects • Protos Core Coroutine • Protos Core CoroutineisActive • Protos Core Scheduler • Protos Core Scheduler yieldingCoros Also use IoLanguage.com reference http://www.iolanguage.com/scm/io/docs/reference/index.html#/Core

  8. Putting it together - race.txt Script

More Related