Good evening friends. To understand a topic, the rule of law, we thought why not call Mr. K. Sundrail, advocate Madurai Bar Association and who is also a special public prosecutor. The most fascinating part was during the COVID times also we tried to connect with Mr. Sundrail to share his knowledge but they say as things happen on their own way. It is after much when everything has returned to normalcy and we wish that it continues. We have been able to connect with him and he has agreed to share his knowledge with us. Being a Sunday, I will straight away request Mr. Sundrail to share his knowledge on the rule of law. We all know that rule of law and rule by law, there is a subtle difference but today's topic will be rule of law. Go to you Mr. Sundrail and we thank you for accepting our invite. Namaskar. Namaskar. Before beginning with, I sincerely thank yourself and Mr. Karananidhi and then I pose. I am honoured to you sir. Perfect. It is a great pleasure and privilege for me to be with you in this law day. I am most obliged to speak about, hello. You can continue, we are hearing you. Okay. The concept of the rule of law. Law is a regulation or code of discipline in the society. The rule of law means the supremacy of law. Law is supreme. It is high. We are below law. Whomsoever you may be, you are not above law. The concept rule of law, that means law is high. It governs, it commands, it corrects, it regulates and it drives the society was perceived long before. The common law was the foundation of rule of law. Later, various countries drafted various constitution and through various provisions they upheld the rule of law. In our country long before, thousands of years ago, the kings were the head of the regime and they were also implementing judicial activities. Their seat in the palace was the royal court and they passed tremendous judgments and upheld the rule of law. The rule of law or the supremacy of law or the majesty of law can be accepted only by disciplined hearts. Persons who are selfish, who are greed, who don't feel any brotherhood, who don't have patriotism, who don't obey the government and governance may not accept the rule of law. To accept the rule of law, you should be a fair and disciplined gentleman, otherwise you may not be able to perceive it. In Tirukura, the couplets, 1330 couplets, written by the great saint Poyard, he upholds the importance of fair rule of law. In his chapter, Seng Konmai, in Tamil. In Tamil, Seng Konmai means proper rule of law. He says, in Tamil, Kudipuram, Kaadu, Ombik, Kadidal, Vadu andru, Vendanthole. The next one, Koalain, Kodiyarai, Vendu, Ovidthal, Paingul, Kaleika, Tadunodane. The translation is very interesting to hear and digest. The first one says, governing the people, protecting them and ruling them and at the same time, when crimes are done by some persons and they are punished, it is not a scar on the face of the king, but it is the duty of the king.  That means they should be executor. This is like removing the waste plants and enemy plants and showing the real plants. So long before it has been tell and appreciated by great saints that the bad should be punished, the good should be celebrated is the rule of law. Now in modern times, law is being enforced through different organs, executive, legislative and judicial. Executives, the bureaucrats and top officials, they should pass orders, implement their duties, according to proper law. Legislatures, the elected representatives in state level and in national level should understand the need of the people and pass proper laws. And in a democratic country like ours, the executives, attitudes, legislatures, work and parliamentarians passing laws have to be tested by judiciary. Judiciary is the bedrock of the constitution and the constitution empowers the third pillar of the constitution namely the judiciary to check the work of executive and legislature. There should not be any confusion between these three organs. One should not interfere with the other. One should not think that it is supreme and the other is inferior. In our country, since the judiciary is empowered with power to correct, modify, annul and accept any law passed by the legislature and parliament, it has done so far excellent service to the society. The one organ, when its step is questioned by judiciary, it should not think that it is defeated or its policy is overturned or it is inferior to the other and the other thinks that it is superior. It should not think like that. The ultimate aim of the constitution is the welfare of the country, welfare of the society and to uphold the rule of law. Likewise, the courts, which are the third important organ to test the veracity of the activities of executive and legislature, should not overdo or interfere with the original power and duty of the executive and legislature, which is amenable and acceptable and approved in the constitutional arguments. So, there should be a harmony between executive, legislature and judiciary so that the rule of law will be excellent and beneficial to the society. Even a king is not above law, he is below law. In olden days, these concept was well adhered and accepted by eminent kings. Manuneri Chola, a king of Chola kingdom, C.P., Chakravarty, Pandiyam, Nedinjaliyam and Shenbhagha Pandiyam were very good examples for upholding the rule of law, which is standing till today to be topped and perceived by so many persons in letter and state. Manuneri Chola had an alarming grievance bell at the entrance of his palace. His son, while he was riding the car, festival car driven by horses, came over the calf of the cow in time. The aggrieved mother cow came and pulled the sting of the alarm bell and the king attended came to know the episode. In turn, he overran his son by his own cart and upheld the rules. Likewise, C.P. Chakravarty, when a bird was shot by an arrow, he gave equal weight of flesh in his thigh and rectified the arrow. Pandiyam, Nedinjaliyam's story is still alive. It is a sterling case of rule of law not followed and what had happened. Karnagi was a daughter of a rich businessman in Pumbukari area on the bank of Kaveri. Karnagi's husband, Kovalan, along with his wife, came to Pandia Kingdom near Madurai and he was about to sell an antlet. Already, when he arrived in Madurai, the queen's antlet was missing at that time. Unfortunately, Karnagi's husband, Kovalan, came with one antlet and he was about to sell. He was taking steps to sell it. The people who were responsible for the missing of the antlet, they planned and framed Kovalan and it was reported to the king that man is having an antlet similar to the antlet that was missing by our queen. In fact, the diamond inside the queen's antlet was less costly and the diamond inside the antlet bracelet of Karnagi was very costly because she was a daughter of a rich businessman. Without making proper enquiry and without following due procedures of enquiry, unfortunately, Kovalan was executed. When the matter reached over Karnagi, he came with another antlet which was in her possession and rushed to the courtyard of Pandia Kingdom. They retrieved a list of women with tears in her ears, came and phased the Pandia king face to face. She commanded and questioned about the verdict of execution of her husband. Then, after questioning him and arguing that he broke the antlet of her own which was in her hand, the diamonds which were more costly than the diamond of antlet owned by the queen, broke and one of the diamonds hit the nose of the king.  I am not a king, I am the thief and he laid down his life on the best traditions of our kingdom in our country. Likewise, so many kings have upheld the rule of law and even now they stand a testament to it. Another interesting thing happened in Madurai itself. One, Shenbagapandian was the king. One day when he was talking with his wife intimately, a doubt arose in his mind.  He put this question to his ministers and other officials and the price was announced to the general public to clear the doubt of the great king Shenbagapandian. The poor poet named Dharumi, he went to Ishwara temple and prayed the Lord to help at that time. Lord Ishwara came as an incarnation of himself as a rich poet and he gave a song, a poem to this poor poet to go and get the prize. When the poem came to the courtyard before the great poet Nakheera for approval, he said, words are perfect but the subject is not correct. When this was informed to the god poet, he got angry, took this poor poet and rashly came to the courtyard of Pandya, Shenbagapandian. There was a quarrel between official poet Nakheera who was more or less an advocate general there and the incarnation poet of Lord Shiva they fought with the words. What the rich poet said was, ladies have natural flavor and scent in their hands but the official poet said no even for Mata Parvati it is not so as they use cosmetics since etc their hair is smelling otherwise not. Then to show who he is, the rich poet opened the third eye in his forehead and showed Nakheera the official poet that who has come as a poet, it was Lord Ishwara as he was having the third eye in his forehead. What did he do? He did not care that the man on the opposite side was Lord Ishwara himself. He did not compromise. He fought against him in length and breadth. Both exchanged hard words and at last Ishwara got angry and burned Nakheera the official poet into ashes. Later the king called, cried and rolled. Then Lord Ishwara appeared before him and made Nakheera the official poet to come in life. Nowadays do you think that such a rule of law is exhibited inside the law courts such as the behavior of prosecutors even though Nakheera fought and upheld the rule of law, later he said requested the king to give away the price to the poor man. So inside the court hall he was ready to give his life to uphold the rule of law but at the same time as a kind man he requested the king to give the price money also. Very recently we came to know that public prosecutors, investigating agencies and the court officers came together, made a mockery of justice as if number of witnesses were examined in a short time. All evidence was read over, exhibits were perused and a judgment was passed in favor of the accused persons. Very rare in our country, a single judge of our way, Suomoto took action and when it was questioned before the apex court, apex court lauded the activity of the single judge.  Why not our law officers? I leave it to you. Rule of law concept is well followed everywhere. We people should educate our young ones to know the importance of law, parents, teachers, great leaders, politicians, lawyers and judges have their own role to give. There is a tendency in the mind of our people to overtake law, to compromise with law, to adjust with law. They give importance to themselves, their wishes and they never fear for rule of law. When we read newspapers daily, you see how many misconducts, offenses, crimes, brutal activities, disobedience to law, breaking the concept of majesty of law, devouting the supremacy of law. What is the reason? There are laws enacted by legislatures and parliaments. There are bureaucrats and government servants passing orders. There are policemen and military men to work towards implementation of law. There are law courts to give judgments. Then why there is anarchy? Why lawlessness is ruling? Why inhuman activities are happening? Why children are spoiled? Why girls are ravished? Why nobody is able to go lonely during nights? Why? Because the system is not working properly. Only if the system is working properly, we can realize the rule of law as supreme. With great respect to bureaucrats, avishyas, legislatures, parliamentarians, leaders, persons who are concerned with law courts, I complete that. There is a total failure of rule of law nowadays. To uphold it, everyone in the society, everyone working in the organ should work for it, feel for it and there should not be any compromise. Unless and otherwise, in every angle we correct ourselves, we may not be able to establish the rule of law as supreme. It will be supreme only in the paper. When a litigant comes with a litigation, he doesn't want to get an order as per the rule of law. When a lawyer conducts a case, he does not want to get a judgment according to justice. When a parliamentarium or a legislature passes an order or governs the country or the state, they did not think that this would work according to law. There lies the problem. Law is perfect in black and white, but the persons who are connected with litigation, law, law courts, law makers and other things are not proper. Unless and otherwise, everybody in the society feels that there should be rule of law, we should feel the majesty of law, there should be harmony in the society. There should be equality, there should be equal protection of laws. Otherwise, we may not enjoy the supremacy of rule of law. That is why I humbly request you all that this society should be educated to feel the supremacy of law, accept the majesty of law. And we should not try to sideline. Nowadays, you can see that there is no opportunity for young ones, students and general public to hear good things. There is no opportunity for us. We are tight lipped in our speedy world and speedy activities. We are money-minded, job-oriented, enjoyment-oriented. We have lost the real meaning of life and we are running towards something which is not real. Unless and otherwise, we live a real life with a disciplined life, following moral codes, treating one another equally and obeying the government and governance. We may not be able to attain the rule of law in its existence. Parents, teachers, everybody has got a role to bring them up. There are no good media assets to treat you properly. Writers also are reduced, mere enjoyment, passing of time, following other traditions, marketing our own good heritage and principles had become an order of the day. And that is one of the big reasons for tilting the rule of law. Let us go to the myth, the Puranas. In Ramayana, what was treated, what was listened, sons should hear the words of father. Young brothers should respect the elder brothers. Wife should obey the husband and to follow him. One should not like the property of another. Ramana, a great king of another country, was informed about Sita Devi and he came. This is a violation of moral code. A violation of law, one should not like the property of another. There were no courts, there were no international courts or there were no big persons common to both of them. But the royal court of Ramana advised him, reprimanded him. But he did not obey the rule of law and so a great war happened and he lost his life. Likewise, Maha Bharatha, two brothers, they had sons. They did not divide the property equally due to ill advice. One brother's son wanted to cheat another and without a due process of law and through cunning means by a game of dice, one won the property of another. It is a futile to rule of law. What happened when great lords were trying to compromise, to uphold the law and to give a good decision that was thwarted by the evil brother and the Guru Chaitra war happened and they lost their life. So rule of law is an excellent concept. If there is a rule of law perfect in any country or any institution or any school or college or in a house that will be peaceful, pleasant. Everybody will have their own share. Everybody will have their rights executed. Everybody can peacefully do their duty. So we cannot define rule of law simply. It is a great one like Indian Osha by every bit or by every drop we can enjoy the goodness. Rule of law was actually made by man in the course of thousands of years. That is man made law in legislative council, in assembly and in parliament. Laws are made after high discussion. Orders are passed by bureaucrats and courts are testing it whether it is correct or not or whether it is within the constitution or not. But even before that the nature or the God made certain rules and laws which are called natural laws, laws of nature. And that is perfect. It is we who are disturbing that natural laws. You see in the universe various planets are moving in their perfect orbit. One does not come into contact with the other. Even in solar eclipse or lunar eclipse, they pass by. They do not come into contact. Plants are there, sea is there, land is there, flora and fauna are there. They are regularized by the law of God. The rule of law is perfect among them they obey. You see when plants are more and plenty and they are eaten by herbivorous, there are carnivorous to eat the herbivorous animals and to control and save the plants. Likewise when the carnivorous is very forceful and dangerous, human beings are there and they eliminate it if it is ferocious or disturbing the other one. The rule of law exposed by God Almighty or nature in whatever name you call they act perfectly within their sphere. It is we who go and interfere with them. We occupy the forest. We vanish the mountain for quarry. In environmental hazards, it is the man who destroys everything. But law does not stop with regulating the man and mankind. The environment law, the forest law and the law relating to water bodies and the law relating to geology. Even non-living things like mountain stone are regularized by law. So rule of law is not required for human beings alone. It is required for the whole universe. It is the breath of universe I can say. The rule of law is a great concept by which one and all can live happily forever. The judges who don the mantle of the law course very important to save this rule of law. Law officers and judges should feel that they are the first servants of judiciary. They should not develop personal policy or notion. They are bound by law. They are bound by treaties which are printed in black and white. They should see that it is implemented properly. Likewise, litigants should fear for court and law. They should not think that law courts are markets and they can purchase some order which may be in favor of them. Lawyers play an important role in showing the rule of law as supreme to the society. Lawyers should do their role as lawyers and stop with them. They should not criticize or comment the court and its function. They don't have any right to confuse the litigants and to criticize the supremacy of law. If they do so, they are blaming their own parents. Likewise, citizens should have a tendency to obey law courts amenable to law and they should feel proud about the supremacy and majesty of law. Otherwise, only lawlessness will prevail. The current order will be a zero. In a famous girl ravishing a few accused were convicted for death. They played all gimmicks and postponed the execution of their heads. At last, a day came and the apex court confirmed the death sentence. A hand man flew from Mumbai, reached Tehran jail at Delhi in the presence of a magistrate, in the presence of doctors. And before the very nose of relatives, the hard goers were executed, were killed by the hanged. The hanged were not able to open their killing. The murder as per order of the court is the clear execution of rule of law. Law is supreme, whomsoever you may be. That is why Thiruvalluvar the great poet said, this is not a scar, this is the duty of the state. Nowadays, I see law colleges are plenty in our country. Every Taluk has got a law college. And it is a great pride and happiness that more people are studying law, especially girls have mushrooms to come and study law. This is a very good symbol for our country. When more lawyers are there, then they can realize the importance of law. They can tell others, they can lead the litigant people and ultimately justice will prevail. In our constitution, from the beginning till the end, citizenship, fundamental rights, duties, how legislatures should form, what is the duty of parliament, how high courts are formed, how supreme court should work. Likewise, every aspect is taken. What is the policy of the government? Everything is there. So, judiciary is the bedrock of this constitution and it should see that there is a governance within the concept of our constitution. So, things are going on which is approved by even we have to respect international law is adumbrated in our constitution. Now, let us pitiably see what is happening in the international arena. This is an united nation. Number of nations are there. The world is in our pocket now. The gadgets and electronic media have reduced the entire big world in our pocket. United nation is there. So many conventions, agreements, governance are there. Big powers are there as security council is international law is perfect. Does the rule of international law is okay now? With great, great respect to the superpowers, I humbly submit that it is not so. See the war between Ukraine and Russia. It went on for months. So many students, employees and migrants from various other countries were there inside the Ukraine. Nobody was scared. Bombing went on. We were not able to digest the scenes we viewed in the television. To such an extent it went on. Nobody was there to control it. Is the united nation sleeping? Are the covenants are invalid? Should not the superpower control it? Is the rule of law the international law is poo pooed in here? We are not able to answer. Likewise, let us take the war between Israel and Palestinians with regard to Gaza Strip. The war between one group and one country.  So many thousands of people were evacuated. There was total failure of rule of international law in that area. Until date, there is no best solution for it. Some giving up of certain prisoners in exchange of other persons who are withheld is going on now. But there is no good woman there. So, whether it is a house, or street, or village, or town, or state, or country, or various countries and world, unless and otherwise, some discipline is followed. Some court conduct is felt. Some rules and regulations are imposed and followed properly if mankind cannot live properly. Coming to various laws to regulate, organize and correct family people. Family laws are there. Property laws are there to regulate the purchase and sale of properties, possession of properties. Likewise, constitutional provisions are there to check the differences and disputes between one government and another government. One state and another state. Central and state, everything is there. Laws are codified. One area is given to states. Another area is held by central government. Some other area is left as common. So, law makers are very intelligent. They have thought for several years and drafted the law. Very recently, in certain states, the elected state executives have passed some bills in their assembly. As a regular course, as adumbrated in our constitution, especially Article 300, they send it to Goober Natorial heads appointed by central government. They withhold it for a long time. They do not say either yes or no. And the state is not able to answer for the people or to do business inside the legislature. Which has to be cordially solved between the state head, a part of central government and the state head who are elected representatives should have been solved across the table within seconds. But the matter has reached the prestigious entry of the apex court. And that has passed certain comments that these matters should not come to us. You cannot sleep over your duties. Please see to it. So, what the politicians should do is, politics is a way to serve people. It is not a brand of business company or firm to do business. The rule of law is supreme, either for X party or for Y party or for Z party. All the political parties, they propagand contest the elections to catch the power. I mean to catch the opportunity to serve the people. It is not a business and you have taken charge of the company. It is a service ground, you are allowed to serve. So, there should not be any conflict between ruling parties and opposite parties. If one party is in hold of central government and various other parties are holding various states, then there should be a brotherhood between all the political parties. You are dignitaries of the government. You are servants of the general population. One should not have enmity with another. One is given an opportunity to serve the people and others should cooperate. Whenever a political party comes and rules the opposite party, think of them as their enemies and they are not allowed to work inside the parliament or legislative. This is burying the rule of law under the ground. By doing service, in the next time you can win, come and occupy the same position. Parliament is a temple of democracy. More than 500 MPs are elected. In every state more than 200 MLAs are elected. When we go through the newspapers, we find atrocities, lawlessness, disorder inside the great institution. And when there is a conflict of interest in a state, when one state is against the central rule, then a hard man is appointed as a governor and he is not cooperating. He makes a mess of passing the bills. This is not proper. All political parties who are the servants of this government, who are the persons below rule of law, below law, servants of law should see that things happen properly. An opportunity is given to them for five years to work for the society, to obey law, to be below law. When you are below law and obey law and feel the supremacy of law, you will feel happiness. That is the richness. That is gaining power. When a lawyer enters inside the court hall, he may be 60 years old. A newly recruited girl at the age of 25 will be a magistrate or munsif. When once the senior lawyer enters inside the court hall, he should bow before the bench. He should not feel that he is bowing before a girl aged 25. He is bowing before the honorable bench. He is respecting the rule of law. He is obeying the books which are tagged there. Likewise, when the boy or girl who are at the age of 25 and senior lawyers come and pay their respects, the judicial officers should not think that he is supreme. The respect is for the bench, for the book, for the treaties, not for him. When once he is respected, he should develop fear. Such a respect is given to me. I should work fairly. I should work judiciously. I should prove that I am perfect. Such a tendency should be developed. Likewise, when parliamentarians and legislatures of different parties meet together inside the temple of democracy, they should work together. They can fight for good cause and not fight for notions there. Ultimately, you are working against the voters, against the interest of the general public and ultimately against the very nation. When a responsible person like legislature, parliamentarian, lawyer, judges and great leaders, they do not work properly, act properly within the corners of law and they do wrong things. Then they are not only acting against themselves, against others and their activities are determined to the very nation itself. You should feel that you are part of the nation and it is your bound and duty to obey law. Lawyers, in those days, they were the freedom fighters. They led the nation. Even freedom fighters, lawyers were more in number than doctors, farmers or businessmen. The struggle by our great men to get freedom should be shown as seeds in the young minds of the people. In our constitution, among duties, it is enshrined. So it is the law that we should feel the importance of freedom struggle. Then only we will respect the country. We will develop patriotism. We will obey the law. Otherwise, we cannot claim the pride of rule of law. Our country is one which was robbed by so many foreign invaders because the location of the country is like that. On three sides, there was sea and on one side, there was a mountain and on the other side, there was a great valley, a fertile valley. So people and fighters from Central World, they invade, they came, they occupy, they spread their own culture and so it is a difficult nation which has got plurality and various sex. But even then, we live together. We are happy even though there are some drawbacks. Ultimately, in total, it is a very good nation and the people are very good and the leaders who lead us are very fine. If certain defects are rectified, if rule of law is allowed to be established, respected and the majesty of law is perceived, then we can stand as a strong nation in Israel. And with great respect to you and thankful to you, I may be permitted to conclude this session. Thank you sir for sharing your knowledge. We could see that you have taken the wide spectrum of the knowledge on rule of law right from the medieval age till the present on the latest affairs. And there is one question he says, we as the citizens have been ruled by force slash fears of king for thousands of years, not rule of law. That's why we respect power, not law. Our education can bring change in the mentality for respect of law. Definitely. By education, we know what is right and wrong. By education, we know what is the situation in other countries. By education, we come across law and its importance. Unless and otherwise, you read newspapers and to watch important news, you may not be able to know what is going on here. Only if you are educated, you know what is meant by legislature, what is parliament, what is its duty, how courts function, what is the importance of law. An uneducated man may not be able to perceive the glory of only if you are educated and your mind is allowed to develop, you can feel the importance of law. Education is a must to know the rule of law. That was the only question, sir. Thank you for sharing your knowledge. We will keep bothering you to share your knowledge on this platform. Thank you everyone. Stay safe. I am most of the best. Stay blessed. And thank you to Mr. Karunan Nithi who introduced me. He is here. Yeah, I would ask him also to join.


