{"id":48849,"date":"2018-08-18T11:21:02","date_gmt":"2018-08-18T05:51:02","guid":{"rendered":"https:\/\/hindi.theindianwire.com\/?p=48849"},"modified":"2018-10-06T10:20:43","modified_gmt":"2018-10-06T04:50:43","slug":"%e0%a4%a1%e0%a5%87%e0%a4%95%e0%a4%b0-%e0%a4%8f%e0%a4%b2%e0%a5%8d%e0%a4%97%e0%a5%8b%e0%a4%b0%e0%a4%bf%e0%a4%a5%e0%a4%ae","status":"publish","type":"post","link":"https:\/\/hindi.theindianwire.com\/%e0%a4%a1%e0%a5%87%e0%a4%95%e0%a4%b0-%e0%a4%8f%e0%a4%b2%e0%a5%8d%e0%a4%97%e0%a5%8b%e0%a4%b0%e0%a4%bf%e0%a4%a5%e0%a4%ae-48849\/","title":{"rendered":"\u0911\u092a\u0930\u0947\u091f\u093f\u0902\u0917 \u0938\u093f\u0938\u094d\u091f\u092e \u092e\u0947\u0902 Dekker’s \u0905\u0932\u094d\u0917\u094b\u0930\u093f\u0925\u092e \u0914\u0930 \u0909\u0938\u0915\u0947 \u0935\u0930\u094d\u091c\u0928"},"content":{"rendered":"\n

\u0921\u0947\u0915\u0930 \u090f\u0932\u094d\u0917\u094b\u0930\u093f\u0925\u092e \u0915\u093e \u092a\u0930\u093f\u091a\u092f (dekker’s algorithm in os in hindi)<\/h3>\n

\u0915\u093f\u0938\u0940 \u092d\u0940 \u0911\u092a\u0930\u0947\u091f\u093f\u0902\u0917 \u0938\u093f\u0938\u094d\u091f\u092e<\/a> \u092e\u0947\u0902 \u0915\u093f\u0938\u0940 \u0924\u0930\u0939 \u0915\u0947 \u092e\u094d\u092f\u0942\u091a\u094d\u092f\u0942\u0905\u0932 \u090f\u0915\u094d\u0938\u0915\u094d\u0932\u0942\u0936\u0928, bounded \u0935\u0947\u091f\u093f\u0902\u0917 \u0914\u0930 \u092a\u094d\u0930\u094b\u0917\u094d\u0930\u0947\u0938 \u0915\u094b \u092a\u094d\u0930\u093e\u092a\u094d\u0924 \u0915\u0930\u0928\u0947 \u0915\u0947 \u0932\u093f\u090f \u0915\u0908 \u0924\u0930\u0939 \u0915\u0947 \u0905\u0932\u094d\u0917\u094b\u0930\u093f\u0925\u092e \u0907\u092e\u092a\u094d\u0932\u0947\u092e\u0947\u0902\u091f \u0915\u093f\u092f\u0947 \u091c\u093e\u0924\u0947 \u0939\u0948\u0902 \u091c\u093f\u0928\u092e\u0947 \u0938\u0947 \u090f\u0915\u00a0\u0921\u0947\u0915\u0930 \u090f\u0932\u094d\u0917\u094b\u0930\u093f\u0925\u092e \u092d\u0940 \u0939\u0948\u0964<\/p>\n

\u0907\u0938 \u0905\u0932\u094d\u0917\u094b\u0930\u093f\u0925\u092e \u0915\u094b \u0938\u092e\u091d\u0928\u0947 \u0915\u0947 \u0932\u093f\u090f \u0938\u092c\u0938\u0947 \u092a\u0939\u0932\u0947 \u0939\u092e\u0947 \u0915\u094d\u0930\u093f\u091f\u093f\u0915\u0932 \u0938\u0947\u0915\u094d\u0936\u0928 \u0915\u0940 \u0938\u092e\u0938\u094d\u092f\u093e \u0915\u0947 \u0939\u0932 \u0915\u094b \u0938\u092e\u091d\u0928\u093e \u0939\u094b\u0917\u093e\u0964 \u0915\u093f\u0938\u0940 \u092a\u094d\u0930\u094b\u0938\u0947\u0938 \u0915\u094b \u0938\u093e\u092e\u093e\u0928\u094d\u092f\u0924\u0903 \u0910\u0938\u0947 \u0926\u093f\u0916\u093e\u0924\u0947 \u0939\u0948\u0902:<\/p>\n

do {\r\n    \/\/entry section\r\n        critical section\r\n    \/\/exit section\r\n        remainder section\r\n} while (TRUE);\r\n<\/pre>\n

\u0915\u093f\u0938\u0940 \u092d\u0940 \u0915\u094d\u0930\u093f\u091f\u093f\u0915\u0932 \u0938\u0947\u0915\u094d\u0936\u0928 \u0915\u0940 \u0938\u092e\u0938\u094d\u092f\u093e \u0915\u0947 \u0913\u0932\u0941\u0924\u093f\u0913\u0902 \u0915\u094b \u092f\u0947 \u0924\u0940\u0928 \u091a\u0940\u091c\u094b\u0902 \u0915\u094b \u0938\u0902\u0924\u0941\u0937\u094d\u091f \u0915\u0930\u0928\u093e \u0939\u094b\u0917\u093e:<\/p>\n

    \n
  1. \u092e\u094d\u092f\u0942\u091a\u094d\u092f\u0942\u0905\u0932 \u090f\u0915\u094d\u0938\u0915\u094d\u0932\u0942\u0936\u0928<\/li>\n
  2. \u092a\u094d\u0930\u094b\u0917\u094d\u0930\u0947\u0938<\/li>\n
  3. bounded \u0935\u0947\u091f\u093f\u0902\u0917<\/li>\n<\/ol>\n

    \u0907\u0928 \u0938\u092d\u0940 \u092b\u0948\u0915\u094d\u091f\u0930 \u0915\u094b \u0938\u0941\u0928\u093f\u0936\u094d\u091a\u093f\u0924 \u0915\u0930\u0928\u0947 \u0915\u093e \u090f\u0915 \u0924\u0930\u0940\u0915\u093e \u092a\u0940\u091f\u0930\u0938\u0928 \u0905\u0932\u094d\u0917\u094b\u0930\u093f\u0925\u092e \u092d\u0940 \u0939\u0948\u0964<\/p>\n

    \u0907\u0938\u0940 \u0915\u0947 \u0932\u093f\u090f Dekker\u2019s <\/b>\u0938\u0932\u0942\u0936\u0928 \u092d\u0940 \u0906\u0924\u093e \u0939\u0948\u0964 \u0907\u0938\u0947 \u0915\u094d\u0930\u093f\u091f\u093f\u0915\u0932 \u0938\u0947\u0915\u094d\u0936\u0928 \u092a\u094d\u0930\u0949\u092c\u094d\u0932\u092e \u0915\u093e \u092a\u0939\u0932\u093e \u0938\u0939\u0940 \u0938\u0932\u0942\u0936\u0928 \u092d\u0940 \u092e\u093e\u0928\u093e \u091c\u093e\u0924\u093e \u0939\u0948\u0964 \u092f\u0947 \u0926\u094b \u0925\u094d\u0930\u0947\u0921 \u0915\u094b \u090f\u0915 \u0938\u093f\u0902\u0917\u0932 \u092f\u0942\u091c \u0930\u093f\u0938\u094b\u0930\u094d\u0938 \u0915\u094b \u0936\u0947\u092f\u0930 \u0915\u0930\u0928\u0947 \u0915\u0940 \u0905\u0928\u0941\u092e\u0924\u093f \u0926\u0947\u0924\u093e \u0939\u0948 \u0914\u0930 \u0935\u094b \u092d\u0940 \u092c\u093f\u0928\u093e \u0915\u093f\u0938\u0940 \u091f\u0915\u0930\u093e\u0935 \u0915\u0947\u0964<\/p>\n

    \u0907\u0938\u092e\u0947\u0902 \u0915\u092e\u094d\u092f\u0941\u0928\u093f\u0915\u0947\u0936\u0928 \u0915\u0947 \u0932\u093f\u090f \u0915\u0947\u0935\u0932 \u0936\u0947\u092f\u0930\u094d\u0921 \u092e\u0947\u092e\u094b\u0930\u0940 \u0915\u093e \u0939\u0940 \u092a\u094d\u0930\u092f\u094b\u0917 \u0915\u093f\u092f\u093e \u091c\u093e\u0924\u093e \u0939\u0948\u0964 \u092f\u0947 \u0915\u0920\u093f\u0928 \u0914\u0930 \u0915\u093e\u092e\u094d\u092a\u094d\u0932\u0947\u0915\u094d\u0938 \u0905\u0932\u094d\u0917\u094b\u0930\u093f\u0925\u092e \u0915\u0940 \u0915\u0920\u093f\u0928\u093e\u0907\u092f\u094b\u0902 \u0938\u0947 \u0928\u093f\u0915\u0932 \u0906\u0924\u093e \u0939\u0948\u0964 \u092f\u0947 \u092e\u094d\u092f\u0942\u091a\u094d\u092f\u0942\u0905\u0932 \u090f\u0915\u094d\u0938\u0915\u094d\u0932\u0942\u0936\u0928 \u0915\u094b implement \u0915\u0930\u0928\u0947 \u0935\u093e\u0932\u0947 \u092a\u0939\u0932\u0947 \u0905\u0932\u094d\u0917\u094b\u0930\u093f\u0925\u092e \u092e\u0947\u0902 \u0938\u0947 \u090f\u0915 \u0939\u0948\u0964
    \n<\/b><\/p>\n

    \u092f\u0926\u094d\u0926\u092a\u093f \u0907\u0938 \u0905\u0932\u094d\u0917\u094b\u0930\u093f\u0925\u092e \u0915\u0947 \u092c\u0939\u0941\u0924 \u0938\u093e\u0930\u0947 \u0935\u0930\u094d\u091c\u0928 \u0939\u0948\u0902 \u0932\u0947\u0915\u093f\u0928 \u0905\u0902\u0924\u093f\u092e \u092a\u093e\u0902\u091a\u0935\u0947 \u0905\u0930\u094d\u091c\u0928 \u0915\u094b \u0939\u0940 \u0910\u0938\u093e \u092e\u0928 \u0917\u092f\u093e \u0939\u0948 \u091c\u094b \u0938\u092d\u0940 \u0909\u092a\u0930 \u0932\u093f\u0916\u0947 \u0936\u0930\u094d\u0924\u094b\u0902 \u0915\u094b \u0938\u0902\u0924\u0941\u0937\u094d\u091f \u0915\u0930\u0924\u093e \u0939\u0948 \u0914\u0930 \u0907\u0928 \u0938\u092c\u092e\u0947 \u0938\u092c\u0938\u0947 \u091c\u094d\u092f\u093e\u0926\u093e efficient \u092d\u0940 \u0939\u0948\u0964<\/p>\n

    \u0928\u094b\u091f\u2013<\/b> Dekker’s \u0905\u0932\u094d\u0917\u094b\u0930\u093f\u0925\u092e \u0938\u0932\u0942\u0936\u0928 \u091c\u094b \u092f\u0939\u093e\u0901 \u092c\u0924\u093e\u092f\u093e \u0917\u092f\u093e \u0939\u0948 \u0935\u094b \u0915\u0947\u0935\u0932 \u0926\u094b \u092a\u094d\u0930\u094b\u0938\u0947\u0938 \u0915\u0947 \u092c\u0940\u091a \u0939\u0940 \u092e\u094d\u092f\u0942\u091a\u094d\u092f\u0942\u0905\u0932 \u090f\u0915\u094d\u0938\u0915\u094d\u0932\u0942\u0936\u0928 \u0915\u094b \u0938\u0941\u0928\u093f\u0936\u094d\u091a\u093f\u0924 \u0915\u0930\u0924\u093e \u0939\u0948\u0964 \u0907\u0938\u0947 \u0910\u0930\u0947 \u0914\u0930 \u0935\u0947\u0930\u093f\u090f\u092c\u0932 \u0915\u093e \u0938\u0939\u0940 \u092a\u094d\u0930\u092f\u094b\u0917 \u0915\u0930 \u0915\u0947 \u0926\u094b \u092a\u094d\u0930\u094b\u0938\u0947\u0938 \u0938\u0947 \u091c\u094d\u092f\u093e\u0926\u093e \u092a\u0930 \u092d\u0940 \u0932\u0917\u093e\u092f\u093e \u091c\u093e \u0938\u0915\u0924\u093e \u0939\u0948\u0964<\/p>\n

    \u0905\u0932\u094d\u0917\u094b\u0930\u093f\u0925\u092e\u2013<\/b> \u0907\u0938\u0947 \u0926\u094b\u0928\u094b\u0902 \u091a\u0940\u091c\u0947\u0902 \u091a\u093e\u0939\u093f\u090f \u0939\u094b\u0924\u0940 \u0939\u0948- \u092c\u0942\u0932\u093f\u092f\u0928 \u092e\u093e\u0928 \u0915\u093e \u0910\u0930\u0947 \u0914\u0930 \u0907\u0928\u094d\u091f\u093f\u091c\u0930 \u0935\u0947\u0930\u093f\u090f\u092c\u0932\u0964<\/p>\n

    var flag: array [0..1] of boolean;\r\nturn: 0..1;\r\nrepeat\r\n\r\n        flag[i] := true;\r\n        while flag[j] do\r\n                if turn = j then\r\n                begin\r\n                        flag[i] := false;\r\n                        while turn = j do no-op;\r\n                        flag[i] := true;\r\n                end;\r\n\r\n                critical section\r\n\r\n        turn := j;\r\n        flag[i] := false;\r\n\r\n                remainder section\r\n\r\nuntil false;<\/pre>\n

    \u0921\u0947\u0915\u0930 \u090f\u0932\u094d\u0917\u094b\u0930\u093f\u0925\u092e \u0915\u093e \u092a\u0939\u0932\u093e \u0935\u0930\u094d\u091c\u0928<\/h3>\n

    \u0907\u0938\u092e\u0947\u0902 \u092a\u094d\u0930\u094b\u0938\u0947\u0938 \u0915\u0947 \u092c\u0940\u091a \u0915\u0949\u092e\u0928 \u092f\u093e \u0936\u0947\u092f\u0930\u094d\u0921 \u0925\u094d\u0930\u0947\u0921 \u0938\u0902\u0916\u094d\u092f\u093e \u0915\u093e \u092a\u094d\u0930\u092f\u094b\u0917 \u0915\u093f\u092f\u093e \u091c\u093e\u0924\u093e \u0939\u0948\u0964 \u0907\u0938\u092e\u0947\u0902 \u0905\u0917\u0930 \u0936\u0947\u092f\u0930\u094d\u0921 \u0925\u094d\u0930\u0947\u0921 \u092f\u0947 \u092c\u0924\u093e\u0924\u093e \u0939\u0948 \u0915\u093f \u092a\u0939\u0932\u0947 \u0938\u0947 \u0939\u0940 \u0905\u0917\u0930 \u0915\u094b\u0908 \u092a\u094d\u0930\u094b\u0938\u0947\u0938 \u091a\u0932 \u0930\u0939\u093e \u0939\u0948 \u0924\u094b \u092c\u093e\u0902\u0915\u0940 \u092a\u094d\u0930\u094b\u0938\u0947\u0938 \u0915\u094b \u0915\u094d\u0930\u093f\u091f\u093f\u0915\u0932 \u0938\u0947\u0915\u094d\u0936\u0928 \u092e\u0947\u0902 \u090f\u0902\u091f\u094d\u0930\u0940 \u0932\u0947\u0928\u0947 \u0938\u0947 \u0930\u094b\u0915 \u0926\u093f\u092f\u093e \u091c\u093e\u0924\u093e \u0939\u0948\u0964<\/p>\n

    \n
    Main()<\/code><\/div>\n
    {<\/code><\/div>\n
    <\/div>\n
    int<\/code> thread_number = 1;<\/code><\/div>\n
    startThreads();<\/code><\/div>\n
    }<\/code><\/div>\n
    <\/div>\n
    Thread1()<\/code><\/div>\n
    {<\/code><\/div>\n
    do<\/code> {<\/code><\/div>\n
    <\/div>\n
    \/\/ entry section<\/code><\/div>\n
    \/\/ wait until threadnumber is 1<\/code><\/div>\n
    while<\/code> (threadnumber == 2)<\/code><\/div>\n
    ;<\/code><\/div>\n
    <\/div>\n
    \/\/ critical section<\/code><\/div>\n
    <\/div>\n
    \/\/ exit section<\/code><\/div>\n
    \/\/ give access to the other thread<\/code><\/div>\n
    threadnumber = 2;<\/code><\/div>\n
    <\/div>\n
    \/\/ remainder section<\/code><\/div>\n
    <\/div>\n
    } <\/code>while<\/code> (completed == <\/code>false<\/code>)<\/code><\/div>\n
    }<\/code><\/div>\n
    <\/div>\n
    Thread2()<\/code><\/div>\n
    {<\/code><\/div>\n
    <\/div>\n
    do<\/code> {<\/code><\/div>\n
    <\/div>\n
    \/\/ entry section<\/code><\/div>\n
    \/\/ wait until threadnumber is 2<\/code><\/div>\n
    while<\/code> (threadnumber == 1)<\/code><\/div>\n
    ;<\/code><\/div>\n
    <\/div>\n
    \/\/ critical section<\/code><\/div>\n
    <\/div>\n
    \/\/ exit section<\/code><\/div>\n
    \/\/ give access to the other thread<\/code><\/div>\n
    threadnumber = 1;<\/code><\/div>\n
    <\/div>\n
    \/\/ remainder section<\/code><\/div>\n
    <\/div>\n
    } <\/code>while<\/code> (completed == <\/code>false<\/code>)<\/code><\/div>\n
    }<\/code><\/div>\n<\/div>\n
    <\/div>\n
    \u0909\u092a\u0930 \u0935\u093e\u0932\u0947 \u0907\u092e\u094d\u092a\u094d\u0932\u0940\u092e\u0947\u0902\u091f\u0947\u0936\u0928 \u092e\u0947\u0902 \u092f\u0947 \u0938\u092e\u0938\u094d\u092f\u093e \u0906\u0924\u0940 \u0939\u0948 \u0915\u093f \u092f\u0947 \u0932\u0949\u0915\u0938\u094d\u091f\u0947\u092a \u0938\u093f\u0902\u0915\u094d\u0930\u094b\u0928\u093e\u0907\u091c\u0947\u0936\u0928 \u0939\u0948 \u092f\u093e\u0928\u0940 \u0915\u093f \u0907\u0938\u092e\u0947\u0902 \u0939\u0930 \u090f\u0915 \u0925\u094d\u0930\u0947\u0921 execution \u0915\u0947 \u0932\u093f\u090f \u0926\u0942\u0938\u0930\u0947 \u092a\u0930 \u0928\u093f\u0930\u094d\u092d\u0930 \u0939\u094b\u0924\u093e \u0939\u0948\u0964 \u0905\u0917\u0930 \u0909\u0928\u092e\u0947 \u0938\u0947 \u0915\u094b\u0908 \u090f\u0915 \u092a\u094d\u0930\u094b\u0938\u0947\u0938 \u092a\u0942\u0930\u093e \u0939\u094b \u091c\u093e\u0924\u093e \u0939\u0948 \u0924\u094b \u0926\u0942\u0938\u0930\u093e \u092a\u094d\u0930\u094b\u0938\u0947\u0938 \u0930\u0928 \u0939\u094b\u0924\u093e \u0939\u0948 \u0914\u0930 \u090f\u0915 \u0915\u094b \u092a\u0942\u0930\u093e \u090f\u0915\u094d\u0938\u0947\u0938 \u0926\u0947 \u0926\u0947\u0924\u093e \u0939\u0948 \u0914\u0930 \u0905\u092a\u0928\u0940 \u092c\u093e\u0930\u0940 \u0915\u093e \u0907\u0928\u094d\u0924\u091c\u093e\u0930 \u0915\u0930\u0924\u093e \u0939\u0948\u0964 \u091c\u092c\u0915\u093f \u092a\u0939\u0932\u093e \u092a\u094d\u0930\u094b\u0938\u0947\u0938 \u092a\u0939\u0932\u0947 \u0939\u0940 \u092a\u0942\u0930\u093e \u0939\u094b \u091c\u093e\u0924\u093e \u0939\u0948 \u0914\u0930 \u0914\u0930 \u090f\u0915\u094d\u0938\u0947\u0938 \u0915\u094b \u0926\u0942\u0938\u0930\u0947 \u0935\u093e\u0932\u0947 \u0915\u094b \u0915\u092d\u0940 \u0935\u093e\u092a\u0938 \u0928\u0939\u0940\u0902 \u0915\u0930\u0924\u093e\u0964 \u0907\u0938\u0940\u0932\u093f\u090f \u0926\u0942\u0938\u0930\u093e \u092a\u094d\u0930\u094b\u0938\u0947\u0938 \u0939\u092e\u0947\u0936\u093e \u0915\u0947 \u0932\u093f\u090f \u0907\u0928\u094d\u0924\u091c\u093e\u0930 \u0939\u0940 \u0915\u0930\u0924\u093e \u0930\u0939 \u091c\u093e\u0924\u093e \u0939\u0948\u0964<\/div>\n

    \u0921\u0947\u0915\u0930 \u090f\u0932\u094d\u0917\u094b\u0930\u093f\u0925\u092e \u0915\u093e \u0926\u0942\u0938\u0930\u093e \u0935\u0930\u094d\u091c\u0928<\/h3>\n

    \u0932\u0949\u0915\u0938\u094d\u091f\u0947\u092a \u0938\u093f\u0902\u0915\u094d\u0930\u094b\u0928\u093e\u0907\u091c\u0947\u0936\u0928 \u0915\u094b \u0939\u091f\u093e\u0928\u0947 \u0915\u0947 \u0932\u093f\u090f \u092f\u0947 \u0926\u094b \u092b\u094d\u0932\u0948\u0917 \u0915\u093e \u092a\u094d\u0930\u092f\u094b\u0917 \u0915\u0930\u0924\u093e \u0939\u0948 \u091c\u094b \u0907\u0938\u0915\u093e \u0905\u092d\u0940 \u0915\u093e \u0938\u094d\u091f\u0947\u091f\u0938 \u0926\u093f\u0916\u093e\u0924\u093e \u0939\u0948 \u0914\u0930 \u090f\u0902\u091f\u094d\u0930\u0940 \u0914\u0930 \u090f\u0917\u094d\u091c\u093f\u091f \u0935\u093e\u0932\u0947 \u0938\u0947\u0915\u094d\u0936\u0928 \u092a\u0930 \u0909\u0928\u094d\u0939\u0947\u0902 \u0905\u092a\u0921\u0947\u091f \u0915\u0930\u0924\u093e \u0939\u0948\u0964<\/p>\n

    \n
    Main()<\/code><\/div>\n
    {<\/code><\/div>\n
    <\/div>\n
    \/\/ flags to indicate if each thread is in<\/code><\/div>\n
    \/\/ its critial section or not.<\/code><\/div>\n
    boolean thread1 = <\/code>false<\/code>;<\/code><\/div>\n
    boolean thread2 = <\/code>false<\/code>;<\/code><\/div>\n
    <\/div>\n
    startThreads();<\/code><\/div>\n
    }<\/code><\/div>\n
    <\/div>\n
    Thread1()<\/code><\/div>\n
    {<\/code><\/div>\n
    <\/div>\n
    do<\/code> {<\/code><\/div>\n
    <\/div>\n
    \/\/ entry section<\/code><\/div>\n
    \/\/ wait until thread2 is in its critical section<\/code><\/div>\n
    while<\/code> (thread2 == <\/code>true<\/code>)<\/code><\/div>\n
    ;<\/code><\/div>\n
    <\/div>\n
    \/\/ indicate thread1 entering its critical section<\/code><\/div>\n
    thread1 = <\/code>true<\/code>;<\/code><\/div>\n
    <\/div>\n
    \/\/ critical section<\/code><\/div>\n
    <\/div>\n
    \/\/ exit section<\/code><\/div>\n
    \/\/ indicate thread1 exiting its critical section<\/code><\/div>\n
    thread1 = <\/code>false<\/code>;<\/code><\/div>\n
    <\/div>\n
    \/\/ remainder section<\/code><\/div>\n
    <\/div>\n
    } <\/code>while<\/code> (completed == <\/code>false<\/code>)<\/code><\/div>\n
    }<\/code><\/div>\n
    <\/div>\n
    Thread2()<\/code><\/div>\n
    {<\/code><\/div>\n
    <\/div>\n
    do<\/code> {<\/code><\/div>\n
    <\/div>\n
    \/\/ entry section<\/code><\/div>\n
    \/\/ wait until thread1 is in its critical section<\/code><\/div>\n
    while<\/code> (thread1 == <\/code>true<\/code>)<\/code><\/div>\n
    ;<\/code><\/div>\n
    <\/div>\n
    \/\/ indicate thread2 entering its critical section<\/code><\/div>\n
    thread2 = <\/code>true<\/code>;<\/code><\/div>\n
    <\/div>\n
    \/\/ critical section<\/code><\/div>\n
    <\/div>\n
    \/\/ exit section<\/code><\/div>\n
    \/\/ indicate thread2 exiting its critical section<\/code><\/div>\n
    thread2 = <\/code>false<\/code>;<\/code><\/div>\n
    <\/div>\n
    \/\/ remainder section<\/code><\/div>\n
    <\/div>\n
    } <\/code>while<\/code> (completed == <\/code>false<\/code>)<\/code><\/div>\n
    }<\/code><\/div>\n<\/div>\n
    <\/div>\n
    \u0907\u0938 \u0935\u093e\u0932\u0947 \u0935\u0930\u094d\u091c\u0928 \u092e\u0947\u0902 \u092f\u0947 \u0938\u092e\u0938\u094d\u092f\u093e \u0906\u0924\u0940 \u0939\u0948 \u0915\u093f \u0907\u0938\u092e\u0947\u0902 \u092e\u094d\u092f\u0942\u091a\u094d\u092f\u0942\u0905\u0932 \u090f\u0915\u094d\u0938\u0915\u094d\u0932\u0942\u0936\u0928 \u0939\u0940 \u0938\u092e\u0938\u094d\u092f\u093e \u0915\u095c\u0940 \u0915\u0930 \u0926\u0947\u0924\u093e \u0939\u0948\u0964<\/div>\n
    <\/div>\n
    \u0905\u0917\u0930 \u0925\u094d\u0930\u0947\u0921 \u0915\u094b \u092a\u094d\u092b\u094d\u0932\u0948\u0917 \u0905\u092a\u0921\u0947\u091f \u0915\u0930\u0928\u0947 \u0915\u0947 \u0926\u094c\u0930\u093e\u0928 ( current_thread = true \u0915\u0947 \u0926\u094c\u0930\u093e\u0928) \u0930\u0940\u092e\u094d\u092a\u094d\u091f \u0915\u093f\u092f\u093e \u091c\u093e\u0924\u093e \u0939\u0948 \u092f\u093e\u0928\u0940 \u0915\u093f \u0930\u094b\u0915\u093e \u091c\u093e\u0924\u093e \u0939\u0948 \u0924\u092c \u0926\u094b\u0928\u094b\u0902 \u0939\u0940 \u0925\u094d\u0930\u0947\u0921 \u0905\u092a\u0928\u0947 \u0915\u094d\u0930\u093f\u091f\u093f\u0915\u0932 \u0938\u0947\u0915\u094d\u0936\u0928 \u092e\u0947\u0902 \u091a\u0932\u0947 \u091c\u093e\u0924\u0947 \u0939\u0948\u0902\u0964<\/div>\n
    <\/div>\n
    \u092b\u093f\u0930 \u091c\u092c \u092a\u094d\u0930\u0940\u092e\u094d\u092a\u094d\u091f \u0915\u093f\u092f\u0947 \u0939\u0941\u090f \u0925\u094d\u0930\u0947\u0921 \u0915\u094b \u091c\u092c \u092b\u093f\u0930 \u0938\u0947 \u0936\u0941\u0930\u0942 \u0915\u093f\u092f\u093e \u091c\u093e\u0924\u093e \u0939\u0948 \u0924\u094b \u0907\u090f \u0938\u094d\u091f\u093e\u0930\u094d\u091f \u092a\u0930 \u092d\u0940 \u0910\u0938\u0947 \u0939\u0940 \u0926\u0947\u0916\u093e \u091c\u093e \u0938\u0915\u0924\u093e \u0939\u0948 \u091c\u092c \u0926\u094b\u0928\u094b\u0902 \u092b\u094d\u0932\u0948\u0917 false \u0939\u094b \u091c\u093e\u090f\u0901\u0964<\/div>\n

    \u0921\u0947\u0915\u0930 \u090f\u0932\u094d\u0917\u094b\u0930\u093f\u0925\u092e \u0915\u093e \u0924\u0940\u0938\u0930\u093e \u0935\u0930\u094d\u091c\u0928<\/h3>\n

    \u092e\u094d\u092f\u0942\u091a\u094d\u092f\u0942\u0905\u0932 \u090f\u0915\u094d\u0938\u0915\u094d\u0932\u0942\u0936\u0928 \u0915\u094b \u092b\u093f\u0930 \u0938\u0947 \u0938\u0941\u0928\u093f\u0936\u094d\u091a\u093f\u0924 \u0915\u0930\u0928\u0947 \u0915\u0947 \u0932\u093f\u090f \u092f\u0947 \u092b\u094d\u0932\u0948\u0917 \u0915\u094b \u090f\u0902\u091f\u094d\u0930\u0940 \u0938\u0947\u0915\u094d\u0936\u0928 \u0938\u0947 \u092a\u0939\u0932\u0947 \u0939\u0940 \u0938\u0947\u091f \u0915\u0930 \u0926\u0947\u0924\u093e \u0939\u0948\u0964<\/p>\n

    \n
    Main()<\/code><\/div>\n
    {<\/code><\/div>\n
    <\/div>\n
    \/\/ flags to indicate if each thread is in<\/code><\/div>\n
    \/\/ queue to enter its critical section<\/code><\/div>\n
    boolean thread1wantstoenter = <\/code>false<\/code>;<\/code><\/div>\n
    boolean thread2wantstoenter = <\/code>false<\/code>;<\/code><\/div>\n
    <\/div>\n
    startThreads();<\/code><\/div>\n
    }<\/code><\/div>\n
    <\/div>\n
    Thread1()<\/code><\/div>\n
    {<\/code><\/div>\n
    <\/div>\n
    do<\/code> {<\/code><\/div>\n
    <\/div>\n
    thread1wantstoenter = <\/code>true<\/code>;<\/code><\/div>\n
    <\/div>\n
    \/\/ entry section<\/code><\/div>\n
    \/\/ wait until thread2 wants to enter<\/code><\/div>\n
    \/\/ its critical section<\/code><\/div>\n
    while<\/code> (thread2wantstoenter == <\/code>true<\/code>)<\/code><\/div>\n
    ;<\/code><\/div>\n
    <\/div>\n
    \/\/ critical section<\/code><\/div>\n
    <\/div>\n
    \/\/ exit section<\/code><\/div>\n
    \/\/ indicate thread1 has completed<\/code><\/div>\n
    \/\/ its critical section<\/code><\/div>\n
    thread1wantstoenter = <\/code>false<\/code>;<\/code><\/div>\n
    <\/div>\n
    \/\/ remainder section<\/code><\/div>\n
    <\/div>\n
    } <\/code>while<\/code> (completed == <\/code>false<\/code>)<\/code><\/div>\n
    }<\/code><\/div>\n
    <\/div>\n
    Thread2()<\/code><\/div>\n
    {<\/code><\/div>\n
    <\/div>\n
    do<\/code> {<\/code><\/div>\n
    <\/div>\n
    thread2wantstoenter = <\/code>true<\/code>;<\/code><\/div>\n
    <\/div>\n
    \/\/ entry section<\/code><\/div>\n
    \/\/ wait until thread1 wants to enter<\/code><\/div>\n
    \/\/ its critical section<\/code><\/div>\n
    while<\/code> (thread1wantstoenter == <\/code>true<\/code>)<\/code><\/div>\n
    ;<\/code><\/div>\n
    <\/div>\n
    \/\/ critical section<\/code><\/div>\n
    <\/div>\n
    \/\/ exit section<\/code><\/div>\n
    \/\/ indicate thread2 has completed<\/code><\/div>\n
    \/\/ its critical section<\/code><\/div>\n
    thread2wantstoenter = <\/code>false<\/code>;<\/code><\/div>\n
    <\/div>\n
    \/\/ remainder section<\/code><\/div>\n
    <\/div>\n
    } <\/code>while<\/code> (completed == <\/code>false<\/code>)<\/code><\/div>\n
    }<\/code><\/div>\n<\/div>\n
    <\/div>\n
    \u0921\u0947\u0921\u0932\u0949\u0915<\/a> \u0915\u0940 \u0938\u092e\u094d\u092d\u093e\u0935\u0928\u093e \u0907\u0938 \u0935\u0930\u094d\u091c\u0928 \u0915\u0947 \u0938\u093e\u0925 \u090f\u0915 \u092c\u095c\u0940 \u0938\u092e\u0938\u094d\u092f\u093e \u0939\u0948\u0964 \u0926\u094b\u0928\u094b\u0902 \u092b\u094d\u0932\u0948\u0917 \u090f\u0915 \u0938\u093e\u0925 \u0905\u092a\u0928\u0947-\u0905\u092a\u0928\u0947 \u092b\u094d\u0932\u0948\u0917 \u0915\u094b \u091f\u094d\u0930\u0942 \u0938\u0947\u091f \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902 \u0914\u0930 \u0907\u0938 \u0924\u0930\u0939 \u0938\u0947 \u0926\u094b\u0928\u094b\u0902 \u0939\u0940 \u0939\u092e\u0947\u0936\u093e-\u0939\u092e\u0947\u0936\u093e \u0915\u0947 \u0932\u093f\u090f \u0907\u0928\u094d\u0924\u091c\u093e\u0930 \u0915\u0930\u0924\u0947 \u0939\u0940 \u0930\u0939 \u091c\u093e\u092f\u0947\u0902\u0917\u0947\u0964<\/div>\n

    \u0921\u0947\u0915\u0930 \u090f\u0932\u094d\u0917\u094b\u0930\u093f\u0925\u092e \u0915\u093e \u091a\u094c\u0925\u093e \u0935\u0930\u094d\u091c\u0928<\/h3>\n

    \u092f\u0947 \u0915\u0902\u0921\u0940\u0936\u0928 \u0915\u094b \u092b\u093f\u0930 \u0938\u0947 \u091a\u0947\u0915 \u0915\u0930\u0928\u0947 \u0915\u0947 \u0932\u093f\u090f \u090f\u0915 \u091b\u094b\u091f\u0947 \u0907\u0902\u091f\u0930\u0935\u0932 \u0915\u093e \u092a\u094d\u0930\u092f\u094b\u0917 \u0915\u0930\u0924\u093e \u0939\u0948\u0964 \u092f\u0947 \u0921\u0947\u0921\u0932\u0949\u0915 \u0915\u094b \u0939\u091f\u0924\u093e \u0939\u0948 \u0914\u0930 \u092e\u094d\u092f\u0942\u091a\u094d\u092f\u0942\u0905\u0932 \u090f\u0915\u094d\u0938\u0915\u094d\u0932\u0942\u0936\u0928 \u092d\u0940 \u0938\u0941\u0928\u093f\u0936\u094d\u091a\u093f\u0924 \u0915\u0930\u0924\u093e \u0939\u0948\u0964<\/p>\n

    \n
    Main()<\/code><\/div>\n
    {<\/code><\/div>\n
    <\/div>\n
    \/\/ flags to indicate if each thread is in<\/code><\/div>\n
    \/\/ queue to enter its critical section<\/code><\/div>\n
    boolean thread1wantstoenter = <\/code>false<\/code>;<\/code><\/div>\n
    boolean thread2wantstoenter = <\/code>false<\/code>;<\/code><\/div>\n
    <\/div>\n
    startThreads();<\/code><\/div>\n
    }<\/code><\/div>\n
    <\/div>\n
    Thread1()<\/code><\/div>\n
    {<\/code><\/div>\n
    <\/div>\n
    do<\/code> {<\/code><\/div>\n
    <\/div>\n
    thread1wantstoenter = <\/code>true<\/code>;<\/code><\/div>\n
    <\/div>\n
    while<\/code> (thread2wantstoenter == <\/code>true<\/code>) {<\/code><\/div>\n
    <\/div>\n
    \/\/ gives access to other thread<\/code><\/div>\n
    \/\/ wait for random amount of time<\/code><\/div>\n
    thread1wantstoenter = <\/code>false<\/code>;<\/code><\/div>\n
    <\/div>\n
    thread1wantstoenter = <\/code>true<\/code>;<\/code><\/div>\n
    }<\/code><\/div>\n
    <\/div>\n
    \/\/ entry section<\/code><\/div>\n
    \/\/ wait until thread2 wants to enter<\/code><\/div>\n
    \/\/ its critical section<\/code><\/div>\n
    <\/div>\n
    \/\/ critical section<\/code><\/div>\n
    <\/div>\n
    \/\/ exit section<\/code><\/div>\n
    \/\/ indicate thread1 has completed<\/code><\/div>\n
    \/\/ its critical section<\/code><\/div>\n
    thread1wantstoenter = <\/code>false<\/code>;<\/code><\/div>\n
    <\/div>\n
    \/\/ remainder section<\/code><\/div>\n
    <\/div>\n
    } <\/code>while<\/code> (completed == <\/code>false<\/code>)<\/code><\/div>\n
    }<\/code><\/div>\n
    <\/div>\n
    Thread2()<\/code><\/div>\n
    {<\/code><\/div>\n
    <\/div>\n
    do<\/code> {<\/code><\/div>\n
    <\/div>\n
    thread2wantstoenter = <\/code>true<\/code>;<\/code><\/div>\n
    <\/div>\n
    while<\/code> (thread1wantstoenter == <\/code>true<\/code>) {<\/code><\/div>\n
    <\/div>\n
    \/\/ gives access to other thread<\/code><\/div>\n
    \/\/ wait for random amount of time<\/code><\/div>\n
    thread2wantstoenter = <\/code>false<\/code>;<\/code><\/div>\n
    <\/div>\n
    thread2wantstoenter = <\/code>true<\/code>;<\/code><\/div>\n
    }<\/code><\/div>\n
    <\/div>\n
    \/\/ entry section<\/code><\/div>\n
    \/\/ wait until thread1 wants to enter<\/code><\/div>\n
    \/\/ its critical section<\/code><\/div>\n
    <\/div>\n
    \/\/ critical section<\/code><\/div>\n
    <\/div>\n
    \/\/ exit section<\/code><\/div>\n
    \/\/ indicate thread2 has completed<\/code><\/div>\n
    \/\/ its critical section<\/code><\/div>\n
    thread2wantstoenter = <\/code>false<\/code>;<\/code><\/div>\n
    <\/div>\n
    \/\/ remainder section<\/code><\/div>\n
    <\/div>\n
    } <\/code>while<\/code> (completed == <\/code>false<\/code>)<\/code><\/div>\n
    }<\/code><\/div>\n<\/div>\n
    <\/div>\n
    \u0907\u0938 \u0935\u0930\u094d\u091c\u0928 \u0915\u0947 \u0938\u093e\u0925 \u092f\u0947 \u0938\u092e\u0938\u094d\u092f\u093e \u0939\u0948 \u0915\u093f \u092f\u0947 \u0939\u092e\u0947\u0936\u093e \u0915\u0947 \u0932\u093f\u090f \u0930\u0941\u0915 \u0938\u0915\u0924\u093e \u0939\u0948\u0964 \u0907\u0938\u0915\u0947 \u0905\u0932\u093e\u0935\u0947 \u0915\u0941\u091b \u092e\u093e\u0924\u094d\u0930\u093e \u092e\u0947\u0902 \u0938\u092e\u092f \u0917\u0932\u0924 \u0939\u094b \u091c\u093e\u0924\u093e \u0939\u0948 \u091c\u094b \u0915\u093f \u0905\u0932\u094d\u0917\u094b\u0930\u093f\u0925\u092e \u0915\u093f\u0938 \u0938\u094d\u0925\u093f\u0924\u093f \u092e\u0947\u0902 \u0907\u092e\u092a\u094d\u0932\u0947\u092e\u0947\u0902\u091f \u0915\u093f\u092f\u093e \u091c\u093e\u0924\u093e \u0939\u0948 \u0907\u0938 \u092a\u0930 \u0928\u093f\u0930\u094d\u092d\u0930 \u0915\u0930\u0924\u093e \u0939\u0948\u0964 \u0907\u0938\u0940\u0932\u093f\u090f \u0907\u0938\u0947 \u092c\u093f\u095b\u0928\u0938 \u0915\u094d\u0930\u093f\u091f\u093f\u0915\u0932 \u0938\u093f\u0938\u094d\u091f\u092e \u092e\u0947\u0902 \u0915\u092d\u0940 \u0938\u094d\u0935\u0940\u0915\u093e\u0930 \u0928\u0939\u0940\u0902 \u0915\u093f\u092f\u093e \u091c\u093e \u0938\u0915\u0924\u093e\u0964<\/div>\n

    \u0921\u0947\u0915\u0930 \u090f\u0932\u094d\u0917\u094b\u0930\u093f\u0925\u092e \u0915\u093e \u092a\u093e\u0902\u091a\u0935\u093e \u0935\u0930\u094d\u091c\u0928<\/h3>\n

    \u0907\u0938\u092e\u0947\u0902 \u092b\u0935\u094c\u0930 \u0915\u093f\u092f\u0947 \u0939\u0941\u090f \u0925\u094d\u0930\u0947\u0921 \u0915\u093e \u092a\u094d\u0930\u092f\u094b\u0917 \u0915\u0930\u0924\u0947 \u0939\u0948\u0902 \u0924\u093e\u0915\u093f \u0915\u094d\u0930\u093f\u091f\u093f\u0915\u0932 \u0938\u0947\u0915\u094d\u0936\u0928 \u092e\u0947\u0902 \u090f\u0902\u091f\u094d\u0930\u0940 \u0915\u0930\u0928\u0947 \u0915\u094b \u0924\u092f \u0915\u093f\u092f\u093e \u091c\u093e \u0938\u0915\u0947\u0964<\/p>\n

    \u092b\u0935\u094c\u0930 \u0915\u093f\u092f\u093e \u0939\u0941\u0906 \u0925\u094d\u0930\u0947\u0921 \u092e\u094d\u092f\u0942\u091a\u094d\u092f\u0942\u0905\u0932 \u090f\u0915\u094d\u0938\u0915\u094d\u0932\u0942\u0936\u0928 \u0926\u0947\u0928\u0947 \u0935\u093e\u0932\u0947 \u0925\u094d\u0930\u0947\u0921 \u0914\u0930 \u0921\u0947\u0921\u0932\u0949\u0915 \u0905\u0935\u0949\u092f\u0921 \u0915\u0930\u0928\u0947 \u0915\u0947 \u092c\u0940\u091a \u092e\u0947\u0902 \u0918\u0942\u092e\u0924\u093e \u0939\u0948\u0964<\/p>\n

    \u0907\u0938\u092e\u0947\u0902 \u0939\u092e\u0947\u0936\u093e \u0915\u0947 \u0932\u093f\u090f \u092a\u094d\u0930\u094b\u0938\u0947\u0938 \u0915\u093e \u0930\u0941\u0915 \u091c\u093e\u0928\u093e \u0914\u0930 \u0932\u0949\u0915\u0938\u094d\u091f\u0947\u092a \u0938\u093f\u0902\u0915\u094d\u0930\u094b\u0928\u093e\u0907\u091c\u0947\u0936\u0928 \u092d\u0940 \u0928\u0939\u0940\u0902 \u0939\u094b\u0924\u093e \u0939\u0948\u0964<\/p>\n

    Main()<\/code><\/div>\n
    {<\/code><\/div>\n
    <\/div>\n
    \u00a0\u00a0\u00a0\u00a0<\/code>\/\/ to denote which thread will enter next<\/code><\/div>\n
    \u00a0\u00a0\u00a0\u00a0<\/code>int<\/code> favouredthread = 1;<\/code><\/div>\n
    <\/div>\n
    \u00a0\u00a0\u00a0\u00a0<\/code>\/\/ flags to indicate if each thread is in<\/code><\/div>\n
    \u00a0\u00a0\u00a0\u00a0<\/code>\/\/ queue to enter its critical section<\/code><\/div>\n
    \u00a0\u00a0\u00a0\u00a0<\/code>boolean thread1wantstoenter = <\/code>false<\/code>;<\/code><\/div>\n
    \u00a0\u00a0\u00a0\u00a0<\/code>boolean thread2wantstoenter = <\/code>false<\/code>;<\/code><\/div>\n
    <\/div>\n
    \u00a0\u00a0\u00a0\u00a0<\/code>startThreads();<\/code><\/div>\n
    }<\/code><\/div>\n
    <\/div>\n
    Thread1()<\/code><\/div>\n
    {<\/code><\/div>\n
    \u00a0\u00a0\u00a0\u00a0<\/code>do<\/code> {<\/code><\/div>\n
    <\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>thread1wantstoenter = <\/code>true<\/code>;<\/code><\/div>\n
    <\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>\/\/ entry section<\/code><\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>\/\/ wait until thread2 wants to enter<\/code><\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>\/\/ its critical section<\/code><\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>while<\/code> (thread2wantstoenter == <\/code>true<\/code>) {<\/code><\/div>\n
    <\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>\/\/ if 2nd thread is more favored<\/code><\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>if<\/code> (favaouredthread == 2) {<\/code><\/div>\n
    <\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>\/\/ gives access to other thread<\/code><\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>thread1wantstoenter = <\/code>false<\/code>;<\/code><\/div>\n
    <\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>\/\/ wait until this thread is favored<\/code><\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>while<\/code> (favouredthread == 2)<\/code><\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>;<\/code><\/div>\n
    <\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>thread1wantstoenter = <\/code>true<\/code>;<\/code><\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>}<\/code><\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>}<\/code><\/div>\n
    <\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>\/\/ critical section<\/code><\/div>\n
    <\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>\/\/ favor the 2nd thread<\/code><\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>favouredthread = 2;<\/code><\/div>\n
    <\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>\/\/ exit section<\/code><\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>\/\/ indicate thread1 has completed<\/code><\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>\/\/ its critical section<\/code><\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>thread1wantstoenter = <\/code>false<\/code>;<\/code><\/div>\n
    <\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>\/\/ remainder section<\/code><\/div>\n
    <\/div>\n
    \u00a0\u00a0\u00a0\u00a0<\/code>} <\/code>while<\/code> (completed == <\/code>false<\/code>)<\/code><\/div>\n
    }<\/code><\/div>\n
    <\/div>\n
    Thread2()<\/code><\/div>\n
    {<\/code><\/div>\n
    <\/div>\n
    \u00a0\u00a0\u00a0\u00a0<\/code>do<\/code> {<\/code><\/div>\n
    <\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>thread2wantstoenter = <\/code>true<\/code>;<\/code><\/div>\n
    <\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>\/\/ entry section<\/code><\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>\/\/ wait until thread1 wants to enter<\/code><\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>\/\/ its critical section<\/code><\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>while<\/code> (thread1wantstoenter == <\/code>true<\/code>) {<\/code><\/div>\n
    <\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>\/\/ if 1st thread is more favored<\/code><\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>if<\/code> (favaouredthread == 1) {<\/code><\/div>\n
    <\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>\/\/ gives access to other thread<\/code><\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>thread2wantstoenter = <\/code>false<\/code>;<\/code><\/div>\n
    <\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>\/\/ wait until this thread is favored<\/code><\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>while<\/code> (favouredthread == 1)<\/code><\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>;<\/code><\/div>\n
    <\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>thread2wantstoenter = <\/code>true<\/code>;<\/code><\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>}<\/code><\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>}<\/code><\/div>\n
    <\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>\/\/ critical section<\/code><\/div>\n
    <\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>\/\/ favour the 1st thread<\/code><\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>favouredthread = 1;<\/code><\/div>\n
    <\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>\/\/ exit section<\/code><\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>\/\/ indicate thread2 has completed<\/code><\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>\/\/ its critical section<\/code><\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>thread2wantstoenter = <\/code>false<\/code>;<\/code><\/div>\n
    <\/div>\n
    \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/code>\/\/ remainder section<\/code><\/div>\n
    <\/div>\n
    \n

    \u00a0\u00a0\u00a0\u00a0<\/code>} <\/code>while<\/code> (completed == <\/code>false<\/code>)<\/code><\/p>\n

    \u092f\u0947 \u0935\u0930\u094d\u091c\u0928 \u0938\u092e\u0938\u094d\u092f\u093e \u0915\u0947 \u092a\u0942\u0930\u0947 \u0938\u092e\u093e\u0927\u093e\u0928 \u0915\u093f \u0917\u093e\u0930\u0902\u091f\u0940 \u0926\u0947\u0924\u093e \u0939\u0948\u0964<\/p>\n

    \u0907\u0938 \u0932\u0947\u0916 \u0938\u0947 \u0938\u092e\u094d\u092c\u0902\u0927\u093f\u0924 \u092f\u0926\u093f \u0906\u092a\u0915\u093e \u0915\u094b\u0908 \u092d\u0940 \u0938\u0935\u093e\u0932 \u092f\u093e \u0938\u0941\u091d\u093e\u0935 \u0939\u0948, \u0924\u094b \u0906\u092a \u0909\u0938\u0947 \u0928\u0940\u091a\u0947 \u0915\u092e\u0947\u0902\u091f \u092e\u0947\u0902 \u0932\u093f\u0916 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902\u0964<\/em><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"

    \u0921\u0947\u0915\u0930 \u090f\u0932\u094d\u0917\u094b\u0930\u093f\u0925\u092e \u0915\u093e \u092a\u0930\u093f\u091a\u092f (dekker’s algorithm in os in hindi) \u0915\u093f\u0938\u0940 \u092d\u0940 \u0911\u092a\u0930\u0947\u091f\u093f\u0902\u0917 \u0938\u093f\u0938\u094d\u091f\u092e \u092e\u0947\u0902 \u0915\u093f\u0938\u0940 \u0924\u0930\u0939 \u0915\u0947 \u092e\u094d\u092f\u0942\u091a\u094d\u092f\u0942\u0905\u0932 \u090f\u0915\u094d\u0938\u0915\u094d\u0932\u0942\u0936\u0928, bounded \u0935\u0947\u091f\u093f\u0902\u0917 \u0914\u0930 \u092a\u094d\u0930\u094b\u0917\u094d\u0930\u0947\u0938 \u0915\u094b \u092a\u094d\u0930\u093e\u092a\u094d\u0924 \u0915\u0930\u0928\u0947 \u0915\u0947 \u0932\u093f\u090f \u0915\u0908 \u0924\u0930\u0939 \u0915\u0947 \u0905\u0932\u094d\u0917\u094b\u0930\u093f\u0925\u092e \u0907\u092e\u092a\u094d\u0932\u0947\u092e\u0947\u0902\u091f \u0915\u093f\u092f\u0947 \u091c\u093e\u0924\u0947 \u0939\u0948\u0902 \u091c\u093f\u0928\u092e\u0947 \u0938\u0947 \u090f\u0915\u00a0\u0921\u0947\u0915\u0930 \u090f\u0932\u094d\u0917\u094b\u0930\u093f\u0925\u092e \u092d\u0940 \u0939\u0948\u0964 \u0907\u0938 \u0905\u0932\u094d\u0917\u094b\u0930\u093f\u0925\u092e \u0915\u094b \u0938\u092e\u091d\u0928\u0947 \u0915\u0947 \u0932\u093f\u090f \u0938\u092c\u0938\u0947 \u092a\u0939\u0932\u0947 \u0939\u092e\u0947 \u0915\u094d\u0930\u093f\u091f\u093f\u0915\u0932 \u0938\u0947\u0915\u094d\u0936\u0928 \u0915\u0940 […]<\/p>\n","protected":false},"author":52,"featured_media":48872,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[254],"tags":[5961],"yst_prominent_words":[],"class_list":["post-48849","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tech","tag-5961"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/hindi.theindianwire.com\/wp-json\/wp\/v2\/posts\/48849","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hindi.theindianwire.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hindi.theindianwire.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hindi.theindianwire.com\/wp-json\/wp\/v2\/users\/52"}],"replies":[{"embeddable":true,"href":"https:\/\/hindi.theindianwire.com\/wp-json\/wp\/v2\/comments?post=48849"}],"version-history":[{"count":0,"href":"https:\/\/hindi.theindianwire.com\/wp-json\/wp\/v2\/posts\/48849\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hindi.theindianwire.com\/wp-json\/wp\/v2\/media\/48872"}],"wp:attachment":[{"href":"https:\/\/hindi.theindianwire.com\/wp-json\/wp\/v2\/media?parent=48849"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hindi.theindianwire.com\/wp-json\/wp\/v2\/categories?post=48849"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hindi.theindianwire.com\/wp-json\/wp\/v2\/tags?post=48849"},{"taxonomy":"yst_prominent_words","embeddable":true,"href":"https:\/\/hindi.theindianwire.com\/wp-json\/wp\/v2\/yst_prominent_words?post=48849"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}