Introducing+the+basics+of+user2level+...

9
Introducing the basics of userlevel mul6threading early adopters 2012 Ana Lúcia de Moura Noemi Rodriguez amoura, [email protected]

Transcript of Introducing+the+basics+of+user2level+...

Page 1: Introducing+the+basics+of+user2level+ mul6threading+tcpp.cs.gsu.edu/curriculum/sites/default/files/Introducing the basics of user-level...local co = coroutine.create(f) table.insert(tasks,

Introducing  the  basics  of  user-­‐level  mul6threading  

early  adopters  2012    

Ana  Lúcia  de  Moura  Noemi  Rodriguez  

amoura,  [email protected]­‐rio.br  

Page 2: Introducing+the+basics+of+user2level+ mul6threading+tcpp.cs.gsu.edu/curriculum/sites/default/files/Introducing the basics of user-level...local co = coroutine.create(f) table.insert(tasks,

mo6va6on  

•  importance  today:  – scalability  and  massive  concurrency  – overhead  

•  difference  hard  to  understand  with  no  hands-­‐on  experience    

user-­‐level  X  system-­‐level  mul6threading  

Page 3: Introducing+the+basics+of+user2level+ mul6threading+tcpp.cs.gsu.edu/curriculum/sites/default/files/Introducing the basics of user-level...local co = coroutine.create(f) table.insert(tasks,

cross-­‐cuKng  approach:    

•  introduce  experience  with  user-­‐level  mul6threading  when  students  learn  about  the  execu6on  stack...  

Systems  SoNware  course    

throughout  this  course,  students  are  introduced  to  basic  mechanisms  that  support  higher-­‐level  abstrac6ons    

Page 4: Introducing+the+basics+of+user2level+ mul6threading+tcpp.cs.gsu.edu/curriculum/sites/default/files/Introducing the basics of user-level...local co = coroutine.create(f) table.insert(tasks,

Systems  SoNware  at  PUC-­‐Rio  

•  one-­‐semester  course  taken  by  all  undergraduates  in  Compu6ng  (computer  engineering,  computer  science,  IT)  

•  common  ground  with  Computer  Systems  but  strong  emphasis  on  soNware  perspec6ve  – Bryant  &  O'Hallaron.  Computer  systems:  a  programmers's  perspec6ve.  

•  one-­‐week  modules  with  2  classes  each:  theore6cal  and  lab  

Page 5: Introducing+the+basics+of+user2level+ mul6threading+tcpp.cs.gsu.edu/curriculum/sites/default/files/Introducing the basics of user-level...local co = coroutine.create(f) table.insert(tasks,

course  site  

Page 6: Introducing+the+basics+of+user2level+ mul6threading+tcpp.cs.gsu.edu/curriculum/sites/default/files/Introducing the basics of user-level...local co = coroutine.create(f) table.insert(tasks,

course  syllabus  •  data  representa6on:  integer  and  floa6ng-­‐point  types,  arrays,  structs  

•  IA-­‐32  assembly  language  (basics)  •  transla6on  of  C  statements  and  control  structures  

•  implementa6on  of  subrou6nes  –  execu6on  stack,  arguments,  local  variables  

•  corou6nes  •  interrups  and  traps  •  linking  and  loading  

Page 7: Introducing+the+basics+of+user2level+ mul6threading+tcpp.cs.gsu.edu/curriculum/sites/default/files/Introducing the basics of user-level...local co = coroutine.create(f) table.insert(tasks,

new  module:  corou6nes  

•  mo6va6on:  generators,  iterators,  mul6tasking  M.  Sco\,  Programming  Language  Pragma-cs,  Morgan  Kaufmann,  2009.    

•  examples:  Lua  – simple  syntax  allows  to  concentrate  on  concept  

•  corou6ne  library:  

icoro_transfer  

yield  resume   transfer  

core  module  (in  assembly)  

symmetric  corou6nes  (in  C)  asymmetric  corou6nes  (in  C)  

Page 8: Introducing+the+basics+of+user2level+ mul6threading+tcpp.cs.gsu.edu/curriculum/sites/default/files/Introducing the basics of user-level...local co = coroutine.create(f) table.insert(tasks,

corou6ne  lab  function create_task(f) – new task local co = coroutine.create(f) table.insert(tasks, co) end function dispatcher() – simple scheduler local i = 1 while true do if tasks[i] == nil then if tasks[1] == nil then break end i= 1 end local status = coroutine.resume(tasks[i]) if status == false then table.remove(tasks, i) else i= i + 1 end end end

•  construc6on  of  a  very  simple  coopera6ve  scheduler  

•  specifica6on  in  Lua  

Page 9: Introducing+the+basics+of+user2level+ mul6threading+tcpp.cs.gsu.edu/curriculum/sites/default/files/Introducing the basics of user-level...local co = coroutine.create(f) table.insert(tasks,

evalua6on:  •  lab  helps  students  to  acquire  concrete  understanding  of  

user-­‐level  flows  •  students  were  mo6vated  by  the  "under-­‐the-­‐

hood"approach  

future  plans:  •  extend  corou6ne  material  to  two  weeks    

1.  students  develop  program  using  asymmetric  corou6nes  2.  students  develop  symmetric  version  of  the  library