Hi, I am Malini Lavande, Musculoskeletal Radiologist at InnoVision Imaging and Nanavati Super Speciality Hospital in Mumbai. Along with my colleague Aditya Daftari at InnoVision Imaging, we have set up a sub-speciality Musculoskeletal Imaging practice both locally as well as with tele-radiology. Both of us are passionate about teaching and we conduct a number of conferences and teaching sessions throughout the year. I am very happy to be part of Indian Radiologist because I think they are doing a great job in making sure that radiology teaching and education is reaching everyone. These are very tough and crazy times and I am optimistic I believe together we shall overcome this and meanwhile stay safe and take care. Today we are going to talk about the role of MRI in shoulder instability. The anatomy has already been covered but a quick recap. The shoulder joint is a joint meant more for mobility than stability. So you have a very shallow glenoid fossa articulating with a spherical humeral head. The fibrocartilaginous labrum forms a rim around the glenoid deepening it. In addition there are other static stabilizers like the superior middle and the inferior glenohumeral ligament which are thickenings of the capsule. Especially the inferior glenohumeral ligament has an anterior band, a posterior band and an inferior hammock like structure and these add to the stability of the shoulder joint. We also have the rotator cuff muscles which are not only mobilizers but also dynamic stabilizers keeping the humeral head in place. Before we begin just a little bit of discussion about how we describe the labral tears. Some people use the clock position where they take the anterior labrum as 3 o'clock, posterior as 9 o'clock, here 12 o'clock and 6 o'clock the inferior labrum. But the problem with this is depending on the right or the left shoulder these would get inverted. Some people follow that the anterior labrum is always called 3 o'clock no matter which shoulder it is. But we prefer to use the quadrant method where we talk of the superior, posterior superior, posterior inferior, inferior, anterior inferior and anterior superior quadrants of labrum. So for example I will describe a tear as, tear involving entire anterior labrum extending across 12 o'clock up to posterior equator. So this will give the surgeon the entire extent of the labral tear so that he can plan the surgery accordingly. Instability could be following an initial episode of trauma or it could be at times congenital because of the lack supporting structures. It could be unidirectional more often anterior or sometimes posterior but it could also be multidirectional when it becomes more difficult to diagnose. Usually patients do not come to us for imaging in the first time immediately after acute trauma but more often they come for imaging following recurrent episodes of dislocation. Whenever we evaluate instability the three main structures that we are looking at is the labrum, the capsule and the bone. The bone on the glenoid side as well as on the humeral side. Now the most common type of instability is the anterior instability and in this what happens is the humeral head which is normally in this position gets dislocated anteriorly and inferiorly. So as you can see when the humeral head gets dislocated in this direction the anterior inferior labrum here gets torn. And also if we can see here the posterior superior humeral head will impinge against the glenoid especially when it relocates and this will lead to anterior inferior labral tear and an impaction fracture along the posterior superior humeral head which is the hill sacs lesion. On an axial image this is how the normal labrum is seen in relation to the glenoid. If there is a tear of the anterior inferior labrum and the periosteum which is attaching here to the bone is also torn it is a cartilaginous bank cartilation or a fibrous bank cartilation. Here are some examples. So we do not do our thrograms anymore since quite a number of years because with high resolution imaging especially with 3 tesla it is possible to get these very high resolution proton density images which can show the labral tear very well. So here you can see the posterior labrum is normal labrum being fibrocartilaginous structure looks hyper intense on all the sequences and here you can clearly see an anterior inferior labral tear. This is a coronal image again depicting the tear well. This is another case again compare it with the normal posterior inferior labrum and here you have got a tear of the anterior inferior labrum. This is a sagittal image so we do not use sagittal images really for diagnosing labral tears we diagnose them on coronal and axial but we use the sagittal image to get an idea of the extent. So here you can see it is from just above the anterior equator going almost up to the 6 o'clock position. Now depending on the force with which the dislocation happens if the force is more a piece of the glenoid may also come out along with the labrum and this is called as the bony bankard lesion. So here in this patient again very important to look at the non-fat saturated images because on fat saturated sequences everything is suppressed looking homogeneously dark and you may not be able to identify the bony fragment well. So here you can see there is a osceus fragment coming off the anterior inferior glenoid which is seen in this sagittal and coronal images well. We need to give dimension of this osceus fragment. If there is a very thin slender flake of bone coming off CT would be better than MR to demonstrate that but having said that to the surgeon it does not really matter. If it is a very thin flake then he is going to probably along with the labrum reattach it back. The thin flake is not something that he would be dealing with separately. If the labrum is torn but the periosteum is still intact it is a perthes lesion. As we can see here the anterior inferior labrum is torn but the periosteum is clearly intact. Now our surgeon says that all this differentiation of the different type of tear does not matter to him. His main questions to us always are is the labrum intact or not. If it is not intact, if it is torn what is the quality of this labrum? The torn labrum is it good or due to chronic recurrent dislocation is this labrum worn off degenerated? And the other question he is interested is in the glenoid bone loss which we will come to later. Alpsa, anterior labral periosteal sleeve avulsion is a condition in which you can see the labrum torn. So the periosteum is still intact and this labrum kind of gets bunched up, displaced inferiorly and medially like a rolled up shirt sleeve. So here is an example this is the torn anterior inferior labrum which is got displaced medially and inferiorly. Glad glenoid labral articular disruption. Here you can see a tear of the labrum and a piece of the adjoining glenoid cartilage has also come off along with it. Here you can see there is a piece of the cartilage which has come off along with the labral tear. Now this was a patient whom we scanned when the shoulder was in anterior dislocation and as you can see here this is the shoulder dislocated anteriorly. So this labrum here is torn and you can see the glenoid impacting into the humeral head and so you will end up getting an impaction fracture along posterior superior humeral head which is the hill sacs lesion. When we see hill sacs lesion it can be very shallow flattened kind of hill sacs as we see here or it could be more deep and wet shaped like here. We need to give the dimension especially this transverse dimension and the depth. This transverse dimension is what is used to determine whether the lesion is engaging or not engaging which will come to slightly later. Do not get confused with this appearance for a hill sacs lesion. A hill sacs lesion will always be seen in the superior most sections where the humeral head begins or above the level of the coracoid process and then it may be large and may be extending below. But if you see something like this which is only in the lower humeral head then it is a normal anatomic groove and we should not get confused with the hill sacs lesion. Coming to the next kind of instability which is posterior instability less common than the anterior instability but usually the patients with anterior instability come to us saying a history of I could feel the shoulder popping out. Here the history may not always be forthcoming the history could be just pain during certain moments and we need to look at the constellation of findings on MRI to diagnose this. So here this is the normal position and now the humeral head is getting dislocated posteriorly and inferiorly. So the posterior inferior labrum gets torn as the humeral head dislocates posteriorly and the impaction injury is seen along the anterior humeral head. So this is called reverse bankard lesion the labral tear and the impaction injury here is the reverse hill sacs lesion. Again a patient who was scanned while his shoulder was in a posteriorly dislocated position and you can clearly see there is an impaction fracture along the anterior humeral head which is the reverse hill sacs lesion and when the humeral head dislocates posteriorly you get a tear here in the posterior inferior labrum which is the reverse bankard lesion. So here is the classic appearance where you have a slightly flattened reverse hill sacs lesion there is marrow edema there suggesting this is an acute event and here you can clearly see the intact anterior inferior labrum while the posterior inferior labrum is torn. Again the sagittal images shows here the extent of the posterior inferior quadrant labral tear. But sometimes the history would not be that of a dislocation it can just be some pain and discomfort. And here what do we see there is posterior labral tear the anterior labrum is seen normal there is a clear posterior labral tear. Also what you see is there is bony osceus remodeling look at the anterior glenoid and here if you see there is osceus remodeling and then this capsule here is lax. So putting these findings together we can suggest that it is possible there is posterior instability for which clinical correlation with the instability test would need to be done. Another structure we need to look carefully at is the inferior glenohumeral ligament. So this here is the inferior glenohumeral ligament the axillary recess region and during dislocation you can have injury to this. And for the surgeon when he goes in arthroscopically this is an area which is difficult to visualize. So he would want to know beforehand if the inferior glenohumeral ligament is intact or not. Here in this patient you can see the normal inferior glenohumeral ligament is seen as a well defined thin hypo intense band but here at the humeral attachment it is torn. So this is what is called as haggle, humeral avulsion of glenohumeral ligament. You can have a similar injury at the glenoid side and that would be called as gaggle, glenoid avulsion of glenohumeral ligament. Sometimes you can have osceus avulsion either from the glenoid attachment or from the humeral attachment. Next coming to the most important question that the orthopedic surgeon is interested in and it is is there anterior inferior glenoid bone loss and if so how much is it? Now if you look at articles there are a number of methods that one can use but the one which we use is the best fit circle method. So this is the normal glenoid if you look at it the anterior inferior quadrant has a convex anterior margin. Something which looks like a pear shaped or as Dr. Resnick says he calls this the avocado shape and with recurrent dislocation this portion of the glenoid with every dislocation some portion of the bone is getting worn off and you start seeing a straight line like this where you know that there is glenoid bone loss and we need to measure how much this is. So the method we follow is for this you need to get a good sagittal plane proton density image and then you draw a line along the axis of the glenoid a longitudinal line this yellow one. Then draw a circle which best fits the posterior inferior and the inferior margin of the glenoid. So this portion should be fitting well into the circle now the anterior and the posterior diameters of this circle should be of the same size. If there is bone loss then we can calculate the percentage this is how we calculate the bone loss. So after having drawn that circle here this is the diameter of the expected intact glenoid and this here is the bone loss. So the bone loss divided by this actual glenoid diameter multiplied by 100 will give you the percentage of the bone loss. A 3D CT is supposed to be the best method to measure the bone loss and when you do CT since you obtain images of both the shoulder you can compare both sides and you can measure the glenoid bone loss. Now why is this so important to the surgeon because if the glenoid bone loss is significant then just repairing the labrum reattaching the labrum is not enough because the glenoid itself has lost its normal pear shape the surgeon needs to do a procedure called as lethargy surgery and this lethargy is usually done as open surgery. You take a piece of the coracoid process and attach it to the glenoid trying to make the glenoid more pear shaped. So this is something the surgeon wants to know beforehand so that he can plan his surgery accordingly. Now is there an absolute figure that about 20% he is going to operate about 25% he is going to operate? No. The surgeon would keep in mind the status of the labrum, the capsule and the bone loss altogether and before deciding on lethargy procedure but usually about more than 20-25% is when they consider it more significant. A new concept is on track versus off track lesion. So if you imagine this hill sack lesion if this hill sack lesion is very large much larger than the glenoid then during abduction and external rotation it will lock itself against the glenoid and this will lead to recurrent dislocation. So in this situation it is not enough to only repair the glenoid labrum and the glenoid bone but it is also important to address this hill sack lesion. So when we talk of on track versus off track the glenoid track means the part of the glenoid which is in contact with the humeral head during abduction and external rotation and that is 83% of this intact glenoid expected diameter. So from here till here or twice of ab is what would have been the expected glenoid diameter 83% of that from that you subtract the bone loss this measurement from anterior margin to the circle this and that gives you the glenoid track. It is called on track or non engaging lesion when the glenoid track is larger than the hill sack interval which is the transverse dimension of the hill sack lesion the maximum transverse dimension. It is called off track or engaging lesion when the hill sack interval is larger than the glenoid track. So when the hill sack lesion is large to prevent recurrent dislocation one needs to do a procedure called as REMPRISAGE where this infraspinatus tendon is attached to the hill sack lesion by a suture anchor so that it fills up this concavity. So to conclude we need to know the anatomy very well we need to give the information which will decide the management that is the status of the labrum the status of the capsule and the status of the bone if there is any bone loss on the humeral side as well as on the glenoid side. We need to be aware of normal variants and pitfalls. Thank you.


