mirror of
https://github.com/fverdugo/XM_40017.git
synced 2025-11-24 09:24:32 +01:00
Changes after the lecture on Friday September 15th 2023
This commit is contained in:
@@ -614,6 +614,27 @@
|
||||
"take!(chnl)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "ff0da45d",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### This will not work!\n",
|
||||
"\n",
|
||||
"You really need remote channels to communicate different processes. Standard Channels would not work. For instance, the following code would block at the `take!`. Worker 4 will receive a different copy of the channel and will put values in it. The channel defined in the main process will remain empty and this will make the take! to block. \n",
|
||||
"\n",
|
||||
"```julia\n",
|
||||
"chnl = Channel{Int}()\n",
|
||||
"@spawnat 4 begin\n",
|
||||
" for i in 1:5\n",
|
||||
" put!(chnl,i)\n",
|
||||
" end\n",
|
||||
" close(chnl)\n",
|
||||
"end\n",
|
||||
"take!(chnl)\n",
|
||||
"```"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "1b3f8dcc",
|
||||
@@ -769,7 +790,7 @@
|
||||
"source": [
|
||||
"\n",
|
||||
"<div class=\"alert alert-block alert-success\">\n",
|
||||
"<b>Question (Q1):</b> How many integers are transferred between master and worker? Including both directions. \n",
|
||||
"<b>Question (NB3-Q1):</b> How many integers are transferred between master and worker? Including both directions. \n",
|
||||
"</div>\n",
|
||||
"\n",
|
||||
"\n",
|
||||
@@ -803,7 +824,7 @@
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<div class=\"alert alert-block alert-success\">\n",
|
||||
"<b>Question (Q2):</b> How many integers are transferred between master and worker? Including both directions. \n",
|
||||
"<b>Question (NB3-Q2):</b> How many integers are transferred between master and worker? Including both directions. \n",
|
||||
"</div>\n",
|
||||
"\n",
|
||||
"\n",
|
||||
@@ -838,7 +859,7 @@
|
||||
"source": [
|
||||
"\n",
|
||||
"<div class=\"alert alert-block alert-success\">\n",
|
||||
"<b>Question (Q3):</b> Which value will be the value of `x` ? \n",
|
||||
"<b>Question (NB3-Q3):</b> Which value will be the value of `x` ? \n",
|
||||
"</div>\n"
|
||||
]
|
||||
},
|
||||
@@ -862,7 +883,7 @@
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<div class=\"alert alert-block alert-success\">\n",
|
||||
"<b>Question (Q4):</b> Which value will be the value of `x` ? \n",
|
||||
"<b>Question (NB3-Q4):</b> Which value will be the value of `x` ? \n",
|
||||
"</div>\n",
|
||||
"\n",
|
||||
"Which value will be the value of `x` ?"
|
||||
@@ -1309,7 +1330,7 @@
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Julia 1.9.3",
|
||||
"display_name": "Julia 1.9.0",
|
||||
"language": "julia",
|
||||
"name": "julia-1.9"
|
||||
},
|
||||
@@ -1317,7 +1338,7 @@
|
||||
"file_extension": ".jl",
|
||||
"mimetype": "application/julia",
|
||||
"name": "julia",
|
||||
"version": "1.9.3"
|
||||
"version": "1.9.0"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
Reference in New Issue
Block a user