jérémy damour
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Cour 2 -- Théorie de la concurrence ###### tags `cour` `M1 S1` `Concurrence` [Somaire](IAsAMpizSpawifCj1gZ__g#)\ [precedent](/hkQL_-GXTG6nXzaiRtdNtg) > [time= 23 sept 2020] [TOC] {%hackmd B0rpdjqcRfel-RZiyDj0PA %} ### attente borné On sais qu'il n'y a pas famine. Mais on ne sais pas le nombre de fois que l'algorithme va attendre pour etre obligé de prendre la main. ## Logique temporelle ### LTL (linear-time temporal logic) :::success **Logique de temps linéaire.**\ le comportement d'un programme est vu comme l'ensemble ::: ## syntaxe :::success $$ \phi, \psi ::= P \:|\: \neg \phi \:|\: \textbf{X} \phi \:|\: \phi \: \textbf{U} \: \psi $$ ::: - $X \phi$: **next** (demain $\phi$) - $\phi \: \textbf{U} \: \psi$: **until** (un jour $\psi$ et avant $\phi$: "toujours $\phi$ jusqu'à $\psi$") :::success abréviation - $\textbf{F} \: \varphi= \top \: \textbf{U} \: \phi$: "un jour dans le futur" - $\textbf{G} \: \varphi= \neg \: \textbf{F} \: \neg \varphi$: globaly ("toujours dans le futur)" ::: ## sémantique on interprète les formules de LTL sur une ++exécution étiquetée++ $$ \rho = s_0 \rightarrow s_1 \rightarrow s_2 \rightarrow s_3 \cdots \rightarrow s_i \rightarrow s_{i+1} \cdots $$ - $s_0$ est le présent - $s_1 \rightarrow s_2 \rightarrow s_3 \cdots$ est le futur un étiquetage de chaque état $s_j$ par les propositions atomues vraies en $s_j$ est $\ell(s_j)$ $\rho^i \text{est le i-ème suffix:} s_i \rightarrow s_{i+1} \cdots$ On interprète les formules de LTL sur une ++éxécution++ d'un diagramme d'état.\ Chaque ***s~j~** est de la forme: **(p, q, v1, v2)**. Avec: - *p* et *q* les point d'instruction de chanque processus - *v1* et *v2* les valeur de chaque variable $S_0 \in Q, \rho = s_0 \: s_1 \: s_2 \: s_3 \: s_4 \: \cdots$ une éxécution et $\ell$ un étiquetage de chaque état par des proposition atomique. - $\rho \vDash P \text{ ssi } P \in \ell(s_0)$ - $\rho \vDash \varphi \lor \psi \text{ ssi } (\rho \vDash \varphi \text{ ou } \psi \vDash \rho )$ - $\rho \vDash \lnot \varphi \text{ ssi } (\rho \nvDash \varphi)$ - $\rho \vDash \: \textbf{X} \: \varphi \text{ ssi } (\rho^1 \vDash \varphi) \qquad \text{ avec } \rho^1 = s_1 \: s_2 \: s_3 \: \cdots$ - $\rho \vDash \varphi \: \textbf{U} \: \psi \text{ ssi } \exists \, i \geq 0 \,(\rho^i \vDash \psi \text{ et } (\forall \, 0 \leq j \lt i : \rho^j \vDash \varphi))$ $\vDash$ = statisfait ### Exemple ![Imgur](https://i.imgur.com/mJO897b.png) ![Imgur](https://i.imgur.com/a5grfSk.png) ![Imgur](https://i.imgur.com/60vS8ML.png) ![Imgur](https://i.imgur.com/Y6BH0jX.png) $$ \textbf{G}(\text{probleme}) \Rightarrow \textbf{F} \text{ alarme}\\ \textbf{G}(\text{request}) \Rightarrow \textbf{F} \text{ service}\\ \textbf{G}(\neg \text{ bug}) $$ - $\textbf{G F} \text{ acceuil}$ : infiniment souvent - $\textbf{F G} \text{ ok}$: un jour toujours ok - $\textbf{G F} \text{ request} \Rightarrow \textbf{G F} \text{ service}$ - $\textbf{G F}(a \land b) \Rightarrow \textbf{G F}\text{ a } \land \textbf{G F} \text{ b}$ - $\textbf{G F}\text{ a } \land \textbf{G F} \text{ b} \nRightarrow \textbf{G F}(a \land b)$ ### Exclusion mutuelle *Jamais* les 2 process us ne se trouve en meme temps en SC. $$ \neg \textbf{F} (SC_1 \land SC_2)\\ \textbf{G} (\neg SC_1 \lor \neg SC_2) $$ ### Absence de famine Si un processus demande l'acces à la SC, il y arrivera *un jour*. $$ \textbf{G} ( D_1 \Rightarrow \textbf{F} SC_1) \land \textbf{G} ( D_1 \Rightarrow \textbf{F} SC_2) $$ ### Propriété - **propriété de sureté**\ "une mauvaise chose n'arrive jamais"\ ex: l'exlusion mutuelle - **propriété de vivacité**\ "une bonne chose fini par arriver"\ ex: absence de famine - **propriété d'équité**\ exprime une forme d'équité sur une exécution\ ex: une éxécution où les 2 processus "avancent" infiniment souvent. ## Algorithme de Peterson (1981) ![Imgur](https://i.imgur.com/XKUWs8o.png) - Exlusion mutuelle\ $G(\neg p5 \lor \neg q5)$ - Absence de famine\ $G(p2 \Rightarrow \textbf{F }p5)$ ### Exlusion mutuelle Supposons que P~2~ rejoin P~1~ en SC\ on sais que on a D1 = D2 = True\ P~2~ à franchie q4 comme D2 == True alors on a turn == 2\ donc on est passé par p3\ Comment P1 a passé p4: 1. D2 == False?\ Donc depuis, P~2~ a fait D2 := True et turn := 1\ Et P2 ne peut franchir le await... 3. turn == 1 ?\ Mais alors si turn vaut toujours 1 tant que P~1~ est en SC alors P2 ne peut pas le rejoindre ### Absense d'interblocage interblocage si:\ $$ \neg (turn == 1 \lor \neg D2) \land \neg(turn == 2 \lor \neg D1)\\ (turn \neq 1 \land D2) \land (turn \neq 2 \land D1)\\ (turn = 2 \land D2 \land turn == 1 \land D1) \qquad \textbf{faux} $$ ### Absence de famine :::success L’algo. de Peterson garantit l'absence de famine sous hypothèse: - d'équité entre processus - en supposant que: - toute section critique termine - conduit à l'exécution du post-protocole. ::: Supposons P~1~ en famine.\ Alors on a toujours $D1=\top$\ Et $D2 =\top$ et $turn == 1$ ++inifiniment souvent++. (pour ne pas pouvoir passer le await)\ $D2 =\top \Rightarrow$ P~1~ est en *q3, q4, q5, q6* - de *q3* il irait à *q4* et on a $turn == 1$ **(donc P1 peut passer)** :x: - de *q4* il irait *q5* si - $turn == 2$ *(impossible car on a exécuté *q3*)* - $D1=\bot$ *(impossible $D1=\top$) toujours* - de *q5* il irait en q6 - de *q6* il irait donc $D2=\bot$, puis irais en *q1*, puis *q2* et *q3* ### Attente borné oui il y a attente borné. ### privilege On a pas besoin d'initialiser turn donc l'algo ne **donne aucun privilège**. ## Extention de l'algorithme de Peterson ## Filter Lock ### Peterson revu ![Imgur](https://i.imgur.com/YD76idH.png) ### Algorithme ![Imgur](https://i.imgur.com/kY5dqaT.png) Définition: - un processus a passé le niveau k lorsqu’il a dépassé le « await » (p5) pour l’itération j=k. \ (et si k=0: lorsqu’il a commencé son préprotocole). - $nb_{\geq k}$ est le nombre de processus ayant passé le niveau k. #### Propriété $$ \forall \: 0 \leq j \leq n - 1, nb_{\geq j} \leq n - j $$ - $j = 0$: oui $nb_{\geq 0} \leq n$ - $j \gt 0$: par hypothèse d’induction, on sait qu’il y a au plus $n - j + 1$ processus qui ont passé le niv. $j - 1$. Supposons que tous (donc $n - j + 1$) processus aient passé le niveau j.\ Soit *P* le dernier à avoir fait $victim[j]:=id_P$\ Tout autre *P'* (au delà du niveau j) a donc fait **avant**: - $level[id_{P'}]:= j$ et ensuite: - $victim[j] := id_{P'}$ ![Imgur](https://i.imgur.com/BAT8N1n.png) #### Corrolaire $$ nb_{\geq n - 1} \leq 1. $$ ### Exclusion mutuelle On a donc bien l'exclusion mutuelle. (grace au corraolaire) ### Absence de famine L’algo. Filter Lock garantit l'absence de famine sous hypothèse d'équité entre processus et en supp. que toute SC termine (et conduit à l’exéc. du post-protocole). #### proriété Tout proc. ayant atteint le niveau $j \geq 1$, arrivera au niveau $j + 1$ (ou en SC si $j = n - 1$). $j = n - 1$ oui, il y a bien absence de famine $j < n - 1$: Soit *P* ayant atteint le niveau *j* et supposons qu’il soit bloqué dans le **await** à ce niveau pour toujours... 1. Par h.i., les proc. des niveaux supérieurs accéderont à la CS... 2. Aucun proc du niveau j-1 ne pourra accéder au niveau j (sinon victim serait mis à jour et P serait débloqué !). Donc **victim est figée**. 3. Si P n’est pas le seul au niv. j, c’est le seul à être bloqué. Et après le succès des autres, il finira par passer (∀ ...) ! [suivant](hH2Gad18QOOHxIbJMKa81A)

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully