Тёмный

L-3.8: Semaphores | Wait, Signal Operation | Counting Semaphore | Example| Operating system 

Gate Smashers
Подписаться 2 млн
Просмотров 1,1 млн
50% 1

👉Subscribe to our new channel: / @varunainashots
Semaphore is a variable that is non-negative and shared between threads. A semaphore is a signaling mechanism, and a thread that is waiting on a semaphore can be signaled by another thread. It uses two atomic operations, 1) Wait, and 2) Signal for the process synchronization.
0:00 - Introduction
0:48 - Semaphore
2:42 - Various operations in Semaphore
4:59 - Entry section code
12:03 - Exit section code
19:56 - Questions on Semaphore
►Operating System (Complete Playlist):
• Operating System (Comp...
Other subject-wise playlist Links:
--------------------------------------------------------------------------------------------------------------------------------------
►Design and Analysis of algorithms (DAA):
• Design and Analysis of...
►Database Management System:
• DBMS (Database Managem...
► Theory of Computation
• TOC(Theory of Computat...
►Artificial Intelligence:
• Artificial Intelligenc...
►Computer Networks (Complete Playlist):
• Computer Networks (Com...
►Computer Architecture (Complete Playlist):
• Computer Organization ...
►Structured Query Language (SQL):
• Structured Query Langu...
►Discrete Mathematics:
• Discrete Mathematics
►Compiler Design:
• Compiler Design (Compl...
►Number System:
• Number system
►Cloud Computing & BIG Data:
• Cloud Computing & BIG ...
►Software Engineering:
• Software Engineering
►Data Structure:
• Data Structure
►Graph Theory:
• Graph Theory
►Programming in C:
• C Programming
►Digital Logic:
• Digital Logic (Complet...
---------------------------------------------------------------------------------------------------------------------------------------
Our social media Links:
► Subscribe to us on RU-vid: / gatesmashers
►Subscribe to our new channel: / @varunainashots
► Like our page on Facebook: / gatesmashers
► Follow us on Instagram: / gate.smashers
► Follow us on Instagram: / varunainashots
► Follow us on Telegram: t.me/gatesmashersofficial
► Follow us on Threads: www.threads.net/@gate.smashers
--------------------------------------------------------------------------------------------------------------------------------------
►For Any Query, Suggestion or notes contribution:
Email us at: gatesmashers2018@gmail.com

Опубликовано:

 

19 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 1 тыс.   
@izanagi7
@izanagi7 4 года назад
Dude, i actually struggled to understand the usage and application of a semaphore through the slides of my engineering course, but after watching your toilet example, i finally understand. Thank you so much, you are the professor we don't deserve, but the professor we need.
@tanyadixit8257
@tanyadixit8257 2 года назад
During exams my entire college only remembers one name: Gatesmashers. You are really the teacher and guide our college professors (whom we pay) couldn't be. Thank you so much for providing such valuable content free of cost :)
@BK69XXX
@BK69XXX 2 года назад
I failed my intial exams of previous semester and then i started learning Data structure from your playlist and socred almost full marks in terminal exam. Now for OS i daily watch two or three videos and lectures are very addictive, sometimes i spend entire weekend on youtube learning for your videos.
@GateSmashers
@GateSmashers 2 года назад
Keep learning and achieving
@abhinavbest2553
@abhinavbest2553 11 месяцев назад
jobless
@rishidangi2978
@rishidangi2978 3 месяца назад
kinda nerd
@roshannayak1463
@roshannayak1463 3 года назад
Finally, I can confidently tell that I have understood this topic!! Loved it!!
@snigdhasinha3120
@snigdhasinha3120 5 лет назад
U r amazing .....far better than our faculty....👌👌👍 keep going
@ganeshborse8154
@ganeshborse8154 4 года назад
It right
@gouthamir1807
@gouthamir1807 4 года назад
exactly
@achyutkumarsingh7308
@achyutkumarsingh7308 3 года назад
The best comment i ever read😂😂😂😂
@sonianarendramodi2605
@sonianarendramodi2605 3 года назад
@@achyutkumarsingh7308 flirting ,lol
@souravrajmaitra2069
@souravrajmaitra2069 3 года назад
Strongly agree
@AyushMo
@AyushMo 3 года назад
Yaar ek baat samajh nhi aayi, khali 440k subscriber kaise hai ab tak. Poore youtube pei aur koi operating system aur koi nahi padhaya aise. Deserves more support. Freakin Fantastic, thanks a ton for the course!
@GateSmashers
@GateSmashers 3 года назад
Wow..thank u..jaldi ho jayenge million
@hiteshbansal4878
@hiteshbansal4878 3 года назад
@@GateSmashers I have a doubt, when process (P4) waking up from the block state and there is already some space created in critical section as one process(P1) have come outside, and also the P4 has already run the entry level code uptill the suspend was called and should resume after that(also the value of S is decreased already one time), so it should go to critical section directly resuming from that line but as you said in video it is running again entry code, why? Please Reply And Thank you for these amazing videos
@prasadprojects
@prasadprojects 3 года назад
@@hiteshbansal4878 Any process to enter into critical section have to execute the entry code and exit code, even the process is from wake up() state (blocking state) like P4, P5 ....or the new process like P6, P7, P8, .... so it should not directly go to critical section, as discussed in video it is running again entry code.....
@priyamraj7548
@priyamraj7548 3 года назад
@@hiteshbansal4878 Yeah bro, it should not execute the entry code again but rather enter the Critical Section directly
@AyushMo
@AyushMo 3 года назад
Maine ek aur jageh yeh comment post kia tha, toh yaha pe paste kar rha hu in case you're still struggling or for anyone who doesn't understand it in the future: Reposting a comment from 9 months ago that went unanswered: "sir in 18:23 p4 try karta hi enter karane ke liye then s.value -1 hoti hi ...assume karo wo dobara suspend ho jata hi aur p3 exit code chalata hi to uske baad s. value =0 hogi ..phir iske baad to koi process critical section mei ni hoga ...aur koi next process agar aata hi to s. value negative hoti jayegi , aise case mei to koi andar ni jaa payegaa, humeshaa suspend hote rahengey..pls provide solution" Another comment in English: "what if value of S = 1 and one process entered in CS, value of S becomes 0, Now 50 process try to enter but they get blocked, Now value of S becomes -50, one process which was in CS now come out of CS, value of S becomes -49, now how another process entered in CS" I have the same doubt. From what I've understood, there a couple of things that are therefore incorrect. First off, whenever a process comes back from block list, it doesn't restart its execution of Down(), it would rather resume where it left off from, ie last line of if block. So secondly, this means that the code should actually be 'return;' instead of ' else { return; } ' so that it can actually resume its execution and enter into the critical state. Edit: Actually, I'm watching this again 4 months later. Perhaps you don't need to make the code change. The code is perhaps right, the explanation was wrong. So yes, whenever a process comes back from block list, it doesn't restart its execution of Down() like I said earlier. It continues from where it left indeed. And it left at a place where there's nothing left to execute(There's nothing after if else), so it's done executing Down() and can now enter the critical section. So the code as it is right now is correct, just the explanation that went with it was a little flawed.
@sajib.khan99
@sajib.khan99 3 года назад
Your teaching ability is more capable than some of our university faculty.
@programminglovers2682
@programminglovers2682 3 года назад
True
@nirbhaibaran5620
@nirbhaibaran5620 3 года назад
Perfect comment for him 👍👍
@manavgupta272
@manavgupta272 2 года назад
some ??
@fiboXO
@fiboXO Год назад
frfr
@rasmitasahoo8836
@rasmitasahoo8836 Год назад
💯
@zakriarehman8014
@zakriarehman8014 2 года назад
I wish you could teach us face to face in University. Totally in love with your teaching skills and knowledge transfer. Love from Pakistan.
@ayushjindal4981
@ayushjindal4981 4 года назад
Please dont delete this OS series ever from youtube. I am not making notes expecting that I can access these videos anytime in future..
@vivekranjan1477
@vivekranjan1477 2 года назад
sabas
@noobcharisma3807
@noobcharisma3807 3 года назад
Your teaching skills are amazing, you convey us the concept in 5 mins which our teachers do in 1.5 hours and we still don't understand them. Love from Pakistan
@amanbhadani8840
@amanbhadani8840 2 года назад
Happy to see that u guys are having a pen in your hand not a weapon.
@jashanpreetsingh6056
@jashanpreetsingh6056 2 года назад
@@amanbhadani8840 great thinking ...sir
@insideentrepreneur7904
@insideentrepreneur7904 4 года назад
If I own a college and I have to select only one teacher, it will be Varun Singla. Huge respect sir!!!
@saadrehman3156
@saadrehman3156 3 года назад
I can only say YOU are a true GEM personality, none of the RU-vidrs, even our faculty staff in uni are not as good as YOU are Sir. Much appreciated and lots of love from Pakistan
@imrankhanfanclub3763
@imrankhanfanclub3763 2 года назад
Aray saad bahi
@dnariankajol3542
@dnariankajol3542 5 лет назад
just amazing...very easy to understand when i see ur lecture. thq so much....
@CricketFan_Krishna
@CricketFan_Krishna 3 года назад
mine faculty is like complicating everything and you sir simplicity at next level ...
@Engineerblogbihar
@Engineerblogbihar 3 года назад
watch my video also for this topic
@evendevilscry1431
@evendevilscry1431 4 года назад
Best explanation. The words you choose to speak and even a small bit of information is elaborated so nicely. Thank you
@aakankshasharma4346
@aakankshasharma4346 4 года назад
U are best sir... Aj se phle kbhi process synchronization , semaphore kbhi smjh nahi aaya, but apki video dekhne k bad crystal clear ho gya concept
@saurabhrana4276
@saurabhrana4276 3 года назад
went through few comments....people are watching this video 1 day before exam,mean while me watching this video during exam... #covid19 thank you sir..!!
@amandwivedi5644
@amandwivedi5644 4 года назад
We love you sir..You are a good teacher at all. Keep doing it sir. May god keep you alwz happy and healthy.
@naeemaibrahim1645
@naeemaibrahim1645 3 года назад
YOU ARE THE DEFINITION OF A GOOD TUTOR I SWEARRRR
@shoaib_388
@shoaib_388 Год назад
i can understand only your videos to mark scores in my academic yr ,,,may god give you long life and safe your family from problems and disease
@rashikasharma9199
@rashikasharma9199 6 лет назад
Sir you are an Amazing teacher 🙏👌all doubts are cleared now..
@vishnuSharma-lu1wk
@vishnuSharma-lu1wk 6 лет назад
great sir
@soumyadeepbarik5711
@soumyadeepbarik5711 2 года назад
you are looking very pretty
@vivekranjan1477
@vivekranjan1477 2 года назад
@@soumyadeepbarik5711 well done
@Er.meghajain
@Er.meghajain 6 лет назад
Thanks I had too much confusion on this topic but now cleared
@ShubhamSharma-ky2tf
@ShubhamSharma-ky2tf Год назад
Thank you Varun Sir for explaining the complex concepts in such simple terms. Indebted to you for my interview preparation
@kartikpurohit7457
@kartikpurohit7457 5 лет назад
Sir aapne semaphores ko ittna clearly explain kiya jisse classical problems bohat ache se samaj aayi iske liye sir thanku so much aapke padaane ka tarika bohat acha hai
@aliyazdan4577
@aliyazdan4577 2 года назад
I have a big job interview next week and I need to cover all this stuff I studied 7 years ago. Your videos have been so helpful buddy, thanks a lot 😊
@namangupta4190
@namangupta4190 2 месяца назад
kaisa gaya interview?
@sameerahmed3033
@sameerahmed3033 4 года назад
Perfect example of a Best Teacher
@onmywaytopassion5382
@onmywaytopassion5382 3 года назад
So thankful, so easy to understand by your teaching❤
@abhaydwivedi6354
@abhaydwivedi6354 5 лет назад
This is the best explanation in RU-vid
@vishalsnsingh
@vishalsnsingh 3 года назад
I see half of video and all concept got clear!🙏🙏
@prithwi1820
@prithwi1820 2 года назад
Amazing explanation....after watching your video it is clear to me...
@harshiniadusumilli2509
@harshiniadusumilli2509 3 года назад
U r awesome sir,understood the topic very well and now I am ready to answer all the questions from this topic....Thank you sir
@mabbrarsaif7534
@mabbrarsaif7534 2 года назад
Sir YOU are the best teacher i have ever seen , such a clear cut explaination.Thank you Sir
@afsha.fahm0910
@afsha.fahm0910 5 лет назад
First time i got this concept .Truly amazing Sir!
@vivekranjan1477
@vivekranjan1477 2 года назад
thanks
@nupurahluwalia6575
@nupurahluwalia6575 6 лет назад
Very well explained Sir. Your videos are very helpful. :)
@shivamkhare9472
@shivamkhare9472 2 года назад
after watchig your videos my confidence on this on this subject is increased thank you sir your way of explanation is vary easy
@aryaaryaa4216
@aryaaryaa4216 2 года назад
woah mind blowing explanation. I'm from non-IT branch but i have started loving all your tutorials.. u have made this subject easy. Thank you so much sir More power to you.
@ishanpand3y
@ishanpand3y 5 лет назад
I wish you were my professor in my college ☺️😅. You are just amazing as teacher 🤩😍
@sgr2683
@sgr2683 2 года назад
so true.
@anjalimuchhala4954
@anjalimuchhala4954 3 года назад
Sir you are such a great teacher and your teaching technique also best........thank you so much sir🙏
@sanazamir291
@sanazamir291 4 года назад
Very informative and understandable lecture... Stay blessed
@YasirAli-ow5zt
@YasirAli-ow5zt 5 лет назад
Sir Varunn you are great.... I am natuical officer.... nd i love to learn computer ... i have learnt many things from u... ur videos very help full.... ur videos are exam nights last hope....
@GateSmashers
@GateSmashers 5 лет назад
Haha.. Thank you so much..
@imprakrut
@imprakrut 5 лет назад
Are you also watching this 1 day before your exam?
@geshudsouza3646
@geshudsouza3646 5 лет назад
Yaaa
@MahbuburRahman-uc7np
@MahbuburRahman-uc7np 5 лет назад
me too
@shyamkachhadiya4964
@shyamkachhadiya4964 5 лет назад
yes XD
@srihariyallala407
@srihariyallala407 5 лет назад
Haaa
@Ash-ch9ws
@Ash-ch9ws 5 лет назад
Hm
@kr4k3nn
@kr4k3nn 4 года назад
Awesome Explanation brother....keep it up...God bless you..Thank you Very MUch for making such Video
@labbusharma9865
@labbusharma9865 4 года назад
thank you so much sir you are so amazing .....your teaching really helps me
@MrJ84130
@MrJ84130 Год назад
Hello Sir, I was not able to grasp the concepts of Operating system, but after seeing your videos, I'm able to understand very easily. Thank you very much for your efforts in helping us understand concepts very easily. I had a question: Does counting semaphore provide mutual exclusion? Because I saw many processes are entering the critical section simultaneously. And providing mutual exclusion is a necessity for process synchronization.
@sumitshokeen8774
@sumitshokeen8774 5 лет назад
Thank u sir ji 🙏 way of explanation is lit🔥
@rj...12ka4
@rj...12ka4 5 лет назад
Really it's very helpful . Such a nice and clear explanation Thanks a lot Sir🙏🙏😊😊
@sadiyakhatoon2867
@sadiyakhatoon2867 3 года назад
Thank u soo much sir for explaining each and every point in such an easy way....
@divyashivpandey7750
@divyashivpandey7750 4 года назад
Your videos are really great and easy to understand. They develop a very clear and organized view of the topic enabling student to grasp and gain command on it. As a student the only problem i faced while watching your videos was revision of the topic. For this student has to watch the whole video again (which is not always possible). If possible, you can add a revision notes to each video which covers the topic and are meant for revision purpose. This would not only enhance the content of your channel (which would also promote your channel when students will share notes among them) but also provide students with good study content. Thank you.
@nicholasgaming5711
@nicholasgaming5711 3 года назад
This channel is Amazing 😍😍😍
@supriyakumari7279
@supriyakumari7279 4 года назад
Sir your lecture is too good .your teaching style is very impressive .
@riturajdas214
@riturajdas214 4 года назад
You are really amazing Sir!.. Great explanation 👌👌 . All doubts cleared 😊
@smritipradhan6921
@smritipradhan6921 3 года назад
Thank you for providing industry level education for free.That too such a great course free is the best thing one can avail.
@RohitMishra-ox6oy
@RohitMishra-ox6oy 3 года назад
I challenge in the whole RU-vid u r the best teacher i have come through 🔥
@satvikkhare1844
@satvikkhare1844 3 года назад
well then you watching only Indian youtube.
@VishalYadav-gk1kg
@VishalYadav-gk1kg 8 месяцев назад
Very Nice Explanation Sir, Thank you !
@sudeshmandan2637
@sudeshmandan2637 4 года назад
Amazing way of teaching.. 👍
@ShubhamGhuleCode
@ShubhamGhuleCode 3 года назад
Correction: 15:58 When P4 wakes up it can directly enter the critical section because it has already executed the entry section code ! Thank you for this wonderful lecture series ❤️
@ita755khushalkoli2
@ita755khushalkoli2 3 года назад
I had some doubts about it but I Advice you to solve an example.
@suryasikharej8116
@suryasikharej8116 3 года назад
if you read about multi threading you will see that when a thread is running and wait() is called and after waiting the thread does not directly jump to running state. The thread scheduler(program which decides which thread to run) decides when the thread will run again. Mean while all the operations done by the thread before calling wait() is saved.
@utkarshgangwar2173
@utkarshgangwar2173 3 года назад
@@suryasikharej8116 take 2 processes p1 and p2, suppose p1 comes first and executes down() (take s = 1 initially) means s will become 0 (1-1), now suppose while p1 is in cs , p2 wants to execute down(), where s will become -1(0-1), so 'if' will run for p2 and p2 will get blocked, now suppose p1 completes it's cs and executes up() where s will become 0(-1+1), means 'if' will run and p2 will get wake up but s is currently 0 means if according to sir that p2 will again check down() which means s will become -1(0-1), so in that case 'if' will run means p2 will again get blocked , so in this way p2 will starve, am i right ? or p2 will not execute down() from starting , will it resume after the sleep() call where then it will get the access to cs ? just clear this doubt
@suryasikharej8116
@suryasikharej8116 3 года назад
@@utkarshgangwar2173 You are using binary or counting in your example?
@suryasikharej8116
@suryasikharej8116 3 года назад
p2 will execute down and will go to a list which contains process which are waiting to execute cs. After p1 completes cs and while doing up() it will take one process(lets say p2) from the waiting list and start its exeution .
@devanshmesson2777
@devanshmesson2777 2 года назад
I have a doubt, If S=3, which means, Critical section is capable of having 3 processes inside. Now, 5 processes executes the wait() operation, Now, S = -2, and 3 processes (P1,P2,P3) are already inside the CS. Now, as we know, critical section is capable of having 3 processes, so if P1 exits the CS (Now, S= -1), there are currently 2 processes in the CS, which means, One process must enter the CS, but because S=-1 it cannot enter. So, In order to make P4 enter the CS, one more process should exit the CS, so that S is positive, which is something illogical.Suppose P2 also exits CS. Now S=0. Now if P4 enters the CS, P5 cannot enter the CS now because S becomes -1 after P4 entered. CS has a space of one process but p5 cannot enter. I am not able to understand Counting Semaphore concept! Can anybody explain?
@niranjansaha5135
@niranjansaha5135 Год назад
As per my understanding the process would resume after waking up from sleep so they won't run the Down() function again, they shall enter to the critical section only when the Semaphore value is greater than 1,, there would be a infinite while sloop kind scenery ig,,,,,,,, I came up with this explanation myself just to statisfy my thrust to meet the inconsistency in the video,,, please correct me if you find more suitable ans ..
@adityasankhla1433
@adityasankhla1433 Год назад
@@niranjansaha5135 Yep, I too think that should be it. It is very weird how only a handful on comments are pointing out this obvious mistake.
@rushabhlegion2560
@rushabhlegion2560 Год назад
Damn, same doubt. There are hundreds of students hailing this video but not able to get this doubt. Can you tell me from where to understand this concept?
@satwikjain6455
@satwikjain6455 11 месяцев назад
@@adityasankhla1433 ++
@ranafaisaljoyia965
@ranafaisaljoyia965 4 года назад
sir you are great, huge respect and love from pakistan. you are far more better than our phd professors. jinki hmy zra smjh ni ati.
@krimeera
@krimeera 5 лет назад
2nd best teacher i hv learned from .. Too good 👍👍
@noorulain8463
@noorulain8463 3 года назад
a lot of appreciation from Pakistan :*
@OmitA25
@OmitA25 6 лет назад
awesome explantion.........plz make a vdeo on computer org.
@ajayboudh
@ajayboudh 5 лет назад
This is the easiest video to understand..thanks a lot Sir
@geshudsouza3646
@geshudsouza3646 5 лет назад
Thank u so much sir .....i watch only the vedios which u upload and it helps me a lot and i watch it only one day before my exams but i score good marks....thank u sir
@ayushigoyal6853
@ayushigoyal6853 3 года назад
These vedio lecture series are really helpful.. I m following them for OS,CD.. And will follow for many more.. These lectures are responsible for completing my syllabus on time.. Thank you sir
@Vikashpoonia.ExamsABC
@Vikashpoonia.ExamsABC 5 лет назад
Dear Friend, If you can prepare series on Computer architecture and organization then plz prepare that. We would love to learn from your videos. God bless you.
@sameenqamar6978
@sameenqamar6978 4 года назад
Thank u Sir... You are great.. All doubts clear.. lots of love from Pakistan
@keerthireddy6467
@keerthireddy6467 3 года назад
Sir..uh are simply superb...big fan of ur teaching sir...❤❤
@ashwindhuriya6598
@ashwindhuriya6598 3 года назад
sir consider if semaphore value is 1......if process P1 tries to enter critical section the S will become 0 and it will enter. Next if process P2 wants to enter S value will become -1 and it will go in suspended state . Now consider P1 is completed and it incremented S to 0 which will wake up P2 and will bring it to ready state,now if P2 again wants to enter critical section then S value is currently 0 so it will still go back to suspended state and P1 is also completed....please solve this doubt sir!
@AyushMo
@AyushMo 3 года назад
Exactly, do comment back if you manage to find an answer to that.
@wasifrock687
@wasifrock687 2 года назад
nice observation
@xd69_naruto
@xd69_naruto 3 месяца назад
Exam Tomorrow at 11:30 AM , watching now at 10:45 PM
@NamithaRamachandran
@NamithaRamachandran 3 года назад
excellent work , that much simplified ....thanks
@muhsinmohamed7338
@muhsinmohamed7338 3 года назад
You are truly a saviour ❤️
@arpitsaxena5972
@arpitsaxena5972 4 года назад
Always prefer Gate smashers for my semesters related computer subjects♥️♥️♥️♥️🔥🔥🔥 love your explanation 🔥🔥🔥
@vishalchauhan9832
@vishalchauhan9832 5 лет назад
Best explanation!
@VaibhavTalks
@VaibhavTalks Год назад
thankyou sir for amazing lecture
@swarasworld9813
@swarasworld9813 4 года назад
Wowww. Nicely explained 🤟 now crystal clear 🙏
@mindbodyps
@mindbodyps 3 года назад
This is how teaching become fun
@manmathkumarbhuyan6287
@manmathkumarbhuyan6287 2 года назад
In critical section chapter, it is told that only one process can execute the critical section. But here it is told that more than one process can enter into the critical section even if there is another one.
@snehasispradhan3992
@snehasispradhan3992 Год назад
same doubt. Help me to understand.
@madhu19993
@madhu19993 Год назад
7:59 mutual exclusion doubt will clear at this point of time.
@machireddypalakondareddy9958
@machireddypalakondareddy9958 11 месяцев назад
a counting semaphore can allow multiple processes or threads to access the critical section, hence mutual exclusion is not guaranteed.
@machireddypalakondareddy9958
@machireddypalakondareddy9958 11 месяцев назад
@@madhu19993 mutual exclusion may or may not be achieved
@thejusv.s672
@thejusv.s672 6 лет назад
Good explanation boss..ty very much..now i'm very clear about this topic
@rosejimmy2552
@rosejimmy2552 4 года назад
Thank you sir. You are an amazing teacher sir......
@shudderranz5919
@shudderranz5919 2 месяца назад
aapko 1.5x pe dekhne ki habit ho gyi hai jaise hi 1x pe video chalti hai bada funny lagta hai 😂
@AyushMo
@AyushMo 3 года назад
Reposting a comment from 9 months ago that went unanswered: "sir in 18:23 p4 try karta hi enter karane ke liye then s.value -1 hoti hi ...assume karo wo dobara suspend ho jata hi aur p3 exit code chalata hi to uske baad s. value =0 hogi ..phir iske baad to koi process critical section mei ni hoga ...aur koi next process agar aata hi to s. value negative hoti jayegi , aise case mei to koi andar ni jaa payegaa, humeshaa suspend hote rahengey..pls provide solution" Another comment in English: "what if value of S = 1 and one process entered in CS, value of S becomes 0, Now 50 process try to enter but they get blocked, Now value of S becomes -50, one process which was in CS now come out of CS, value of S becomes -49, now how another process entered in CS" I have the same doubt. From what I've understood, there a couple of things that are therefore incorrect. First off, whenever a process comes back from block list, it doesn't restart its execution of Down(), it would rather resume where it left off from, ie last line of if block. So secondly, this means that the code should actually be 'return;' instead of ' else { return; } ' so that it can actually resume its execution and enter into the critical state. Do correct me if I'm wrong @Gate Smashers
@sanyatayal6933
@sanyatayal6933 3 года назад
Understood now. This is actually helpful.. have been trying to find this out for a long time actually. Thanks!
@AyushMo
@AyushMo 3 года назад
glad it helps.
@suryasikharej8116
@suryasikharej8116 3 года назад
no a process can never directly go to the running state. The long term scheduler will decide which process to put from the new queue to the ready queue.
@AyushMo
@AyushMo 3 года назад
No-one talked about 'directly going to the running state'.. It was a comment on the point of resumption of execution of a process when it comes back from the block list.
@AyushMo
@AyushMo 3 года назад
Actually, I'm watching this again 4 months later. Perhaps you don't need to make the code change. The code is perhaps right, the explanation was wrong. So yes, whenever a process comes back from block list, it doesn't restart its execution of Down() like I said earlier. It continues from where it left indeed. And it left at a place where there's nothing left to execute(There's nothing after if else), so it's done executing Down() and can now enter the critical section. So the code as it is right now is correct, just the explanation that went with it was a little flawed.
@mitaligoyalkhandelwal1652
@mitaligoyalkhandelwal1652 5 лет назад
Thank you so much, it helped a lot🙌
@dattatreypoojari690
@dattatreypoojari690 5 лет назад
amazing teaching...my favorite teachers
@dvlsravya9100
@dvlsravya9100 3 года назад
Your videos are amazing. I have the following queries and would like to know the answers of them. 1. How mutual exclusion is satisfied in case of counting semaphores ? 2. Is there any difference between mutex and semaphore. Explain in detail, if any. 3. If S=1, p1 enters. P2,p3,p4 will be -1,-2,-3. And if p1 is moved out of Critical section with exit code. Semaphore value becomes -2, in such a case; the critical section is left idle as the CS is not utilised by any process. ? Can you explain this state in detail.
@veerrajuannamdevula9939
@veerrajuannamdevula9939 2 года назад
Counting semaphores doesn't satisfy mutual exclusion
@veerrajuannamdevula9939
@veerrajuannamdevula9939 2 года назад
ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-DvF3AsTglUU.html --- check this out to understand difference between semaphore and mutex
@kunjk23
@kunjk23 3 года назад
One question here, won't decrementing or incrementing S in Down and Up result in race conditions as explained in previous videos? Which will lead to inconsistent value for S
@shabir301
@shabir301 2 года назад
Yes , i have also same confusion. Semaphore is also using critical section type code. This result is indeterministic state of program. Let take two process p1,p2. 1)Both performing down code , while sValue =1; means only one program can enter in CS. 2) process 1 : fetch sValue , decrement operation 1-1=0, but not store in ram , process preempted. 3) process 2: fetch (sValue ie 1), Decrement operation 1-1=0, and save to ram, and check s
@hemiacetal1331
@hemiacetal1331 2 года назад
Incrementing/Decrementing are atomic operations i.e., they either execute fully or don't execute at all. So, when more than 1 process will try to update the value of "s" then ultimately "s" will either be equal to 0 or 1.
@bharatkanojiya537
@bharatkanojiya537 3 года назад
nice expiation sir superb method i understand easily all concept thank your so much sir......
@priyankadeka8603
@priyankadeka8603 2 месяца назад
When we have a teacher like him on youtube then it is so easy for distance students. Thank u so much sir❤
@silajitsaha3369
@silajitsaha3369 5 лет назад
Sir, suppose initially s=1. Then p1 enter in CS(s=0) and then p2, p3 and p4 tries to enter in CS(s=-3) and then p1 exit(s=-2) now the CS is empty but still p2 cannot enter in CS why?????
@yogesh8275
@yogesh8275 3 года назад
Iska answer mila kya bhai ?
@roshan84ya99
@roshan84ya99 3 года назад
@@yogesh8275 same question
@pratyushkumar3829
@pratyushkumar3829 3 года назад
I guess because p2, p3 and p4 are in the waiting state (block state) and can only enter when s>0
@yogesh8275
@yogesh8275 3 года назад
There will be deadlock Coz we r try to awake the process which is not actually in sleep condition (for set the value of semaphore greater than one)
@sharmiladevi4012
@sharmiladevi4012 3 года назад
As s value is less then 0 and when value is less than 0 its goes in sleep mode
@YasirAli-ow5zt
@YasirAli-ow5zt 5 лет назад
our teachers even suggests us ur videos here in pakistann ... lOv u sir
@shiladityamukherjee9590
@shiladityamukherjee9590 3 года назад
pakistan mein CS padhte hai log?
@darshandz1227
@darshandz1227 3 года назад
Amazing understanding u gave us
@anshumangaurav6616
@anshumangaurav6616 5 лет назад
Sir.... Aaap ne dil khush kr diya.... Waah ...
@soumyajitdey5720
@soumyajitdey5720 5 лет назад
What is the utility of counting semaphore if it does not follow mutual exclusion?
@palakgupta6804
@palakgupta6804 5 лет назад
Yes please clear this
@naveetakharb7647
@naveetakharb7647 4 года назад
I think....counting semaphore is used for synchronisation and binary semaphore is used for mutual exclusion.
@saptarshidas6971
@saptarshidas6971 4 года назад
@@naveetakharb7647 if you are using the word synchronisation then under synchronisation their is a condition Mutual exclusion According to you one is following synchronisation and other mutual exclusion is kind of absurd type of answer because if any algorithm is synchronised for multi processing that means that it is also following mutual exclusion because to achieve synchronisation you must achieve mutual exclusion as it is primary goal to obtain a synchronised algorithm for multi processing
@amanpanwar8765
@amanpanwar8765 Год назад
sir will it not be 11 processes at 21:13? because if we count the number from 0 to 10 it will be 11.
@priyansuacharya37
@priyansuacharya37 Год назад
No, it's 10 as it shouldn't be counted from 10 to 0 rather you should count from 9 to 0(which is 10). Because for S value 10, the if condition is never applied as it gets reduced to 9 in the line S value = S value -1. Hope you get that.
@alokpant9328
@alokpant9328 5 лет назад
best teacher i have ever seen on youtube
@shivampatil2554
@shivampatil2554 4 года назад
Thank you very much sir for this information 🤗🤗
@tarunmnair
@tarunmnair 4 года назад
@14:41 when P1 comes out of CS, then P4 can enter CS but because semaphore S = -1, it is unable to enter. CS has provision for 3 tasks to enter simultaneously, then when P1 is finished, P4 can take its place? why does that not happen?
@sriharsha8802
@sriharsha8802 4 года назад
I am also having the same doubt. If you got this doubt cleared can you explain to me, please?
@Lalit_Payal
@Lalit_Payal 3 года назад
P4p5 both are in not critical section they are just in ready queue
@reshmajannu1755
@reshmajannu1755 5 лет назад
sir, how can a critical section handle more than one process(p1,p2,p3).it is supposed to run only one program at a time right?
@navagharkiran5769
@navagharkiran5769 4 года назад
its for an example when multiple process occurs at a time in general its one but in computer without ur knowledge a lot of processor at background work
@soumyapawar8125
@soumyapawar8125 4 года назад
There are some resources which can allow more than one processes to run it at a time
@neharaj3324
@neharaj3324 3 года назад
Is it supporting mutual exclusion?
@koushikjana849
@koushikjana849 3 года назад
Just amazing video Thank you sir Please upload practical in this topic
@fahadnaeem9835
@fahadnaeem9835 2 года назад
Your lectures are amazing very beneficial for me keep it up ❤❤❤
@nikeshprasad5559
@nikeshprasad5559 5 лет назад
Sir, when S = 3, 3 processes can enter Critical Section and other processes running the wait() are put to block list. Now when a process exits the CS why can't we simply let a suspended process to enter critical section if it can allow 3 process?
@saravpreetsikka8152
@saravpreetsikka8152 4 года назад
Yes you are right, we will directly add that process from suspended list to critical section Sir explained it wrong, according to sir's explanation if at anytime 4 processes reached in the suspended list then no process can enter in critical section as semaphore value will be -4 and exit code of 3 processes can make it -1 which is less than 0, so no process can enter in the critical section
@sensei249
@sensei249 4 года назад
@@AshishKumar-zs3nk BHAI LOG KYA PUCH RHE VO TO PADH.
Далее
When You're a Chef and a Katana Owner...
00:17
Просмотров 9 млн
Semaphores
22:51
Просмотров 448 тыс.
Operating System In One Shot by Anuj Bhaiya 🔥
1:11:19
Просмотров 477 тыс.
Monitors
13:46
Просмотров 184 тыс.