Process Synchronisation | Critical Section Problem | OS | Lec-54 | Bhanu Priya

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi students coming to the next topic in the subject operating system was process synchronization so here we will see how the process of synchronized in the operating system now let us see on the basis of synchronization actually the process or categorize is two types process is categorized into two types what are this one is independent process independent process and the next one is cooperative process cooperative process so the complete that on the basis of synchronization the process is divided into two types independent cooperative so here the name itself is indicating that it is showing that independent means there is no dependency between one and another process suppose if you are having one or more processor so there is no relationship between this one process and another process each process is independent whereas cooperative process means one processes depends upon the other process and there is a mutual exclusion understanding between the two process that you call it as a cooperative process let me write that independent process execution of one process execution of one process does not affect the execution of others does not affect affects the execution of other that you called as independent process now then what about the cooperative process cooperative process means the execution of one process if it's the execution of other means here it is affecting here is not affecting execution of one process affects the execution of other process no other process so that is the difference between the independent and cooperate to the main thing here you have to be note that it does not affect the executions and it should affects the execution the process of synchronization arises in the case of only cooperative process why it is arises only in the co-operative process so if you take independent processor there is no dependency relationship between one and another process so here a synchronization problem will doesn't arises okay because each process is independent they are not sharing the resources each process is having their own resources okay so that's why there is no problem here in independent processor there is in cooperative process the process synchronization arises in only the co-operative process so also because resources are shared in cooperative process so let me take one simple example it's alive suppose if you are all the people or suppose a committee is there so every everyone was watching us one movie in the committee Hall okay so in the amphitheater so if you are watching the same movie your means in your homes it is independent means whatever you want you can your watch but while you are watching the one movie along with all the people there should be cooperation between those please because you are using the same resources so one movie is watching every so there should be some synchronization between the each one means after this movie we will watch another moon after that we will watch another movie like that there is a cooperation should be there so the execution of one process obviously affects the execution of other because one person may interest it one movie and another person may interest you in another movie he wants to see you you don't want to see that movie so they the process synchronization problem will rises if you are watching the movie sing at your home you are to stay alone okay so then there is no problem for you because you are having your own resources your own TV so that is a general example I'm saying that the process synchronization so whenever there is an independent processes there is no problem in processing Crenn ization so the main process incrementation arises only in the case of cooperative process also because the resources are shared in cooperative process so let me explain a critical sexual problem critical section problem so you may get out what is it Chris critical section problem so I didn't explain about critical section but I'm explaining about the critical section problem so what it means exactly so you understand what is an independent processor and what is a cooperative process so critical section means actually it is nothing but it is a total code segment a critical section is nothing but it is a code segment so this code segment that can be accessed by only one process at a time so only one process can execute that critical section at a time it contains shared variables which need to be synchronized to maintain consistency of data variables so the critical section is all it is nothing but it is a code available so code segment it contains three shared shared variables means everyone can use means suppose if you take that whatever I am feeder I had explained so they that movies how to be wash everyone that is a shared variables so if suppose if you want to solve the problem of process synchronization or you can say do if you want to solve the critical sectional problem so I said critical section is a code segment so means it is a movie that we want to watch so this movie is using the shared variables means Amphitheatre we are using shared variables suppose if a group of team that p1 process is consisting of a group of team and if p2 is another group of thing p3 is another group of team they are come to an understanding p1 wants to see the movie a and the p2 wants to see the movie B and the p3 people wants to see the movie C so everyone will use the amphitheater that is a shared variables okay ABC this old movies but has to play in only shared variable that is amphitheater so then the critical section what it does the people who wants to see the a movie first they will be freezed they will reserve the amphitheater so whenever their reserved the amphitheater that you call it as a code segment they are executing critical section is executing so whenever this critical section is executing the remaining people has to wait until that chance will come okay so next and the person will come and they will watch next and the person will come they will watch okay so this is a mutual understanding between these problems so this critical section problem can be solved by using some different solutions so actually critical section is just a simple code segment so if you want to execute that movie if you want to see that movie that is a ABC movie okay so if all the people wants to use the shared variables so there is a problem arises so that problem you call it as a critical section Pro so that can be solved by using this one technique this is a shared variable means the share variables are accessing by each processor with mutual understanding so okay first you watch and second you watch and the third you watch like that okay I hope you understand exactly what the critical section so don't be confused critical section is nothing but a code segment okay that code segment want to be executed by all the processor okay by using the shared variables so if all the processor come at a time by using the shared variables okay there is a problem arises suppose this person wants to see the move at that time only and then the person also wants to see that movie at the same time means there is some disturbance will occur okay that affects the execution of the processor that movie will not be played at that theater so that is a problem that is a critical section problem so I will just write the sample code for this critical section so actually the critical section is a code segment that can be accessed by only one process at a time it contains a shared variables which need to be synchronized to maintain consistency of read data variables so do this is the entry section next critical section next exit section next remaining remainder section why while this is true then it will execute this process so here they are saying that this is an entry section and exit section so once one process of post p1 p2 p3 porosus wants to use this the same resources shared resources they wants to use the shared resources so when they want to use a shared resources first the p1 will enter the entry section so whenever it entered the intersection it satisfies the condition it goes to the critical section so so until it enters the exit section no other process will enter into this critical section ok suppose p1 work is over it he watches the movie ok then he to intimates with the exit section after exit section it will do its remaining remainder section means it doesn't affect the this remainder is independent so this another process will continue with the remainder section so only the shared resources which are using the shared variables they can use only entry section and exist section and have that program will execute in critical section and the if the this p2 do don't want to use the shared variables so p2 directly enter into remainder section and execute the program so each process when they want to exit they have to enter the exit section these exit checks section will intimate to other process that ok critical section is free you just enter into critical section you can use means removes the lock entry section will make the log and exit section will remove the no ok so let me write that coin then you'll understand entry section controls controls the entry into critical section intersection controls the entry into critical section and gets lock gets lock-on required resources so whatever the resources that process is using that is a shared resources that will be locked and it will continue in the program code execution so critical section is nothing but a code code code segment by using the shared variables it is executing in critical section so after that process work is over exit section will remove the lock removes lock on resources and other others know that it's critical section is over critical section is over so whenever this lock is remorse so then other process the p2 will knows ok the critical section is over so I can enter into this critical section by using the shared variables so whatever the process that using the shared variables that other process will not use that variables until it exit from the critical section this is actually the critical section problem so this critical section problem can be solvable ok so here I'm saying p1 is entering now next p2 is entering now next pre 3 so how can I say the those people those process will enter ok at a time they will also enter ok so then the processor will not understand which process I have to be taking so that can be solved by using this critical section problems can be solved by using some solutions so that I will explain in the next video thank you
Info
Channel: Education 4u
Views: 131,967
Rating: 4.7726159 out of 5
Keywords: process synchronization in operating system, process synchronization in operating system tutorial, process synchronisation in os, critical section problem in operating system, critical section problem in os, critical section problem in operating system in english
Id: sEVfeXqWY-s
Channel Id: undefined
Length: 13min 32sec (812 seconds)
Published: Sun May 20 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.