Skip to content

cyrilladrian/asynchronous-programming

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tutorial 1 -- Timer

Experiment 1.2: Understanding How It Works

alt text

Even though the line println('Cyrill's Computer: Hey hey hey') is written after the line spawner.spawn(...), The 'Cyrill's Computer: Hey hey hey' appears first in the terminal. This is because the spawn function schedules the task to be executed asynchronously, but it does not block the execution of the main thread. Therefore, the println('Cyrill's Computer: Hey hey hey') statement is executed immediately, while the spawned task runs concurrently in the background

Experiment 1.3: Multiple Spawn and Removing Drop

alt text

drop(spawner) shows that we have finished sending message to the queue and the executor to finish the task in hand and finally end the program. By removing the drop(spawner) the executioner expects other tasks to be spawned.

When spawning multiple tasks, the tasks are done asynchronously, therefore the result in the console are not in the same order.

About

Tutorial Module 10 for Advance Programming Course

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages