fsl a program logic for c11 memory fences
play

FSL: A Program Logic for C11 Memory Fences Marko Doko Viktor - PowerPoint PPT Presentation

FSL: A Program Logic for C11 Memory Fences Marko Doko Viktor Vafeiadis Max Planck Institute for Software Systems (MPI-SWS) VMCAI 2016 Why C11? Oddities of weak memory W( ,0) W( ,0)


  1. FSL: A Program Logic for C11 Memory Fences Marko Doko Viktor Vafeiadis Max Planck Institute for Software Systems (MPI-SWS) VMCAI 2016

  2. Why C11? Oddities of weak memory W( ① ,0) W( ② ,0) ① ❂ ✵❀ ② ❂ ✵❀ ① ❂ ✶❀ ② ❂ ✶❀ W( ① ,1) W( ② ,1) ♣r✐♥t ②❀ ♣r✐♥t ①❀ R( ② ,0) R( ① ,0) 1

  3. Why C11? Oddities of weak memory W( ① ,0) W( ② ,0) ① ❂ ✵❀ ② ❂ ✵❀ ① ❂ ✶❀ ② ❂ ✶❀ W( ① ,1) W( ② ,1) ♣r✐♥t ②❀ ♣r✐♥t ①❀ Both threads can print 0! R( ② ,0) R( ① ,0) 2

  4. Why C11? Oddities of weak memory W( ① ,0) W( ② ,0) ① ❂ ✵❀ ② ❂ ✵❀ ① ❂ ✶❀ ② ❂ ✶❀ W( ① ,1) W( ② ,1) ♣r✐♥t ②❀ ♣r✐♥t ①❀ Both threads can print 0! R( ② ,0) R( ① ,0) 3

  5. Why C11? Oddities of weak memory W( ① ,0) sb W( ② ,0) ① ❂ ✵❀ sb sb ② ❂ ✵❀ ① ❂ ✶❀ ② ❂ ✶❀ W( ① ,1) W( ② ,1) ♣r✐♥t ②❀ ♣r✐♥t ①❀ sb sb Both threads can print 0! R( ② ,0) R( ① ,0) sb – sequenced-before 4

  6. Why C11? Oddities of weak memory W( ① ,0) sb W( ② ,0) ① ❂ ✵❀ sb sb rf ② ❂ ✵❀ ① ❂ ✶❀ ② ❂ ✶❀ W( ① ,1) W( ② ,1) ♣r✐♥t ②❀ ♣r✐♥t ①❀ rf sb sb Both threads can print 0! R( ② ,0) R( ① ,0) sb – sequenced-before rf – reads-from 5

  7. ✐♥t ❛ ❂ ✵❀ ✐♥t ❛ ❂ ✵❀ ✐♥t ① ❂ ✵❀ ❛t♦♠✐❝❴✐♥t ① ❂ ✵❀ ❛ ❂ ✹✷❀ ✐❢✭① ❂❂ ✶✮④ ✐❢✭① ❂❂ ✶✮④ ❛ ❂ ✹✷❀ ① ❂ ✶❀ ♣r✐♥t✭❛✮❀ ① ❂ ✶❀ ♣r✐♥t✭❛✮❀ ⑥ ⑥ ✐♥t ❛ ❂ ✵❀ ✐♥t ❛ ❂ ✵❀ ❛t♦♠✐❝❴✐♥t ① ❂ ✵❀ ❛t♦♠✐❝❴✐♥t ① ❂ ✵❀ ❛ ❂ ✹✷❀ ✐❢✭① ❂❂ ✶✮④ ❛ ❂ ✹✷❀ ✐❢✭① ❂❂ ✶✮④ ① ❂ ✶❀ ♣r✐♥t✭❛✮❀ ❢❡♥❝❡ ❀ ❢❡♥❝❡ ❀ ⑥ ① ❂ ✶❀ ♣r✐♥t✭❛✮❀ ⑥ C11 model through examples 6

  8. ✐♥t ❛ ❂ ✵❀ ❛t♦♠✐❝❴✐♥t ① ❂ ✵❀ ❛ ❂ ✹✷❀ ✐❢✭① ❂❂ ✶✮④ ① ❂ ✶❀ ♣r✐♥t✭❛✮❀ ⑥ ✐♥t ❛ ❂ ✵❀ ✐♥t ❛ ❂ ✵❀ ❛t♦♠✐❝❴✐♥t ① ❂ ✵❀ ❛t♦♠✐❝❴✐♥t ① ❂ ✵❀ ❛ ❂ ✹✷❀ ✐❢✭① ❂❂ ✶✮④ ❛ ❂ ✹✷❀ ✐❢✭① ❂❂ ✶✮④ ① ❂ ✶❀ ♣r✐♥t✭❛✮❀ ❢❡♥❝❡ ❀ ❢❡♥❝❡ ❀ ⑥ ① ❂ ✶❀ ♣r✐♥t✭❛✮❀ ⑥ C11 model through examples ✐♥t ❛ ❂ ✵❀ 1 ✐♥t ① ❂ ✵❀ ❛ ❂ ✹✷❀ ✐❢✭① ❂❂ ✶✮④ ① ❂ ✶❀ ♣r✐♥t✭❛✮❀ ⑥ 7

  9. ✐♥t ❛ ❂ ✵❀ ❛t♦♠✐❝❴✐♥t ① ❂ ✵❀ ❛ ❂ ✹✷❀ ✐❢✭① ❂❂ ✶✮④ ① ❂ ✶❀ ♣r✐♥t✭❛✮❀ ⑥ ✐♥t ❛ ❂ ✵❀ ✐♥t ❛ ❂ ✵❀ ❛t♦♠✐❝❴✐♥t ① ❂ ✵❀ ❛t♦♠✐❝❴✐♥t ① ❂ ✵❀ ❛ ❂ ✹✷❀ ✐❢✭① ❂❂ ✶✮④ ❛ ❂ ✹✷❀ ✐❢✭① ❂❂ ✶✮④ ① ❂ ✶❀ ♣r✐♥t✭❛✮❀ ❢❡♥❝❡ ❀ ❢❡♥❝❡ ❀ ⑥ ① ❂ ✶❀ ♣r✐♥t✭❛✮❀ ⑥ C11 model through examples ✐♥t ❛ ❂ ✵❀ 1 ✐♥t ① ❂ ✵❀ ❛ ❂ ✹✷❀ ✐❢✭① ❂❂ ✶✮④ ① ❂ ✶❀ ♣r✐♥t✭❛✮❀ race ⑥ 8

  10. ✐♥t ❛ ❂ ✵❀ ✐♥t ❛ ❂ ✵❀ ❛t♦♠✐❝❴✐♥t ① ❂ ✵❀ ❛t♦♠✐❝❴✐♥t ① ❂ ✵❀ ❛ ❂ ✹✷❀ ✐❢✭① ❂❂ ✶✮④ ❛ ❂ ✹✷❀ ✐❢✭① ❂❂ ✶✮④ ① ❂ ✶❀ ♣r✐♥t✭❛✮❀ ❢❡♥❝❡ ❀ ❢❡♥❝❡ ❀ ⑥ ① ❂ ✶❀ ♣r✐♥t✭❛✮❀ ⑥ C11 model through examples ✐♥t ❛ ❂ ✵❀ ✐♥t ❛ ❂ ✵❀ 1 2 ✐♥t ① ❂ ✵❀ ❛t♦♠✐❝❴✐♥t ① ❂ ✵❀ ❛ ❂ ✹✷❀ ✐❢✭① ❂❂ ✶✮④ ❛ ❂ ✹✷❀ ✐❢✭① rlx ❂❂ ✶✮④ ① ❂ ✶❀ ♣r✐♥t✭❛✮❀ ① rlx ❂ ✶❀ ♣r✐♥t✭❛✮❀ race ⑥ ⑥ 9

  11. ✐♥t ❛ ❂ ✵❀ ✐♥t ❛ ❂ ✵❀ ❛t♦♠✐❝❴✐♥t ① ❂ ✵❀ ❛t♦♠✐❝❴✐♥t ① ❂ ✵❀ ❛ ❂ ✹✷❀ ✐❢✭① ❂❂ ✶✮④ ❛ ❂ ✹✷❀ ✐❢✭① ❂❂ ✶✮④ ① ❂ ✶❀ ♣r✐♥t✭❛✮❀ ❢❡♥❝❡ ❀ ❢❡♥❝❡ ❀ ⑥ ① ❂ ✶❀ ♣r✐♥t✭❛✮❀ ⑥ C11 model through examples ✐♥t ❛ ❂ ✵❀ ✐♥t ❛ ❂ ✵❀ 1 2 ✐♥t ① ❂ ✵❀ ❛t♦♠✐❝❴✐♥t ① ❂ ✵❀ ❛ ❂ ✹✷❀ ✐❢✭① ❂❂ ✶✮④ ❛ ❂ ✹✷❀ ✐❢✭① rlx ❂❂ ✶✮④ ① ❂ ✶❀ ♣r✐♥t✭❛✮❀ ① rlx ❂ ✶❀ ♣r✐♥t✭❛✮❀ race race ⑥ ⑥ 10

  12. ✐♥t ❛ ❂ ✵❀ ❛t♦♠✐❝❴✐♥t ① ❂ ✵❀ ❛ ❂ ✹✷❀ ✐❢✭① ❂❂ ✶✮④ ❢❡♥❝❡ ❀ ❢❡♥❝❡ ❀ ① ❂ ✶❀ ♣r✐♥t✭❛✮❀ ⑥ C11 model through examples ✐♥t ❛ ❂ ✵❀ ✐♥t ❛ ❂ ✵❀ 1 2 ✐♥t ① ❂ ✵❀ ❛t♦♠✐❝❴✐♥t ① ❂ ✵❀ ❛ ❂ ✹✷❀ ✐❢✭① ❂❂ ✶✮④ ❛ ❂ ✹✷❀ ✐❢✭① rlx ❂❂ ✶✮④ ① ❂ ✶❀ ♣r✐♥t✭❛✮❀ ① rlx ❂ ✶❀ ♣r✐♥t✭❛✮❀ race race ⑥ ⑥ 3 ✐♥t ❛ ❂ ✵❀ ❛t♦♠✐❝❴✐♥t ① ❂ ✵❀ ❛ ❂ ✹✷❀ ✐❢✭① acq ❂❂ ✶✮④ ① rel ❂ ✶❀ ♣r✐♥t✭❛✮❀ ⑥ 11

  13. ✐♥t ❛ ❂ ✵❀ ❛t♦♠✐❝❴✐♥t ① ❂ ✵❀ ❛ ❂ ✹✷❀ ✐❢✭① ❂❂ ✶✮④ ❢❡♥❝❡ ❀ ❢❡♥❝❡ ❀ ① ❂ ✶❀ ♣r✐♥t✭❛✮❀ ⑥ C11 model through examples ✐♥t ❛ ❂ ✵❀ ✐♥t ❛ ❂ ✵❀ 1 2 ✐♥t ① ❂ ✵❀ ❛t♦♠✐❝❴✐♥t ① ❂ ✵❀ ❛ ❂ ✹✷❀ ✐❢✭① ❂❂ ✶✮④ ❛ ❂ ✹✷❀ ✐❢✭① rlx ❂❂ ✶✮④ ① ❂ ✶❀ ♣r✐♥t✭❛✮❀ ① rlx ❂ ✶❀ ♣r✐♥t✭❛✮❀ race race ⑥ ⑥ 3 ✐♥t ❛ ❂ ✵❀ ❛t♦♠✐❝❴✐♥t ① ❂ ✵❀ ❛ ❂ ✹✷❀ ✐❢✭① acq ❂❂ ✶✮④ rf ① rel ❂ ✶❀ ♣r✐♥t✭❛✮❀ ⑥ 12

  14. ✐♥t ❛ ❂ ✵❀ ❛t♦♠✐❝❴✐♥t ① ❂ ✵❀ ❛ ❂ ✹✷❀ ✐❢✭① ❂❂ ✶✮④ ❢❡♥❝❡ ❀ ❢❡♥❝❡ ❀ ① ❂ ✶❀ ♣r✐♥t✭❛✮❀ ⑥ C11 model through examples ✐♥t ❛ ❂ ✵❀ ✐♥t ❛ ❂ ✵❀ 1 2 ✐♥t ① ❂ ✵❀ ❛t♦♠✐❝❴✐♥t ① ❂ ✵❀ ❛ ❂ ✹✷❀ ✐❢✭① ❂❂ ✶✮④ ❛ ❂ ✹✷❀ ✐❢✭① rlx ❂❂ ✶✮④ ① ❂ ✶❀ ♣r✐♥t✭❛✮❀ ① rlx ❂ ✶❀ ♣r✐♥t✭❛✮❀ race race ⑥ ⑥ 3 ✐♥t ❛ ❂ ✵❀ ❛t♦♠✐❝❴✐♥t ① ❂ ✵❀ ❛ ❂ ✹✷❀ ✐❢✭① acq ❂❂ ✶✮④ rf ① rel ❂ ✶❀ ♣r✐♥t✭❛✮❀ sync ⑥ 13

  15. C11 model through examples ✐♥t ❛ ❂ ✵❀ ✐♥t ❛ ❂ ✵❀ 1 2 ✐♥t ① ❂ ✵❀ ❛t♦♠✐❝❴✐♥t ① ❂ ✵❀ ❛ ❂ ✹✷❀ ✐❢✭① ❂❂ ✶✮④ ❛ ❂ ✹✷❀ ✐❢✭① rlx ❂❂ ✶✮④ ① ❂ ✶❀ ♣r✐♥t✭❛✮❀ ① rlx ❂ ✶❀ ♣r✐♥t✭❛✮❀ race race ⑥ ⑥ 3 ✐♥t ❛ ❂ ✵❀ 4 ✐♥t ❛ ❂ ✵❀ ❛t♦♠✐❝❴✐♥t ① ❂ ✵❀ ❛t♦♠✐❝❴✐♥t ① ❂ ✵❀ ❛ ❂ ✹✷❀ ✐❢✭① acq ❂❂ ✶✮④ ❛ ❂ ✹✷❀ ✐❢✭① rlx ❂❂ ✶✮④ rf ① rel ❂ ✶❀ ♣r✐♥t✭❛✮❀ ❢❡♥❝❡ rel ❀ ❢❡♥❝❡ acq ❀ sync ⑥ ① rlx ❂ ✶❀ ♣r✐♥t✭❛✮❀ ⑥ 14

  16. C11 model through examples ✐♥t ❛ ❂ ✵❀ ✐♥t ❛ ❂ ✵❀ 1 2 ✐♥t ① ❂ ✵❀ ❛t♦♠✐❝❴✐♥t ① ❂ ✵❀ ❛ ❂ ✹✷❀ ✐❢✭① ❂❂ ✶✮④ ❛ ❂ ✹✷❀ ✐❢✭① rlx ❂❂ ✶✮④ ① ❂ ✶❀ ♣r✐♥t✭❛✮❀ ① rlx ❂ ✶❀ ♣r✐♥t✭❛✮❀ race race ⑥ ⑥ 3 ✐♥t ❛ ❂ ✵❀ 4 ✐♥t ❛ ❂ ✵❀ ❛t♦♠✐❝❴✐♥t ① ❂ ✵❀ ❛t♦♠✐❝❴✐♥t ① ❂ ✵❀ ❛ ❂ ✹✷❀ ✐❢✭① acq ❂❂ ✶✮④ ❛ ❂ ✹✷❀ ✐❢✭① rlx ❂❂ ✶✮④ rf ① rel ❂ ✶❀ ♣r✐♥t✭❛✮❀ ❢❡♥❝❡ rel ❀ rf ❢❡♥❝❡ acq ❀ sync ⑥ ① rlx ❂ ✶❀ ♣r✐♥t✭❛✮❀ ⑥ 15

  17. C11 model through examples ✐♥t ❛ ❂ ✵❀ ✐♥t ❛ ❂ ✵❀ 1 2 ✐♥t ① ❂ ✵❀ ❛t♦♠✐❝❴✐♥t ① ❂ ✵❀ ❛ ❂ ✹✷❀ ✐❢✭① ❂❂ ✶✮④ ❛ ❂ ✹✷❀ ✐❢✭① rlx ❂❂ ✶✮④ ① ❂ ✶❀ ♣r✐♥t✭❛✮❀ ① rlx ❂ ✶❀ ♣r✐♥t✭❛✮❀ race race ⑥ ⑥ 3 ✐♥t ❛ ❂ ✵❀ 4 ✐♥t ❛ ❂ ✵❀ ❛t♦♠✐❝❴✐♥t ① ❂ ✵❀ ❛t♦♠✐❝❴✐♥t ① ❂ ✵❀ ❛ ❂ ✹✷❀ ✐❢✭① acq ❂❂ ✶✮④ ❛ ❂ ✹✷❀ ✐❢✭① rlx ❂❂ ✶✮④ rf ① rel ❂ ✶❀ ♣r✐♥t✭❛✮❀ ❢❡♥❝❡ rel ❀ rf ❢❡♥❝❡ acq ❀ sync sync ⑥ ① rlx ❂ ✶❀ ♣r✐♥t✭❛✮❀ ⑥ 16

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend