Synchronization Tool: Semaphore | L 16 | Operating System | GATE 2022 CSE

  Рет қаралды 48,921

Unacademy Computer Science

Unacademy Computer Science

Күн бұрын

Пікірлер: 33
@aspirant8409
@aspirant8409 3 жыл бұрын
Start 7:15
@surajitroy_roll-5023
@surajitroy_roll-5023 3 жыл бұрын
I can tell I have watched about 18 times Aspirants
@shrishti9997
@shrishti9997 2 жыл бұрын
Sir you told in your previous lectures that if wait(S) and signa(S)l function are used without preemption then mutual exclusion will always be present there. But in your question 3, the code that you have done from process P1 to P9 did not use mutual exclusion anywhere. Because whenever a wait(S) Function decrements the initial value of S of P1 in the critical section and then signal(S) increments it by 1, why should we execute P10 first?
@jeeera8902
@jeeera8902 2 жыл бұрын
because there we not know which process run first in the question it was not written we should start with p1 is mandatory
@dipanshusharma5529
@dipanshusharma5529 Жыл бұрын
we want to maximize S , so that maximum number of processes can enter in critical section. This can be done when p10 is executed first and S is incremented twice.
@vasu12278
@vasu12278 Жыл бұрын
guru ji ki jai ho
@vikas4407
@vikas4407 2 жыл бұрын
Sir, In the last question all process will go into the critical section because when the p10 is execute in C. S. Section then value of S=3 , after we execute p1 ( wait decrease the value by one and also signal can increase the value by one) so it will give 3 and again repeat. Sir can u tell me this upper can true or false?
@akashjoshi4967
@akashjoshi4967 2 жыл бұрын
question is maximum number of process that can access the cs "together " . Together means they all have to be in the CS so semaphore will become 0 when 3 process together access the CS
@ayapnaga7627
@ayapnaga7627 Жыл бұрын
Yes, if we ignore the question than all the processes (i.e., p1 to p10 ) can be inside the critical section but the question said "all the processes to be executed only once" so, processes p1 to p10 can go inside CS and after coming out of the CS the processes cannot enter the CS as per the constraints given in the questions. so when p1 is inside the CS (S = 0), p10 can also get into CS too which makes S = 1, means other processes can also get into the CS . say p2 enters the CS and makes S = 0, now p10 moves out from CS making S = 1 again and here again p10 leaves a room for other processes to enter the CS so say p3 enters the CS and makes S = 0. Now no other processes can enter a CS because S = 0 and p10 cannot enter the CS to make S = 1 again because questions says "processes can enter CS only once.
@pramodkoushiktr1895
@pramodkoushiktr1895 2 жыл бұрын
does S means max. # processes that can be in critical section together?
@theroastingstation
@theroastingstation 2 жыл бұрын
S means semaphore only
@coderpriyabrat3585
@coderpriyabrat3585 3 жыл бұрын
superb
@itsmeakash_
@itsmeakash_ 2 жыл бұрын
41:22 ☠☠
@rachnapanigrahi139
@rachnapanigrahi139 Жыл бұрын
Can anyone correct me if I'm wrong so Counting Semaphore is used in threads for mutual exclusion??
@the_truth_of_society
@the_truth_of_society Жыл бұрын
no....binary semaphores.....if you use counting semaphores in threads then more than one thread will enter into the critical section which will lead to data inconsistency .
@rachnapanigrahi139
@rachnapanigrahi139 Жыл бұрын
@@the_truth_of_society yeah yeah got it thank you
@a_36_devjyotisinha99
@a_36_devjyotisinha99 2 жыл бұрын
35:39
@vinayaksingh6959
@vinayaksingh6959 3 жыл бұрын
28:43 is funny af 😂😂😂😂
@adityaratan179
@adityaratan179 2 ай бұрын
19:45
@PIYUSHSHARMA-ql3uz
@PIYUSHSHARMA-ql3uz 4 ай бұрын
22:51 23:30
@kheersagarpatel3195
@kheersagarpatel3195 3 жыл бұрын
yes sir success
@parakhindustries
@parakhindustries 3 жыл бұрын
Sir , Process P10 contains while loop while(true){ signal(s) C.S. signal(s) } while loop may execute for more than one time because the condition is always true and in question it is given than process run only once but process itself contains loop means we can maximize semaphore to any big value like 13 by running loop for 6 times and then we preempt p10 and then we can have all the remaining 9 processes in the critical section . in this way we can have all 10 process into C.S. while running all the processes only once . if correct answer is 3 , then inside the code there should not be while(true) statement if all processes is like these ( without while loop): p1....p9 p10 wait(s) signal(s) C.S. C.S. signal(s) signal(s) in these case we can say that answer is 3 . Please clear these doubt .
@saurabhtiwari287
@saurabhtiwari287 3 жыл бұрын
Bhai while ko ek se jayada baar kyo run kr rhe ho. While ek baar run hoga or s ki value ko 3 set kr dega.
@parakhindustries
@parakhindustries 3 жыл бұрын
@@saurabhtiwari287 why while loop only run for only one time as it has condition true , it means that it can run for many times until that process is preempted or terminated ? it is not mentioned in the question that we have to run the while loop for only one time .
@saurabhtiwari287
@saurabhtiwari287 3 жыл бұрын
@@parakhindustries yes ur right sir. And u have written it is not mentioned in the question that while loop run only once. Sir I suggest u to plse once again read the q very carefully. In the q it clearly say that one process execute only one time. Toh isme while bhi ek hi baar chalega na sir. Aap loop kitni bhi baar chala skte ho. Lekin q ke hisab se toh while ek hi baar chalega na
@saurabhtiwari287
@saurabhtiwari287 3 жыл бұрын
And sir abhi bhi smjh me nhi aaya toh plse aap video dobara dekho
@parakhindustries
@parakhindustries 3 жыл бұрын
@@saurabhtiwari287 Are bhai que me likha h process ek hi baar run hoga par process ke andar jo loop h wo to ek bar run hoga esa nhi likha h . aap que dekho.... agar aap C program me koi loop ko implement karoge aur run karoge to uski ek hi process create hogi aur loop multiple time run hoga na . har ek iteration ke liye alag process thodi banega bhai.
@ROHITKUMAR-lh4oi
@ROHITKUMAR-lh4oi 3 жыл бұрын
❤️❤️🔥🔥
@mohdadil2875
@mohdadil2875 2 жыл бұрын
yes
@prernapriya8699
@prernapriya8699 3 жыл бұрын
Why we use semphore solution if Peterson solutions fulfill the condition of CS problem..
@neerajcheryala9602
@neerajcheryala9602 3 жыл бұрын
Because Counting semaphore additionally lets us to manage shared resources among multiple processes but not just two.
@subramanianvijayakumar4999
@subramanianvijayakumar4999 3 жыл бұрын
Peterson solution cannot be used in modern computers as most compilers now rearrange independent instructions which makes it ineffective. You can refer Silberschatz for more precise explanation.
@vishalcseiitghy
@vishalcseiitghy 3 жыл бұрын
@@subramanianvijayakumar4999 Bhai Galvin bhi bol sakta tha.Faltu ka Google karwa diya
Practice Questions on Semaphore | L 17 | Operating System | GATE 2022 CSE #Vishvadeep Sir
1:09:47
BAYGUYSTAN | 1 СЕРИЯ | bayGUYS
36:55
bayGUYS
Рет қаралды 1,9 МЛН
REAL or FAKE? #beatbox #tiktok
01:03
BeatboxJCOP
Рет қаралды 18 МЛН
Quilt Challenge, No Skills, Just Luck#Funnyfamily #Partygames #Funny
00:32
Family Games Media
Рет қаралды 55 МЛН
Semaphore | L13 | OS | Hindi | Vishvadeep Gothi | Unacademy Computer Science
1:37:31
Unacademy Computer Science
Рет қаралды 11 М.
OS30 - Mutex Lock
9:53
EZCSE
Рет қаралды 20 М.
Semaphores
22:51
Neso Academy
Рет қаралды 519 М.
4.8 Semaphores in Process Synchronization in OS
19:28
KnowledgeGATE by Sanchit Sir
Рет қаралды 746 М.
4.1 Race Condition in Process Synchronization in OS
10:04
KnowledgeGATE by Sanchit Sir
Рет қаралды 653 М.