Good morning Auroville and the whole wild world Krishna Mackenzie here sharing with you This road back to nature Exploring our relationship with where our food comes from and today. I want to talk to you about weeds so Recently about a couple of months ago I started working with Nina Sengupta who is a very well-known figure in Auroville She is the queen of weeds in Auroville and I think she's also starting a radio show actually soon Here on on Auroville radio Dix next Friday. It's gonna start and Working with Nina has been such an eye-opener because my whole experience Of permaculture natural farming has through has been through the the philosophy and the teachings of Masanabha Fukuoka Which is very much about a non-interventional farming Recognizing that nature's natural processes are far superior to the plow and to pesticides and to all the actions that man Seems to do to nature seems to bring him away from nature because they have repercussions like destroying With the plow we destroy subtle structures in the soil and we expose the all the all the micro organisms to Intense sunlight and and of course then then kill them and we compress the soil under the weight of a tractor So although this looks like an intelligent, you know Practice technique of farming. It's actually destructive and because it's destructive then we need to you know compromise and and do things to to To make up for the mistakes that we've done So there's a great foolishness in that whereas if you look at nature in nature The earthworms are the plow and the roots are the plow and the less we weed the less weeds there are the less at These dominant weeds because when the soil is very impoverished Then we start to have these very pioneer weeds with very intense Root systems that are very hard to get out and you spend all your time trying to weed the land But when you stop plowing and the soil takes on a much more diverse Like a makeup of life in the soil then the structure of the soil changes and because the structure of the soil changes That's the types of weed that populate the soil they change and they become much softer weeds Which are easily removed and and can just even in many cases just be chopped and dropped and be returned as mulch so that just gives one example of how nature is really superior and What I've seen with the this work on Valuing the edible weeds in Oroville is such an eye-opener because it goes even one step further in that valuation that There are so many weeds that grow there's no plowing there's no weeding there's no sowing there's no watering There's nothing much to be done and yet if you start to explore these weeds you see while they're in abundance now This last few weeks I've been doing these videos with Nina for the crowdfunding of her reprinting her Amazing book edible weeds and naturally growing plants in Oroville It is actually it's actually a coloring book and she has two more Editions in the series that are coming out which are on medicinal weeds and edible flowers, so We've been doing these YouTube videos a few times a week in the mornings and The first one we did was on the wild passion fruit leaf so the wild passion fruit as a plant So we looked at the I was familiar with the plant, you know, I know the plant I know all these plants and because I've sort of lived here and I kind of know them You sort of you think you know them It's like you think you know that guy who lives next door because you see him every day But did you actually take time to find out what's in his heart what's in his mind?  Do we take time for something time is our currency So by going with Nina to the field by going close to this wild passion fruit She showed me the fruit first and I I think I've eaten it before but she showed it me much more consciously And I taste and it's so delicious is amazing and it has this lovely They're called brackets. They're like they're like hands green hands holding the fruit and Then she showed me the leaf and she said this leaf can be used as a salad So I tried the leaves. Oh, wow, that's very tasty. That's amazing So the next day for our basket service when we are harvesting the When we are harvesting all the produce from the farm, we're making these baskets which people pay in advance for And one component of the basket is a is a salad kit and another component is a spinach kit So the salad kit just has a diversity of salad greens in it So we added this wild passion fruit leaf to the salad kit and the response we got from people was really amazing how much they liked it and This was something that's been there all the time in as it as Nina's words are it they are here and now You know, they've always been here, but we're too blind to see them So that has become a staple now in the salad kit and it's free and it's there and it's always there and Then we explored a plant called the gangetic primrose or Chinese violet I think the local names are rather sort of arbitrary They, you know, if you go to village to village you can even you can see a lot of variation local names but this gangetic primrose is a weed that has such a Delicate and tender crunch to it very lovely taste and it sort of populates itself It makes like this colony inside the gap between two banana trees And it has these lovely little white flowers, which if I'm not mistaken are also edible and a number of times I've been with the garden Community garden project that I'm doing I've gone to people's houses and I've said to them You know, you really should explore the weeds and I've turned around I've seen that plant I've said look try that leaf and boom they've eaten it they go wow and I think what happens They sort of wonder why they're trying to grow carrots, you know They wonder why they even bothering trying to grow big palak spinach with big leaves when they have this Beautiful leaf just growing everywhere around them So this leaf we also started harvesting and it's also part of the salad kit now Along with the rosella that we already were giving and the chicken spinach that we were that we already were giving and a few other bits and pieces that were already there as components and And Again people are so amazed by it. They think it's wonderful Then there's a third leaf that Nina introduced me to and again, I know it I mean, I've been farming for the last 27 years here in Oroville. I know it and this I know it is actually an arrogance It's an arrogance that says I I know everything and I don't need to be told But actually we don't know.  So this plant is a cousin of the amaranth and it's called purple joy weed or Brazilian joy weed The Latin names you really have to Watch listen to Nina's podcast and her her live radio show on Friday Here at Oroville radio, but the the common names purple joy within Brazilian joy weed are of this Absolutely delicious purple colored Amaranth that's so sturdy and so hardy that goes through a summer No problem comes a little rain and pop up up up up up up up up these tender little leaves start Coming out and you can have it raw in the salad or you can cook it and That also has made an appearance in the spinach kit and there's another weed which is again a cousin of the Amaranthus family and it's This one is crazy prolific in the farm it's growing everywhere and it has these little white flowers They're a bit like if you're familiar with the Mother's names that she's given to the flowers. This is a bit a bit like immortality and I think it's called Yeah, I'm not quite sure the name. I think it's integral immortality or something like that, but it's an amazing Spinach again that's everywhere. So when the ladies are harvesting in the morning I say don't forget to bring that one in they bring like a huge bucket of it in and you can eat the flowers I think it's a good diuretic and good for I Don't know. I'm not quite sure, but there's so many medicinal values for all of these plants It's you really have to research it yourself like I tell people don't don't say Krishna told me go on Google Find the Latin name write it out Research it ask Nina, you know ask questions She's got a beautiful Facebook page called edible weed walk and a YouTube channel called edible weed walk which is really worth checking out and And find out those values oneself. I think that's really important I know the gangetic primrose is very good for Asthma and it's very good for all sort of bronchitis and the lungs Because there's a certain chemical in it and that chemical is well known for having value for the for the lungs So in this last couple of weeks these four plants all of a sudden have become regular You know characters in our in our in our cafe and in the basket service Enriching people's diets enriching people's health adding one more component of diversity to their food and tastes and quality in color and Bringing income for us as well Bringing value to our society by simply valuing something that was all ready there so That really is an eye-opener for me Nina says it's I think she calls it the ultimate organic, you know, it's the ultimate organic because It's just there and there's nothing to do and it's always been there. It's been there in the past It's there. It's in here in the present. It's in the past. It's part of traditions traditional recipes But in the future we can develop new recipes create new traditions with it So it's from the past into the in the present into the future And it's so important that this knowledge Comes alive in our community. I I have a vision of Oroville schools having a class once a week where every student goes with Nina's book and identifies plants harvest plants has a chance to make food with those plants and eat it and and You know, I'm from that book then there comes a biology class and you know ecology class Botany class there comes an art class coloring the using the coloring book There comes maybe even a poetry class comes out of that Maybe a little film class emerges out of that or who knows kids giving making little YouTube videos Explaining to other kids the the importance of this plant and and its qualities and nutritional medicinal values So I see education emerging from this knowledge as well as nutrition and Most importantly, I see a reconnect to mother nature. It's a sensitivity to this planet and That's to each other and to all life and that sensitivity is I think at the very root of a Renaissance of well-being in our in on in this world between us in society as As well as you know on an ecological level The crowdfunding is aimed not just at people giving ten dollars and getting a book The crowdfunding is actually aimed at this vision where people would sponsor a school to maybe get you know all three books or maybe a few copies of each of the books and then have a Couple of the teachers come every month to Oroville to Nina to to have a training of how to value this book and how to use the how to use this book to create a syllabus just to create a content in there in their in their school in their in their classes how to bring that into their career curriculum So actually when people are contributing to this crowdfunding they're actually contributing to a vision of a road back to nature through valuing edible weeds in the society in education and We're gonna start that crowdfunding. Hopefully some time in I think probably in September It's a huge work. It's really a huge work So if anyone's out there who has any ideas and then can offer any help and time and context or if you have a million dollars You know just let us know because it would be so wonderful if we could get this book get these books printed and For Nina, it's really important Not just to make a cheap version of this book for Nina and I'm I don't I mean saying for Nina It seems silly. It's I completely agree with her. She has got this book made with handmade paper It's even the binding is done with with with cotton threads and there's no You know, this is completely natural Material and when you hold it you feel like you're holding something precious and then there's the the interaction of doing the coloring And there's a little pop-out Color manual as well where where you can see a bit more clearly the colors of the flowers and some of the seeds and the leaves So it's really an artwork. This isn't about making something cheap and quick. This is about It's about investing and we should invest we should invest into this type of education This shouldn't be a short cut sort of thing. I think Her vision needs to be honored her work needs to be honored and What better way and then getting this to every kid in in the schools in Oroville and in this bio region So thanks for sharing with me this week go to edible weed walk on YouTube and Many of these plants that we're talking about are slowly being Represented by in videos that Nina is been doing. I've been doing them with her at the beginning But I think other people are also going to join her Also the Facebook page, which is edible weed walk, which there's a lot more content to because the YouTube videos We've just been giving once a week, but I think the Facebook's been updated every day and Instagram is also edible weed walk so check it out and I Look forward to speaking to you next week. You take care. Thank you very much


