No video

L-3.9: What is Binary Semaphore | Easiest Explanation | Operating system

  Рет қаралды 553,940

Gate Smashers

Gate Smashers

Күн бұрын

Пікірлер: 420
@PrabhatSingh-mf7mx
@PrabhatSingh-mf7mx 2 жыл бұрын
For those who have doubt about P1, when P1 goes to sleep() then it was placed in suspended list so when it will wake up it does not execute the whole down operation again but it will resume from that point of sleep() part and directly enters in critical section.
@omparkashsuna8986
@omparkashsuna8986 2 жыл бұрын
was it a joke or real?
@PrabhatSingh-mf7mx
@PrabhatSingh-mf7mx 2 жыл бұрын
@@omparkashsuna8986 no bro its a joke....just laugh and be happy🤗🤗
@rupeshdharme9017
@rupeshdharme9017 2 жыл бұрын
I was going to ask the same... Thank you. Because if it started again then it will again be suspended as the semaphore is 0.
@rahuldalal849
@rahuldalal849 2 жыл бұрын
Bhai jo tumne explain kiya Comment vo thik h kya?
@PrabhatSingh-mf7mx
@PrabhatSingh-mf7mx 2 жыл бұрын
@@rahuldalal849 yes sir i added this comment after refering different website like stack overflow...i have the same doubt thats why i added here so others also understand
@suryasikharej8116
@suryasikharej8116 3 жыл бұрын
Awesome lec. Btw he forgot to mention one thing that p() and v() are atomic in nature. That is p and v are executed like a sngle statement by the processes; That is p() and v() are indivisible. Hope it makes sense.
@amarnathprasad9986
@amarnathprasad9986 2 жыл бұрын
I think this is important to know because otherwise it's as good as locking in regards to mutual exclusion.
@shivaaggrawal5776
@shivaaggrawal5776 2 жыл бұрын
this is really important comment
@nerd-boiii
@nerd-boiii Жыл бұрын
thnx for this comment .....after watching the prev video I was wondering why we have multiple lines of code in semaphore wont preemption cause problems ......ty u cleared y doubt
@--xx--5800
@--xx--5800 4 ай бұрын
Thank you for the explanation😊
@aliyazdan4577
@aliyazdan4577 2 жыл бұрын
Value of semaphore should be set to 1 in up section, even if the Block list is non empty, otherwise, the waking process won't be able to enter critical section
@itsrajadarsh
@itsrajadarsh 3 ай бұрын
True
@heathledger7291
@heathledger7291 3 жыл бұрын
im binge watching ur os videos, they r really well made,i dont know why our college faculty doesnt teach like this. hatsoff to ur efforts
@ashitdarurmath9086
@ashitdarurmath9086 3 жыл бұрын
KZbin is a competitive platform only the best videos are suggested while searching
@chrishhemsworth2682
@chrishhemsworth2682 2 ай бұрын
Exactly bro 😂
@ralsei7170
@ralsei7170 3 жыл бұрын
Alright I might he wrong here but check this: Sleep is a function which stops execution of any process until it is woken up by any other process and wake up is function which wakes up sleeping process So let's say if P1 enters CS it will set S = 0 and when P2 wants to enter CS it will be put to sleep(you might think it is currently in an infinite loop). When P1 executes up code it will check if Suspend queue is empty. Since it's not cause of P2, it will wake up P2 from the point it was put to sleep i.e. from else code(you can also say that it breaks that infinite loop). Now you gotta understand that s is not the only factor that decides if process enters CS. For example, let's say there is no code in down, all processes wanting to enter CS will enter right, since there is no condition which blocks them Now understand that P2 will wake up and start executing from when it was set to sleep i.e. from else state, it will come out of 2 ending paranthesis and enter CS. Hope you understood what I said🤘
@jivanraundal2063
@jivanraundal2063 2 жыл бұрын
well explained.. Thanks :)
@avrmini
@avrmini Жыл бұрын
For this problem see this Solution video on 2x. kzbin.info/www/bejne/jJS5k4iYhbN8nNk
@venkatasreeram
@venkatasreeram 3 жыл бұрын
I believe in my concentration of learning the concepts of Operating System. Today I wrote my semester exam well with the help of your lectures sir🙏🙏🙏 I believe that I will get some knowledge along with your blessings through your lectures to achieve my goal as GATE TOPPER. Thanks alot !!!🤗
@amanahmed6057
@amanahmed6057 2 жыл бұрын
did u passed the exam or not?? that is the main question
@venkatasreeram
@venkatasreeram 2 жыл бұрын
@@amanahmed6057 I got O grade. I repeat O grade☺️🤗 91-100 marks in JNTUK validation. Tha k you soo much sir
@uniqueelsa5959
@uniqueelsa5959 2 жыл бұрын
Cool! Would ya like to talk to me on insta? Your goal seems similar to mine and I'm interested in having a talk about gate with you!
@sayantabhattacharjee9808
@sayantabhattacharjee9808 3 жыл бұрын
As I understood, the code for UP in the video is correct. The state till which the process has been executed is stored while putting it into the block queue So when it is executed after P2 is executed, the process P1 will execute the remaining code , after the down function. Then after executing the critical section it will execute the up() function, that will update the S.value=1 . And the CPU will again reach the starting state
@super_singing107
@super_singing107 3 жыл бұрын
V(Semaphore s) { if (s.q is empty) { s.value = 1; } else { // select a process from waiting queue s.value = 1; Process p=q.pop(); wakeup(p); } }
@sagunsangwan4554
@sagunsangwan4554 2 жыл бұрын
@@super_singing107 what if there are two processes in block state. And in else part you are assigning value = 1, so if some third process will execute down() now then it'll enter into the critical section but according to FIFO 2nd process which was blocked should get chance. Correct me if I am wrong?
@user-gd3xp7gf9r
@user-gd3xp7gf9r 9 ай бұрын
Hands Down the Best Teacher on YT to learn about theoretical topics Thank You sir 🙏🙏
@aparnashome6112
@aparnashome6112 4 жыл бұрын
The processes in the suspend queue once tried to enter in the CS but failing to enter into CS were added to the suspend queue. When the current process finishes its execution and comes out of the CS, it does not make the semaphore 1, semaphore remains 0. As a result no new process (which has not tried to enter CS before) will be able to enter in the CS, rather they will get added up in the suspend queue. On the other hand the first process in the suspend queue(FIFO) will be fetched from the suspend queue will be transfered to the ready queue and it will get the chance to enter the CS directly without performing the wait() section. One process at a time should be fetched from the suspend queue so that there will be no conflict to enter in the CS.
@darshiljayani3301
@darshiljayani3301 Жыл бұрын
is it possible?
@--xx--5800
@--xx--5800 4 ай бұрын
Thank you so much for the explanation ☺️
@sameerraturi8431
@sameerraturi8431 3 жыл бұрын
In comment section many people are thinking that there should be s.value =1 in the else part before wake up call for the process in up(s) ... just take these case at anytime the suspended list contains process p2,p3,p4 and process p1 is in cs now after execution in the cs it will have to go to the up(s) now in up(s) our process p2 is wake up() now when the p2 is set to sleep till that line all the execution is over so now p2 will directly go to the cs so the value of s should be 0 not 1 and thats why the code doesn't contain s.value=1 in the else part....now when all the p2,p3,p4 process get executed in the similar way the queue will become empty the value of s can be set as 1 and new process can enter into the cs.
@relentlessrock
@relentlessrock 2 жыл бұрын
Thanks! So will I be correct in saying that here the Down code is not working as an Entry code for critical section? In all previous examples, processes that failed to reach the critical section had to again follow entry code instructions.
@avrmini
@avrmini Жыл бұрын
For this problem see this Solution video on 2x. kzbin.info/www/bejne/jJS5k4iYhbN8nNk
@--xx--5800
@--xx--5800 4 ай бұрын
Thank you for the explanation ☺️
@KRISHNAKUMAR-rk7bv
@KRISHNAKUMAR-rk7bv 3 жыл бұрын
Best explanation on OS and its sub topics on youtube....Thanks sir....
@mdrayeesahmad3569
@mdrayeesahmad3569 2 жыл бұрын
this year in barc 2021 exam one question reated to this topic has been asked and that question was - there were four options given and they were as follows -- a)down-v,signal b)up-p,wait c)down -p,wait d)none of these , so sir i learned all the cse subjects with ur videos only and it helps me a lot in my exam thankyou sir for ur great support to all ,,,,.love from patna
@studentsheaven-d8v
@studentsheaven-d8v 3 жыл бұрын
Great Work Sir...Huge respect and Love from PAKISTAN.
@user-hl2nw8jd6c
@user-hl2nw8jd6c 3 жыл бұрын
tum log bhi operating system padhte ho..... 😁😁
@shiladityamukherjee9590
@shiladityamukherjee9590 3 жыл бұрын
OS padhke bomb banaega
@Shivam5ingh
@Shivam5ingh 2 жыл бұрын
You are a good teacher of OS. I am proud of you sir.
@phil_ka
@phil_ka 2 жыл бұрын
In case a process is in the waiting queue, you have mentioned in the Down code that we'll wake it up, and that's all good, but I think after waking it up we also have to set S to 1 so that the newly awakened process could enter the critical section.
@amoghupadhayay2502
@amoghupadhayay2502 2 жыл бұрын
The process will wake up and will not repeat what it has already done . it will enter CS and not execute the down code again
@abhishekmishra8338
@abhishekmishra8338 Жыл бұрын
tum dono ne same shirt pehna hua hai
@phil_ka
@phil_ka Жыл бұрын
@@abhishekmishra8338 😂
@shivanibhavsar852
@shivanibhavsar852 4 жыл бұрын
Code is absolutely correct.. sir might forgot to mention that the suspended process will restart from the same point where it got stopped last.. thank you for this series sir.. ❤️❤️
@lokeshpanda5138
@lokeshpanda5138 3 жыл бұрын
❤❤❤❤❤❤💕
@pramodyadlapalli9336
@pramodyadlapalli9336 3 жыл бұрын
yah but in the previous video sir said after wake up process goes to ready queue and rechecks the condition of entry to enter into cs
@aradhyajain9575
@aradhyajain9575 5 жыл бұрын
just because u r HUMBLE and u made it easy for me to understand....i like it & subscried ur channel.......GREAT STUFF........would love to have some lectures on C Programming.
@ita755khushalkoli2
@ita755khushalkoli2 3 жыл бұрын
I found these tutorials but then I started to see some similarities in the diagrams that my prof presented. I checked those ppt's and realized my prof had used your examples as screenshots in her ppt
@kforkarishma1128
@kforkarishma1128 3 жыл бұрын
lol
@siddhantsingh3392
@siddhantsingh3392 3 жыл бұрын
@Khushal You are from IT dept?
@priyankajhamb7061
@priyankajhamb7061 3 жыл бұрын
Sir, please clear my doubt, when a process P1 wake up, then also Semaphore value is 0, then how it will enter into critical section, instead of this, It will again go back to suspend list.
@shreenavkhandelwal4168
@shreenavkhandelwal4168 3 жыл бұрын
same doubt!! After semaphore becomes 0 we never update it to 1.
@kamlakalouni1505
@kamlakalouni1505 3 жыл бұрын
Same is my doubt
@sulaimant5690
@sulaimant5690 3 жыл бұрын
@@kamlakalouni1505 same doubt.
@yanshikarajput7399
@yanshikarajput7399 2 жыл бұрын
sir forgot to update the value of semaphore there
@kshitijtripathi3250
@kshitijtripathi3250 3 жыл бұрын
considering 2 processes p1 and p2 , suppose p2 enters CS by down operation so it will make s=0 and when p1 executes down code it will go in suspended state , so when p2 executes up operation it will wake up p1 but value of s will be still 0 so how will p1 execute the down code because the value of s=0 still.
@Kitzey2k
@Kitzey2k 3 жыл бұрын
Same doubt
@abrarulhaqshaik
@abrarulhaqshaik 3 жыл бұрын
@@Kitzey2k same here, have you got any solution for that?
@Kitzey2k
@Kitzey2k 3 жыл бұрын
@@abrarulhaqshaik No
@upasonabiswas6783
@upasonabiswas6783 3 жыл бұрын
The state till which the process has been executed is stored while putting it into the block queue So when it is executed after P2 is executed, the process P1 will execute the remaining code , after the down function. Then after executing the critical section it will execute the up() function, that will update the S.value=1 . And the CPU will again reach the starting state. [I copied this answer from sayanta bhattacharjee, He answered it just perfectly..]
@abirpaul9027
@abirpaul9027 3 жыл бұрын
@@upasonabiswas6783 so if p1 was in block list then S=0 and suppose p2 finishes executing then it will goto exit section code it will just wakeup p1 but how is it making s=1 again it's only going to do that if the list was not empty! If you find anything wrong correct me
@poonammane9792
@poonammane9792 5 жыл бұрын
Sir ur all vedios we understand very clearly tq sir👍
@ahmedkhan4546
@ahmedkhan4546 3 жыл бұрын
This was so helpful man, your teaching is amazing keep it up bro!!
@ajaj1613
@ajaj1613 3 жыл бұрын
Thanku sir for all ur video's it's really help me to alot understand the concept 😊😊...
@mtrk_79274
@mtrk_79274 5 жыл бұрын
I think up(Semaphore S){ if(Suspended list is empty){ S.value=1; } else{ S.value=1; remove one process from suspended list:wakeUP(); } }
@prashantrastogi6049
@prashantrastogi6049 5 жыл бұрын
yes
@vikman59
@vikman59 5 жыл бұрын
Exactly
@mrinmoyhalder7293
@mrinmoyhalder7293 5 жыл бұрын
I'm also thinking same
@jamalahmad3378
@jamalahmad3378 4 жыл бұрын
Yes it should be other wise how the blocked process will enter critical section
@aabid3375
@aabid3375 4 жыл бұрын
Yes that is minor mistake otherwise there will again be a deadlock
@kartikdutt2661
@kartikdutt2661 3 жыл бұрын
In case if you're wondering if the up function is wrong, it is not. Code is correct. Once the suspended process is wakened up, it will directly execute the critical section, it will not execute the down function as it has already been executed.
@lucidlynxxx
@lucidlynxxx 3 жыл бұрын
noh youre wrong, after wake up, it sent to waiting queue means it can again try to get executed, but the code is wrong as the value of s remains 0 in up() code, so its not going to get executed for more information contact your os teacher...
@geeteshchallur1034
@geeteshchallur1034 3 жыл бұрын
@@lucidlynxxx I think he's right because I have checked the code in other sources and it is right.
@ratanreddy7635
@ratanreddy7635 3 жыл бұрын
Thanks bro your video has helped me a lot you have very good teaching skills . Thanks for this
@kunalpilley3317
@kunalpilley3317 3 жыл бұрын
Else block in UP should be updated as follows Select a process and wake up //Chk again If (list is empty) S.value = 1 The only the value of semaphore can be made 1 again To allow other process to enter in CS .
@vineetshukla2021
@vineetshukla2021 2 жыл бұрын
You afe right bro
@worldvital.s9452
@worldvital.s9452 2 жыл бұрын
Waooo sir g your lecture awesome 👍👍.mujy pori KZbin py Sirf ap k hi lecture smj m aty hain
@suyashnachankar9342
@suyashnachankar9342 5 жыл бұрын
At 7:05 you said if a process is exiting Critical Section and S = 1. How S can be 1 if there is a process in Critical Section in the case of Binary Semaphore ?
@sagunsangwan4554
@sagunsangwan4554 2 жыл бұрын
Same doubt. Did you got any solution?
@oqant0424
@oqant0424 2 жыл бұрын
literally u teach better than IIT profs!
@codewithschoolteacher5118
@codewithschoolteacher5118 2 жыл бұрын
hey i am from Pakistan you are the best teacher i ever found. Thank you so much.
@nitingaur3006
@nitingaur3006 6 жыл бұрын
Thanks a lot you have explained binary semaphore perfectly
@MaitreyeeDavdaOfficial
@MaitreyeeDavdaOfficial 2 жыл бұрын
Sir i have a doubt... See if suspended process will wake up and then it will try to be executed but it will blocked again then up process will work then down then up... Yeh to chlta hi rhega😂 agar koi process esa hain to kya hoga agli process ki baari kaise ayegi
@akhilkrishna436
@akhilkrishna436 Жыл бұрын
For those who have confusion p1,p2,p3 processes are there imagine p1 enters the CS (critical section ) first so S=0 then p2 and p3 tries to enter into CS but cant bcz s=0 and p2 ,p3 goes to block stage now p1 finished executing its CS then it will execute the UP so acco to fifo p2 is removed from blocked stage and is allowed to enter into its CS ( ie p2 got blocked in the last line of DOWN function so when p2 is wake up it will start executing from the next line (after sleep() ) the next line after DOWN function is CS section ) p2 will start executing from the point it got blocked not from beginning
@mariabatool140
@mariabatool140 4 жыл бұрын
Your Lectuers Are Helpful for Us...
@koushikjana849
@koushikjana849 4 жыл бұрын
You are great sir
@vsk9630
@vsk9630 3 жыл бұрын
Saras👌👌👌
@anisharaj4601
@anisharaj4601 5 жыл бұрын
As explained in previous video, every solution should follow mutual exclusion. And binary semaphore does follow it as only one process get access of the critical section. But what about counting semaphore? Many process where there inside the critical section just because semaphore value was more than 1. How we can say that counting semaphore is a solution when its not following the primary condition?
@zainabedin9842
@zainabedin9842 3 жыл бұрын
Counting semaphore only allows mutual exclusion when we initialize semaphore value to 1. If it's more than 1, then mutual exclusion cannot be guaranteed.
@HimAnshuGaurKK1120
@HimAnshuGaurKK1120 5 ай бұрын
Nice explaination❤ thanku sir🙏
@bonioss4865
@bonioss4865 5 жыл бұрын
Sir, big thanks from Politechnika Rzeszowska
@meenakshisharma6029
@meenakshisharma6029 2 жыл бұрын
Many thanks for such beautiful videos sir... Sir I have one doubt.. suppose p1 satisfy condition s.value==1 and before entering in block it get preemptive...and now p2 also satisfies condition and enters in critical section and now p1 comes back...then what would happen??
@shubhamrajput9363
@shubhamrajput9363 2 жыл бұрын
सर में आपका सदा आभारी रहूंगा धन्यवाद 🙏
@sujanraktade4852
@sujanraktade4852 3 жыл бұрын
In binary semaphore only one process can access the Critical section at a time so if that process run the UP code while exiting from Critical section S will be set to 1 again but there won't be another process to overwrite value of S to 1.So at 4.29 we are considering two possibilities that value of S will be 0 or 1 that might be wrong there might be only one possibility and that is value of S is 0.
@savinaykumar5956
@savinaykumar5956 2 ай бұрын
I watched your 4-5 videos and now I want to ask : by any chance do you teach for UGC net ? If you have paid classes kindly let me know I want to join as soon as possible.....and thanks for the wonderful explanation 🙏
@kartikpurohit7457
@kartikpurohit7457 5 жыл бұрын
Thanku sir concept clear krne k liye
@LTT_VKR
@LTT_VKR 4 жыл бұрын
After putting p1 in ready queue..how will the semaphore value become to 1 or who will call the up(s)
@saikun0293
@saikun0293 4 жыл бұрын
If we add in ready queue and we are not setting S.value=1 in else part it will be a deadlock situation right? This code makes sense if we are directly adding from Suspended list to Critical Section else the code should be like this Up( Semaphore S ) { S.value=1; if (!Suspended list is Empty){ Select a process from suspended List; Wake up(); }
@gunjan3571
@gunjan3571 3 жыл бұрын
no there will be no deadlock situation, in that code when p2 is going to sleep it is executing the last instruction in the down(S), so after it will wake up it will directly enter into the critical section because it will resume it will not execute down(S) again.
@paulsnehasish5830
@paulsnehasish5830 3 жыл бұрын
yes because the previous context was saved in PCB as the process got blocked it was basically looping indefinitely until awakened !
@suryasikharej8116
@suryasikharej8116 3 жыл бұрын
​@@paulsnehasish5830 Doesnt make sense to me. The s.value was 0 thats why the process went into suspend queue.else part will get executed by the process leaving the cs(still the s.value is 0). One solution is that the program which dequeues the processes from the suspend queue sets the s.value to 1 before dequeing;
@paulsnehasish5830
@paulsnehasish5830 3 жыл бұрын
@@suryasikharej8116 it doesnt need to set the value to 1 because the blocked processes will get inti the CS upon waken up....once a process executes previous codes it wont execute them again...it will resume from the blocked state and will go to the CS directly
@suryasikharej8116
@suryasikharej8116 3 жыл бұрын
@@paulsnehasish5830 No a process can never get to critical section directly. It needs to get into the ready queue and if another process comes with higher priority than the dequeued one then that process will also get stuck because s.value is still 0;
@laibanawaz7789
@laibanawaz7789 3 ай бұрын
GOD BLESS UH SIR G RESPECT FROM PAK
@nileshsrivastava1507
@nileshsrivastava1507 2 жыл бұрын
Semaphore requires "lock with condition variable" as well. For Binary semaphore, I think Down only needs "if" part, "else" not required.
@PreranaNavodayClassesKhirasara
@PreranaNavodayClassesKhirasara 3 жыл бұрын
Explanation too good. Very helpful.
@sakshamsinghrajput22
@sakshamsinghrajput22 7 ай бұрын
Bada mast topic hai binary semaphore **gate smashers**
@abhishekkmandal
@abhishekkmandal 3 жыл бұрын
when the suspend list is not empty and we are waking up a process then also the S should change back to 1 so that next down can be performed
@smritiawasthi9814
@smritiawasthi9814 4 жыл бұрын
Sir thanku for the lecture.😊 Sir after the execution of wakeup() when s value will become 1 and how?
@dipenmhanta6102
@dipenmhanta6102 2 жыл бұрын
yeah i too have the same doubt.
@subhajitsaha7068
@subhajitsaha7068 6 жыл бұрын
sir I have a doubt that binary semaphore follow mutual Exclusion but is it follow progress and bounded waiting if yes then explain why?
@ashwanikatoch9040
@ashwanikatoch9040 5 жыл бұрын
sir u r great
@HelloWorld40408
@HelloWorld40408 Жыл бұрын
Thank you Sir!
@rj...12ka4
@rj...12ka4 5 жыл бұрын
In Up we need to write below logic in else section After wakeup one process ,again check whether suspendlist is empty if so assign s value to 1.
@ankitaverma2271
@ankitaverma2271 5 жыл бұрын
Thank you sir
@AnkitPal-qb6uu
@AnkitPal-qb6uu 5 жыл бұрын
Har video pe aapka thank u milta hai... But sir ka video bahut hi conceptual videos hote hai........ Ek baar. Me concept clear ho jata hai.......
@farooqnust
@farooqnust Жыл бұрын
For example there are two processes p1 and p2 p1 run down code check the condition s==1 it is true then suddenly it is pre empted now p2 run and check the condition the condition is true and p2 is in critical section now and then p1 is resumed it is also in critical section mutual exclusion is violated here
@khajanchaudhary5611
@khajanchaudhary5611 11 ай бұрын
Great great great sir
@suindude8149
@suindude8149 4 ай бұрын
For binary Semaphore it is not possible to enter critical section as no P() is performed but possible in case of counting Semaphore if prior a P() is performed.
@nainawadhwa8920
@nainawadhwa8920 6 жыл бұрын
Best lecture on binary semaphore..
@harsharora1495
@harsharora1495 4 жыл бұрын
Best teaching style 👌👌👌
@saeedzafar1858
@saeedzafar1858 Жыл бұрын
Sir ye jo ap ne last pe btaya agr p1 suspended list se bahir aye ga to down operation kese perform kre ga jb k semaphore ki value 0 hi ha
@142_rohitwaghmare2
@142_rohitwaghmare2 3 жыл бұрын
mindblowing explanation sir!!
@thatGuySuraj
@thatGuySuraj 3 жыл бұрын
Okay I see people a bit confused regarding the UP code in the comment section. The code is absolutely correct. A process which wakes up after sleep will start its execution from the point it left before the sleep. In the example used in the video, P2 runs the DOWN code and changes value of s from 1 to 0. Now when P1 comes it finds s = 0 and goes to sleep. When P2 runs the UP code it wakes up P1 and s still remains 0. We cannot change s here as P1 is still not inside the critical section but just woke up. Thus, P1 goes to critical section after waking up even though value of s = 0. Now you may wonder when will s become 1, simply when P1 runs its UP code ( i.e. when suspend list is empty) . In a nutshell, you need to understand that s = 1 is not the only condition that can make a process go inside the critical section. Generalize this example for 5 processes and you are good to go.
@Kaivalyamani
@Kaivalyamani 2 жыл бұрын
So why sleep() doesn't perform like it should in the previous video. Bhaiya said the process again waking up are now eligible to try to enter critical section
@STAY_CURIOUS_
@STAY_CURIOUS_ 2 жыл бұрын
Great
@hrithiky-7
@hrithiky-7 4 жыл бұрын
(To all the people who say code is incorrect) The code int the video is correct. When a process is woke up from Suspend list it goes back into Ready Queue.(Note the P1, P2 shown in ex were at the execution time).Whenever process'es enter from Ready to Run Queue The Semaphore values get initialized.
@sakshijain5503
@sakshijain5503 4 жыл бұрын
If you are correct then for the first time when P1 interfere P2 (Ready state to running state) then Semaphore value should have been initialized again as S=1 but since Semaphore is shared resource it did't initialize.
@hrithiky-7
@hrithiky-7 4 жыл бұрын
@@sakshijain5503 See the interfering processes first go into suspend list, and then when woke up goes to ready queue. (We assumed the processes coming are of same priority). Let's say p1,p2,p3 came concurrently ,say p2 entered CS, p1,p3 goes to suspend queue, again when cpu goes back to p1 n p3 it puts them in ready queue (pops until list Is empty) now semaphore value is set as 1. //Correct me if I'm wrong.
@muftihyder7422
@muftihyder7422 2 жыл бұрын
Hi, please improve your video related to Counting Semaphore. I could not understand the need for counting semaphore as it does not allow for mutual exclusion that is the fundamental need for synchronization. However, after reading from Quora, i got to know that Counting Semaphore is useful when a resource needs to be used strictly by only N processes. I hope you will add more to the previous video to clear the confusion.
@stylewithcss
@stylewithcss 4 жыл бұрын
Your Videos Made my 14 Num Confirm in Just First Try in learning from your video 👏👏👏
@GateSmashers
@GateSmashers 4 жыл бұрын
I wish you will get full marks along with all the concepts cleared
@puranjanprithu6337
@puranjanprithu6337 3 жыл бұрын
NIT I Introduction: Concept of Operating Systems, Generations of Operating systems, Types of Operating Systems, OS Services, System Calls, Structure of an OS - Layered, Monolithic, Microkernel Operating Systems, Concept of Virtual Machine. Case study on UNIX and WINDOWS Operating System. Processes: Definition, Process Relationship, Different states of a Process, Process State transitions, Process Control Block (PCB), Context switching Thread: Definition, Various states, Benefits of threads, Types of threads, Concept of multithreads, UNIT II Process Scheduling: Foundation and Scheduling objectives, Types of Schedulers, Scheduling criteria: CPU utilization, Throughput, Turnaround Time, Waiting Time, Response Time; Scheduling algorithms: Pre-emptive and Non pre-emptive, FCFS, SJF, RR; Multiprocessor scheduling: Real Time scheduling: RM and EDF. Solution, Inter-process Communication: Critical Section, Race Conditions, Mutual Exclusion, Hardware Solution, Strict Alternation, Peterson‘s The Producer\ Consumer Problem, Semaphores, Event Counters, Monitors, Message Passing, Classical IPC Problems: Reader‘s & Writer Problem, Dinning Philosopher Problem etc. UNIT III Deadlocks: Definition, Necessary and sufficient conditions for Deadlock, Deadlock Prevention, Deadlock Avoidance: Banker‘s algorithm, Deadlock detection and Recovery. Memory Management: Basic Fixed and concept, Logical and Physical address map, Memory allocation: Contiguous Memory allocation variable partition- Internal and Page allocation -Hardware support for External fragmentation and Compaction; Paging: Principleof operation - paging, Protection and sharing, Disadvantages of paging. UNIT IV Virtual Memory: Basics of Virtual Memory - Hardware and control structures - Locality of reference, Page fault , Working Set , Dirty page/Dirty bit - Demand paging, Page Replacement algorithms: Optimal, First in First Out (FIFO), Second Chance (SC), Not recently used (NRU) and Least Recently used (LRU). I/O Hardware: I/O devices, Device controllers, Direct memory access Principles of I/O Software: Goals of Interrupt handlers, Device drivers, Device independent I/O software, Secondary-Storage Structure: Disk structure, Disk scheduling algorithms UNIT V File Management: Concept of File, Access methods, File types, File operation, Directory structure, File System structure, Allocation methods (contiguous, linked, indexed), Free-space management (bit vector, linked list, grouping), directory implementation (linear list, hash table), efficiency and performance. Disk Management: Disk structure, Disk scheduling - FCFS, SSTF, SCAN, C-SCAN, Disk reliability, Disk formatting, Boot-block, Bad blocks
@puranjanprithu6337
@puranjanprithu6337 3 жыл бұрын
Syllabus hai college ka....sare points is playlist me hain...thanks a lot sir🙏
@abhinavgupta5861
@abhinavgupta5861 2 жыл бұрын
At up operation, S.value can never be 1. So, no chance of S.value to overwrite/remain 1. But if entry and exit codes are defined differently, eg. Entry = v(mutex) and exit = p(mutex) then you would see mutex = 1 at up operation Reference: next video in playlist
@sudeshnasaha4985
@sudeshnasaha4985 3 жыл бұрын
Thankyou 🥰❤️ sir.. you are the best❤️
@spectrum_07
@spectrum_07 5 жыл бұрын
Make videos on computer organization and architecture please sir...... Please
@sabanapervin4086
@sabanapervin4086 5 жыл бұрын
great piece of work....
@rinkidas4489
@rinkidas4489 5 жыл бұрын
Thank u so much sir😍😍
@lokeshpanda5138
@lokeshpanda5138 3 жыл бұрын
Hlo
@anishsaha1777
@anishsaha1777 3 жыл бұрын
In the last example , when P1 is put into the ready queue how it gets executed beacuse then also the value of S=0. When the value of S=0 , the down statement can not be executed. Please explain!
@PRIYAGUPTA-dr1nr
@PRIYAGUPTA-dr1nr 6 жыл бұрын
Thanks for helping the students 🙂🙂..
@ankitdubey9310
@ankitdubey9310 3 жыл бұрын
in the end after down operation, the value of semaphore is 0 so even if P1 wants to execute how will it execute?
@abirpaul9027
@abirpaul9027 3 жыл бұрын
Exactly same doubt
@sumitshokeen8774
@sumitshokeen8774 5 жыл бұрын
Thank U sir ji 🙏
@madhusantoli7877
@madhusantoli7877 2 жыл бұрын
Thanku
@swastiktiwari7066
@swastiktiwari7066 5 ай бұрын
At 7:08 of the video, the instructor discusses the case in which the process enters UP part of Semaphore with S = 1. My Question: Is it ever possible for the process to enter UP part of Semaphore with S = 1 ? Can you please give an example ? I think for the process to enter UP , first it has to enter DOWN.....and it can only be executed in DOWN with S = 0.....so it will always enter UP with S = 0. Am I missing something ?
@rishabhmishra4224
@rishabhmishra4224 Жыл бұрын
still helps a lot
@himanshumishra9762
@himanshumishra9762 Ай бұрын
Please help me to clear a doubt: if suspended list is not empty and V is executing, S=1: Will S remain 1 as I dont see it getting set to 0?
@shripadjalamkar3296
@shripadjalamkar3296 6 жыл бұрын
THANKS A LOT ..VERY NICE EXPLANATION
@ashwanikesharwani4024
@ashwanikesharwani4024 3 жыл бұрын
if there are several processes p1, p2, p3 .......pn then if S = 1 the process p1 will go into critical section to wait queue there will a condition do { if (S
@sritimanadak3937
@sritimanadak3937 3 жыл бұрын
How will semaphore value be reset to 1 , Because after performing an up operation p2 will leave critical section and p1 will be sent to ready state , but s is still 0
@shubhamdubey4069
@shubhamdubey4069 3 жыл бұрын
Yes bro
@sarvdarshijain6497
@sarvdarshijain6497 Жыл бұрын
I had a small doubt . Let P1 enters the critical region and three processes P2,P3,P4 tries to enter and gets blocked . Let then P1 comes out and since the list of blocked process is not equal to 0 , it unblocks P2 and comes out . But here , No other process can move in critical section nor any process is in the critical section. Doesn't it stop the progress and deadlocks the system. Thank you for this amazing video and would be really grad to hear the replies , If I missed something?
@avijeetgorai3697
@avijeetgorai3697 3 жыл бұрын
Guruji🙏
@kamil3885
@kamil3885 5 жыл бұрын
Thanks Sir.
@ozonewagle
@ozonewagle 2 жыл бұрын
suppose a process p1 is in critical section of code, and another process p2 tries to enter critical section, it goes into sleep state Now lets assume p1 is running final exit code which is UP() when p1 started it had made semaphore=0. now when exiting the 'if statement' is checking if the suspend list is empty which is not empty, so the if statement is skipped and else statement is run, which will bring either of the processes to wake up state, but still semaphore value is 0. when process p2 runs entry line of code, as the semaphore value is still 0, it goes again back to blocking state. Please clarify where am I missing..
@scholar_boy425
@scholar_boy425 3 жыл бұрын
Amazing sir ❤️❤️
@vibhu123
@vibhu123 4 жыл бұрын
Well explained... But I think this lecture should be just after "semaphore & counting semaphore" Lecture....
@pratikkurra4754
@pratikkurra4754 8 ай бұрын
After a down and up series of operations are carried out and executed. What about resetting semaphore value? from 0 to 1 for next set of processes to be cleared.
@dustumistu2302
@dustumistu2302 4 жыл бұрын
grateful to you for your explanation in a simple way...
@hammadabd234
@hammadabd234 11 ай бұрын
In up else needs an increment for S also so the next process will enter otherwise its a total block.
@rahuldev3782
@rahuldev3782 2 жыл бұрын
sir,while running the down it can also stop ?and preempt so does it affects?
@snehalshirgave3146
@snehalshirgave3146 4 жыл бұрын
While doing up for p2 process, we are making p1 to get ready to use semaphore, but that time also S=0, then when p1 performs down operation, it will get blocked again as because S is 0,
@paulsnehasish5830
@paulsnehasish5830 3 жыл бұрын
awakened process will not perform the DOWN operation again as its last context was saved in PCB...it will directly go into it's CS
@ralsei7170
@ralsei7170 3 жыл бұрын
@@paulsnehasish5830 but it went in suspended state after going to else section of up(s). How will it continue? And sir also said in last video that it is put in ready state
@aadityadande
@aadityadande 6 жыл бұрын
What is mutex and how it is related to this please tell and make theoretical video for cpu scheduling algorithm please
@user-kn8od9bf6p
@user-kn8od9bf6p 7 ай бұрын
As you said sir in last part of video ,if s=1 and p2 is run first and that after that p2 want to access cs but that will be sleep() due to condition so after that p2 execute up part and wakeup p1 but at that time s value will be 0 so in that p1 can never access critical section how that can be possible? in this case p1 will stuck in infinite loop
L-3.10: Practice Question on Binary Semaphore in Operating System
16:00
L-4.1: DEADLOCK concept | Example | Necessary condition | Operating System
12:21
Or is Harriet Quinn good? #cosplay#joker #Harriet Quinn
00:20
佐助与鸣人
Рет қаралды 8 МЛН
When you discover a family secret
00:59
im_siowei
Рет қаралды 20 МЛН
❌Разве такое возможно? #story
01:00
Кэри Найс
Рет қаралды 3,7 МЛН
Semaphores
22:51
Neso Academy
Рет қаралды 458 М.
Semaphore | Counting & Binary | OS | Lec-56 | Bhanu Priya
12:03
Education 4u
Рет қаралды 235 М.
L-3.12: Solution of Readers-writers  Problem using Binary semaphore
21:11
Or is Harriet Quinn good? #cosplay#joker #Harriet Quinn
00:20
佐助与鸣人
Рет қаралды 8 МЛН