All right, welcome back everyone. So, new week that we get to start exploring processes. So, all right, come on, settle down, settle down. Volume. Okay, so where did we leave off last time? So last time, we looked how to transform a process and actually run another process. But we didn't actually get to the point where we actually create a process. So finally we get to do that today and hopefully I have a better chat setup so I'll actually read it now. So now I have time, so that should work better. So we had that initial question before of like why the hell am I doing this thing of replacing a process and that's the only way to run a new program. Why don't I just create a new process from scratch and tell it what program I want to run? So if you did that, you would load that program into memory, create the process control block just from scratch out of thin air instead of just copying the curve, instead of doing what we'll see today. So this is what Windows does. So Windows actually has a create process system call like thing and what it will do is it will just create a new process for you out of scratch and you tell it what program you want to run. But Unix is a bit more flexible in that it decomposes this process into two steps. So the process creation, which is separate than running a new program and we'll see that that's actually a useful thing to do and it actually gives us some more functionality. So what Linux does instead or any Unix is instead of creating a new process from scratch, it just clones the currently running process. So what it does is pause the current running process, copy its process control block into a new one so it makes a complete copy of that running process, reuses all of that information so any libraries it has open, any files it has open, all of its contents of memory, everything like that, they're all copied and then the only difference between these two processes after the system call, which is like a clone, is the return value of that system call. And Unix is maintained this like strict parent-child relationship so whatever process initiated the call is called the parent and the other one is called the child because it created it. And that's the only difference and there's a strict parent-child relationship and every single process on Unix follows this. So every single process will have a parent. And then the nice thing about this is if we don't want to continue running a new process that's the exact copy of whatever was running minus its return value, well if you want you can optionally have it create a new process by doing that exact VE system call and then replacing the current running PCB and starting a new process. So it's a two-step process to create and run a different program. So this is kind of what a typical process tree looks like of that parent-child relationship. So everything at the top is a parent and whatever is below it with that line is its direct child. So if you have a virtual machine or you use a Unix system and you do top or h-top, something like that this will be your parent-child relationship and there is only one special process and that is process with process ID 1 usually just called init and the kernel's only job when it's finished booting the actual hardware all it will do is create a new process with process ID 1 so each process gets assigned a number which is just the way to identify it it will be a unique number so when the kernel is done booting it will create one process with process ID 1 and it will load typically whatever is in like S-bin and init or something like that so a program called init and that process is responsible for creating every single other process on your machine. So in this case we can see that okay if we want to follow the tree to say Firefox or something like that well init create a process called systemduser which is a weird thing basically that's just a manager of another manager of processes for your specific user and then you might have like a desktop environment like the actual your actual desktop and it would be something like gnomeshall or something like that if you're using one flavor of Linux and then through that that would be running as a process and then you would go like pick applications Firefox and launch it and that would launch Firefox as part of what it does when you click that Firefox icon and that would be running as a process and then Firefox might have a bunch of different other processes also called Firefox which funnily enough there's going to be one new process for each tab on Firefox basically how they architected Firefox so each of these processes would be a different tab for example and then another way you could go is hey if I opened a terminal then it might have a process like the terminal server and then within that I have my shell which would be zsh or bash or something like that and then next would be whatever command I started executing so if I'm running something like htop that would be the thing running so that would look something like this if I go in here and you probably can't see that at all and I should probably get out of there so if you do something like this so if you do something like this this will show you all the processes running on your machine and try and draw like a tree on that command thing so here we can see process ID 1 all the way on the left there you can see it and then see whatever processes it creates and you can go ahead and explore every single process on your machine so these are all the processes that are actually running and for lab 1 you are writing a simple version of this program so you're going to explore, you're going to see all the programs running on the machine and print out their names as part of lab 1 so this gives you a bunch of information all for lab 1 and you're going to write off this process ID there and you're going to write out not what command got run that the process represents but what its name is so so if you run htop that would be in your dev container if you set up lab 1 already if not, oh yeah, if you haven't logged on the github site for the lab please do that because I have to manually create your repository if you leave it to the last minute and I'm asleep you are definitely screwed so please just do it as soon as possible all you have to do is log in it shouldn't take more than like 2 seconds so you could do it now and then yeah so that's about lab 1 so if you wanted to explore knowing a bit more about this parent-child relationship you could explore see what process created which and next we'll get into how to create those processes but first note that as opposed to before linux terminology is a bit different, I just showed you very generic terminology, linux terminology is a bit different so there's this proc file system which is what you'll be playing with in lab 1 so there's like slash proc and then there's a bunch of folders and files in there that you can explore every entry in proc that has a number, represents a process ID and you can actually poke around and see all the information about the process you want so if you wanted to look up the process state like that state diagram before there's a file in there called status and one of the lines in it just says state that will say what the state of that process is so you could check any state of a process just by reading that file and looking for the line state and in there will be one of those five states running or runnable so linux doesn't make any difference between running and waiting or ready, it just says both are running and then there are two types of sleep or blocking, there's interruptable sleep which means you could wake it back up and it might be able to do some useful work and then there's in interruptable sleep which means no matter what it won't wake up it's waiting for a network connection or something like that so even if you woke it up it couldn't make any progress so it just kind of stays around and then optionally you have some things where you can manually stop and start a process that typically aren't used that much but you can do it and that's that stop state and then the last state is this weird term zombie so we will learn what zombies are in the next lecture and it will get a little bit weird the terminology or kind of gruesome but it's always kind of fun so that's basically how you translate it for linux and you can poke around that proc file system and you will get more familiar with it in lab one so like I said before just so you have it on unix all the curl does whenever it boots up and initializes itself and it's ready to run at programs is all it does is run a single process so it will just run typically a knit which would look for an sbin and knit typically on your file system and that is responsible for executing every single other process on the machine if that process does not exist then the kernel thinks you're shutting down and it will exit for you and shut down your computer so basically if that process exists your operating system exists if that process is gone that means you want to shut down the computer so the curl would go ahead and shut down the computer for you so for linux there's a bunch of different things that could implement in it you could even do your own in it if you really wanted to but for linux it's typically something called system D but there's a bunch of other options that are subject for debate and on some other operating systems there might be other like weird tasks to kind of do some bookkeeping things so some operating systems like windows would make a fake idle process basically to keep track of how much idle time your CPU is just sitting around for and then finally these magic numbers so again these magic numbers for file descriptors are just convention and there's something you should probably remember if you're mucking around with any unix process at all because you have to manage these if you're creating processes and make sure that they actually are what they are supposed to be so every standard convention is that when you start a process there are at least three file descriptors open zero one and two file descriptor zero is standard input file descriptor one is standard output and file descriptor two is standard error so if these are only your file descriptors where you read and write bytes from while we kind of have some knowledge as to what our terminal emulator actually does because these just deal with raw bytes and it doesn't really matter past that so whenever you type into something like a terminal while some of the jobs it has to do is actually translate your key presses into bytes and then writes them to standard in so your process can go ahead and read them and then everything that you write to standard out or standard error well it has to be on the other side of that to read those bytes out which would be typically ASCII characters and then it actually has to draw those bytes out for you on your display so you can actually see them and then part of the other fun that we'll get into with them is you can mess with the file descriptors and redirect them to other things if you just don't want to display them if you want to send them somewhere else the power of Unix is you can go ahead and do that so if you really want to see like if you're debugging maybe you have a bunch of open file descriptors and maybe something went wrong so in that PROC directory there's also this FD directory and that tells you all of the open file descriptors for a process so if you use a PS command that will show a list of processes matching your user there's lots of other flags and in fact if you don't like them well you're writing basically PS for lab one so you could add additional features to that if you want to see anything else about a process but for example if I run a terminal emulator and see what the file descriptors are I can read what standard in out and error are and they'd be something like devTTY which is like a terminal device that you don't have to know and let's go ahead and see just for proof of concept what is actually running on my terminal so I just happened to know because I went through the lecture that my shell is running as that process ID so if I go there and look at the FD directory I can see what the file descriptors are so there's a few other open ones but you can see here that they're a little bit different 0, 1 and 2 are actually all the same thing and there's devPTS thing which looks a bit weird that's a pseudo terminal which you don't have to know the details of it but it's just a fake device that I can read and write bytes to and that's basically what your terminal emulator does but you can see it has a few more open things and you can explore this all you want to kind of get the nitty gritty details of what's going on you can also use this command because you can do that if you see has anyone ever seen that error message before like oh some random process file open and you have no idea what that is well on Unix because you have this you can figure out what it is so for example you can use this LS command or LS of which will tell you what processes have a file open if you really want to know so one thing I could do is I could see what processes actually have libc opened which basically is probably every single process on your machine but if you want to you can do something like that and it will show you everything that has libc open and is using the C standard library so that's kind of a cool thing you can do you don't really need to know how to do that but it's kind of the power of this model and having everything nice and visible for you wrong button okay so that's a little demo of that you can do that for any file on your machine you want so this is actually the meat and potatoes of today so you can find documentation using man whenever you do these labs like if you do man execve you can get some documentation for it today we'll be that cloning process it's called fork so it's called forking and then we'll see a wait system call in the next lecture but you can always use like function name to look up documentation and sometimes if it isn't what you expect you might have to give it a number so for example if you do man fork without any number I believe it gives you like documentation for awk or something that you've probably never used or never heard of so if you want the actual like system call wrapper you have to do man to fork or something like that so that's just something to pay attention to but so let's talk about fork so its API is quite simple it creates a new process which is a copy of the current running one and the reason I introduce this so early is this might actually hurt your brain a little bit because now processes don't start at main and keep on executing now you can create a new process in the middle of another running process so we'll have to probably get used to it and practice it again and it has a following API it's nice and simple where it doesn't take any parameters whatsoever and it returns just the process ID of the newly created process so it's like a C standard wrapper so if it returns negative one that means an error happened you didn't create a new process but typically you always assume it returns successfully otherwise your computer is probably dying in some respect and you probably have much bigger problems but typically we won't see failures we'll see zero returned if it's the child process and we'll see a return value greater than zero in the parent process where that return value is the process ID of the child so the child will get a new process ID as part of being created and then the parent will get that process ID as a return value and the child will just get zero and that's the only way to distinguish what the original process was and what the new process is is just the return value of fork otherwise they are exactly the same and we'll see over and over again what I mean by exactly the same so now there's two processes running and the operating and they like literally exact copies so they can access the same variables but they're completely separate and independent copies of each other so if you modify X in one process it won't touch the other process they're completely separated from each other so we'll see mechanisms behind this because this seems like really slow because I mean it's an exact copy so like even all of the contents of memory will be the exact same which might seem really really really slow like hey if it's Firefox and it's like 10 gigs or something like that because browsers you know use that much RAM well I don't want to have to copy 10 gigs just to create a new process that would probably be really slow we'll see techniques to actually speed it up but for the purposes of you using it it's like an exact copy of all the memory contents as well so here is our example so fork example we'll have one process in each branch so luckily we start reading programs from main as usual so if we execute this program it would start executing it main and then the first thing it does is call fork so fork would create a new process and now right before this return value we would have two processes and now in the parent it would get the process ID of whatever it was just created say created process ID 101 and then in the child which would be process ID 101 it would get zero return there and now there are two processes that can execute it's up to your kernel whether which one to execute or if it wants to run them both in parallel that's up to the kernel you don't get to decide it's up to the kernel and then at this point well in I'll assume that there's no error so that this branch wouldn't be taken so now there are two processes one the child process would be an exact copy so at the time of the fork when it's an exact copy there's nothing defined or anything so there's not really much to copy and then it would return zero from fork so there'd be two processes when I execute this the child would come into this branch and then print off all this information about the child so it would print off whatever fork returned and then it would print its process ID which is done through another system called called getPID so that will return your process ID and then you can also check the child's parent ID independently through another system call so that's getPid so getP parent process ID and then in the child it would be done this if statement and then fall through to the end of it and then return zero which would call exit and then end that process one second and then in the other case where the parent there'd be another process that would check if the process ID is zero it's not it would be the process ID of the child then it would come in this off parent return whatever it was in this case I said 101 then print off its process ID and then its parent yeah so the question is assuming fork doesn't have an error and I get past that then both branches run simultaneously and the answer is there's two processes and they may or may not run simultaneously and you may know what order they run in in fact you definitely won't know what order they're in so it could be random depending on whatever execution and this is the stuff you'll get used to in the course where you have no control and you don't know which one is running first and it is completely up to the curl to the side so after the fork right after the fork returns that's the new process so there's a new process you can think of it right after the fork and it would get a different return value and then otherwise the two processes are exactly the same yep so the two processes are exactly the same except for the return value of fork no so they'll be different so let's go ahead and run this so this is the start of like unfortunately this course will get into threads and processes and we have to argue about this stuff so like you said some questions you might have is like oh what order does this run in funnily enough this will actually execute in the same order like 99 times out of 100 but it's like that 1% chance if you actually rely on it running in order that you run into trouble yeah so I'd be running a process that starts executing main first whatever is currently running so the process currently running that fork call so like so like normally if I ran like hello world or something like that and we ran this we would expect this to create a new process and this to start executing at main so this would be our process and then in this case this process would call fork and it would be a copy of whatever called fork at the time of the fork so let's go ahead and run this and we'll do lots of examples so if I run this I see both sides of the if branch but that's not one process executing both sides of the if branch because that's still impossible we only see both because we execute we have two processes running after the fork so in this case I see parent return process ID so this would be the return value of the fork so in the parent I got process ID uh 31074 so a way to check is we can see the difference between them so the child got returned zero from that fork call and then the child's actual process ID through that getPID system call is 34074 which makes sense because this number the parent return process ID and the child should be exactly the same because that's what we define you know that's what the return value of fork should be so those are the same we can also check that the parents or sorry the child's parent ID which is whatever created it is 34073 which is the parent's process ID so that is what created it and then you could go further and say well what created this process that I just ran on my shell and the answer to that is well this process 22347 and then since we know what PROC is well we can figure out what it is so PROC so that's what created that process so my shell created that fork example process and then within fork example it created a new process and then that printed out those child lines and then that process printed out the parent lines and then they both executed and exited and then stopped so any questions about that yeah yeah so what's our question that if we write something like like that yeah so if we write this so this actually has a special name it's called a fork bomb because it is so the first time through this loop it would create a new process and now there's two processes and now both of them would go back to the beginning of the loop then both of them would create a new process each so that we have two new processes then all four of those will go back and then create two new and we'll have 8 then we'll have 16 then we'll have 32 so one fun thing you can do to your friends there's like a shell command that will do this and it looks really really weird and yeah if you do that it just creates processes over and over again exponentially and then eventually your computer will run out resources and crash so if you want to provide some protection against it that's what you have to do as like a kernel so some newer kernels will actually detect things like this and be like no no no I'm gonna kill you before you start replicating so this is something you can do but alright any other questions yeah so that's the return value of the fork so here I'll show it another way too so we'll go through this like fairly fairly slow so first we'll assume we're running this program and we are running it as a process and I'll just say for simplicity that it's currently running process ID like 100 so if I say I have process ID 100 that something else creates for me and starts executing I start executing main so I'll put a blue marker that says where each process is currently executing so before I'm created I start calling main I haven't made any call yet then process ID 100 is going to call fork and now process ID 100 is going to move down here and as part of that assuming it's successful it's going to create a new process so we would call it say process ID 101 and it is also it is also right after the fork so right before the fork there are exact copies of each other in this case there's nothing to differentiate them at all and then the only difference after the fork call is going to be the value of return PID so in process 100 what would its return value be from that fork yeah 101 because that is the process ID of the newly created one so it would get 101 back as the return value fork and process 101 would get zero back as that return so this is after the fork so it is not a copy because it happens after the fork the only thing that gets copied are the state right at the fork not after so after they're slightly different and the only way there difference that return value so now at this point we have two things executing we process ID 100 and 101 at this point you don't know which one is going to execute first so if you want to like be if you want to be really complete you would have to argue about you know if this runs first then I'll see this if this runs first then I might see this and you'd have to do that for every single line because it could get swapped out at any time and we'll see that a little bit but now I assume that if let's say for example it chooses to run process ID 101 well it's going to execute as we know normally it would check the if conditions and everything so in process ID 101 here whoops come on yeah so it's in process ID 101 is process ID greater than 0 hope no right so it would fill this and in this process it would go to the else and then check is the return PID equal to 0 and this case it is so it would go ahead and the next thing if it's still executing would print or would execute this print f which would execute the child thing and then eventually it's going to print off all the statements and then fall out and then it would just return 0 and in which case at that point it exits the process and that process is no more anymore and then next we still have another process executing so that's process ID 100 so in this case instead it would reach the same branch again so it would reach this if statement but now it's checking the return PID which is different between them and it would actually check that hey it's greater than 0 now because it is 101 so it would print off the parent return whatever and then the other prints and then because it's in an else if it would just jump to the end because it's done it went into the if branch then execute return 0 and then it would be done so everything is a copy and they're all independent so we can see what that looks like too okay so first here so first I'll demonstrate a few other things so here whenever I run it I always see parent first instead of child well the only reason I see that is because I put this command here which is like a you sleep system command or system call which tells the current process to just go to sleep for a little bit and wait so it's just kind of wasting time after it prints which actually shouldn't do anything and you actually don't know why I put this here yeah this is not here for the reason I thought sorry so we'll see why that's there in the next lecture but it doesn't have to be but sorry that's confusing yeah don't worry about that sleep for now but if I run it over and over again I always see parent first although there's nothing stopping child from going first and I am getting very unlucky so like I said like yeah oh sorry you can't see anything okay whoo okay so if I execute this program again and again and again well I always see parent first instead of child and in this case I'm just getting super unlucky okay I guess this year I just get unlucky so you can see them in different orders but it's really really really rare because typically the way the scheduler works is it gives each process like a little slice of time and in this case it's not really doing anything so by the time it calls fork it would probably have some time left to execute and then immediately continues executing after the fork that original process so like like I said like 99 times out of 100 you'll see parent first yeah yep they can be stopped mid if statement as well so if I wanted to I could go ahead if I want to like see issue I could sleep here so you sleep will put this process to sleep first for one second so in this case no matter what order they switch tend to switch really really fast I should see parent return process ID and then it will be in that block state and another process can run so that child process will probably run print it three lines and then we'll see the parent do the other ones so if we go ahead and we so if we go ahead and compile that and run it now we see that hey that first parent line happens then it would switch to another process do those three prints and then finish the last two prints of the child yep yeah so it could stop in the middle print f depending on how print f implemented because it may or may not do a system call or may split up the input if it's like too big but it would get interrupted at some point if you have lots of processes running then they may just if like there's a line break or something it may get interrupted in the middle and you see like it split off weird so yeah this would happen yep yep yep so the child doesn't exist until fork is done so the way it works is only one process is calling the fork in this so when I initially start here like when I start running main I only have my process 100 and then process 100 like 101 doesn't exist yet so process 100 will call fork and that will create process 101 and then the only way to differentiate them is the return value of fork so in process ID 100 it will see 101 returned and then in the newly created one it will see 0 so you can think of that so after fork there's going to be two processes and the only way to tell them apart is the return value of fork so there's two things that can run and you don't know what order they're going to run in yep so this is an example of concurrency or parallelism we'll get to that later but you don't know what it is like you know we won't have two things running some chance if I only have a real CPU for example but it could run concurrently your operating system or kernel is the one that switches between processes that we touched on a little bit and to see that they're actually like complete copies of each other well let's make some variables that do something more interesting so I've int x equals 42 and I need to switch that so I've int x equals 42 so if I'm truthful I would be like hey at the fork let's print so if I do something like that and I run this what should I see I should see x equals 42 two times because it's after the fork if I move it here what should I see yeah x equals 42 one time because it's before the fork so let's go ahead and make sure that that is actually true so if I go ahead and do that I see x equals 42 probably from the parent yeah it would be from the parent then I see x equals 42 from the child and they're completely separate but I mean I just made the variable it's not really that compelling so what would happen if I did something like so in here my parent always runs first and my parent always runs last so let's say in the child I do something like x equals I don't know give me a number 13 so in this case I have x equals 13 in the child and only the child and here I'll remove that so anyone has a guess what I'll see printed yeah yeah ideally if they're completely independent well here before the fork I have x equals 42 and then that exists before the fork and then I would fork so both processes would have an x called 42 or the x with the value 42 and then there'd be two independent copies after the fork so if I change one it wouldn't change the other so in here in my parent it wouldn't change anything and then print off x hopefully equals 42 and then only in the child it would print x equals 13 and go ahead and print x equals 13 so let's see that so if I do that I see x equals 13 and that change happens after I print it so it definitely happened first I definitely changed x equals 13 before the other one printed what the value of x is and I can see it's still 42 sorry you had a question? so with a fork they're exact copies of each other and they copy even the memory contents so they're exact copies so this seems a bit weird right but this is how it is any questions about that or any like other examples you want me to do with that yeah so the question is if I have a file and it copies everything including those open files well would I have problems with two things writing to the same file and yeah you would which is funnily enough that's why I see both print so we both we know that the print f's just write to file descriptor one and that's why I see them both on my terminal because it's a fork they're exact copies even their standard outputs so both processes standard output go to the same thing so that's why I see both of them okay so we can see even like and by exact copy I'm going to mean like exact copy so even if I so maybe it's okay that their exact copies in terms of like the value of x's the same but like what about its address so if they're like exact copies down to the byte should they both have the exact same address even though their values are completely the same all right hands up same address hands up different address okay that would make sense that they have different addresses right kind of well if they were exact clones they should be exact clones like they should even have the same memory address which seems a bit weird but if I go ahead and run that yeah it complains whatever they have the same memory address even I told you they are exact copies of each other and they're completely independent yeah it's the operating system so someone already solved the mystery this happens because of the magic that we like touched on before virtual memory each process has its own virtual so virtual addresses so they're not real physical addresses so as part of the black magic of your kernel well in this process this address would only be valid for this process to point to a specific location in memory and in the other process this address would actually point to a different physical location of memory even though they look exactly the same yep so the question is when the first fork happens do they point to the same physical memory address so the answer to that is initially it does and that makes it fast but we'll get into the implementation details as to what's actually going on there yep we'll get there okay any other quick questions yep well we can do that so the question was is the address completely randomly if I created it after the fork would they be you know completely different so in this case if I move the x back one it's not copied as part of that fork and then I have two processes that create x as their next thing they do so if I go ahead and run that I see that hey their memory location are exactly the same and why is that well if I do int x it's created on the stack and right before that fork happens well there's that main function has a stack its stack pointer is going to be at some address and at the fork it's an exact copy so at the fork they actually both have the same stack pointer address so if they both do the same step of just creating one more variable on the stack they'll have the same address yep so we'll get to that each process has its own like virtual memory that's actually mapped to valid addresses yep so here I can make them diverged like they can completely diverge if I have you know if I create a y here in this process it would have a y and the other one wouldn't they're completely different now and in fact to create a new process I could do like the execve here in this one and it would be a completely new thing yep this is the only way to make them do different things because that's the only return value you get from it you just get a number and that's it yep so the question is if I just malloc do I get the same address and the answer is it would probably set up the malloc library and it would all be the same addresses so if I do the same step I get the same thing alright well we'll leave at this for today we had nothing on in the chat which was kind of weird but cool alright just remember pulling for you we're all in this together yep