Тёмный

Lecture 41 Synchronizing multiple threads in Java Hindi 

Java by Saurabh Shukla Sir
Подписаться 208 тыс.
Просмотров 174 тыс.
50% 1

Like, Comments, Share and SUBSCRIBE

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

 

14 окт 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 236   
@jamalwebdevelopment4841
@jamalwebdevelopment4841 4 года назад
Sir, you really deserve respect for providing your lectures free.Thank you
@ayushraghuwanshi9794
@ayushraghuwanshi9794 4 года назад
How anyone can teach at extreme level ? Sir u are superb , legend !! At 2020 I am studying java with ur videos. Thanks a lot for these videos.👍
@viveknepal8959
@viveknepal8959 4 года назад
At 26:25 : D Sir, Bade bade programs mein chhote chhote mistakes hote rehte hai Really worthy to watch this playlist even in 2020 :-) Finally watched 40 videos upto now.... All of them are quite informative, and are explained deeply with simplest possible explanation... Thank you so much for this
@gulzeibkhan17
@gulzeibkhan17 8 лет назад
SIR u r great ...lots of prayer for you...thanks for all videos..can u plz upload lectures about database connection with java???
@javabysaurabhshuklasir3459
@javabysaurabhshuklasir3459 8 лет назад
+abbas Khan coming soon
@sharyarsawati6425
@sharyarsawati6425 8 лет назад
sir monday ko paper ha upload kar da
@lxkakkarot3689
@lxkakkarot3689 7 лет назад
Java by Saurabh Shukla Sir sir in dis video.in which line u hve made the object of class account ??
@rohitnayak4610
@rohitnayak4610 6 лет назад
@@javabysaurabhshuklasir3459 i also waiting for this lecture
@rishikeshsanjekar1349
@rishikeshsanjekar1349 3 года назад
@@javabysaurabhshuklasir3459 .
@rohitnayak4610
@rohitnayak4610 6 лет назад
Sir aapka padane ka tarika bahut acha h jese ki aap phle live example dekar samja dete. Ho and baad m usi ko point m likh dete ho jisse ki student apni copy m note kr sake or baad m rivision kr sake jisse ki sari information subconscious mind m store ho jaye thank you sir Vande matram
@SmartProgramming
@SmartProgramming 6 лет назад
sir very good explanation, nice 👍🙂
@pankajhazra3241
@pankajhazra3241 7 лет назад
I had been confused as of how Synchronization works !!! Now i have a clear picture!!! Thanks!!!
@sanddy1911
@sanddy1911 7 лет назад
You're the best teacher. Best explanation for everything. Thanks for the videos. PS: The paint section is really ugly please replace it with something else.
@sushmagoswami3661
@sushmagoswami3661 4 года назад
Ye to khatarnaak he explanation tha. All the doubts got extremely cleared.
@terabaapfragmaster4723
@terabaapfragmaster4723 5 лет назад
sir you are great ... your teaching method is awesome.... lots of prayer for you....
@amitmaurya5589
@amitmaurya5589 4 года назад
ONE OF THE BEST EXPLANATION ON RU-vid FOR FREE THANK YOU SIR. YOU ARE THE GOD IN TODAY'S ERA.
@tapanjeetroy8266
@tapanjeetroy8266 5 лет назад
Thanks a lot for uploading it... You are doing a great job.. Please friends let me know how this poem is- I am alone...- I am alone, In my life. I am alone, In my way. No one here, To call as dear. No one there, To call as fair. Everything scattered nothing set, Just to bear,never to get ? -By Tapanjeet Roy
@shubhammishra8760
@shubhammishra8760 4 года назад
tapanjeet roy nice poem
@tapanjeetroy8266
@tapanjeetroy8266 4 года назад
@@shubhammishra8760 Thanks brother
@YouTubeloveSachin
@YouTubeloveSachin 5 лет назад
sir, you are the best one I have seen so many videos on youtube but you are the best... the way of explaining awesome sir....really thank you so much....please make some videos on how to get a job as java developer as fresher...step by step with some important question ...please sir, its humble request sir...thanks
@sayantandas4057
@sayantandas4057 4 года назад
Sir you have given the bestest explanation of synchronization of multiple threads. Thanks sir
@jankirawat6610
@jankirawat6610 6 лет назад
sir, i really really like your each videos & your teaching and your doing great work. i have share this channel to my colleagues friends . sir i have a request can u upload a easy readable notes for every programming language u teach. and i feel like there should be a professor like you in every IT colleges .
@movie_mania9684
@movie_mania9684 4 года назад
Love you sir clearly understand the problem and how to handle it thanks sir love from nagpur 💯
@vedantgodhamgaonkar7896
@vedantgodhamgaonkar7896 7 лет назад
Have one doubt.. we are using threading for parallel run of a code. But using Synchronized we are anyhow stopping one thread and running the other one. So aren't we indirectly following linear execution for certain time? I am aware that it will be so fast that we can't even see this difference but just quoting a doubt in general...!! Btw thanks a lot for these amazing videos...!!
@be_like__prateek
@be_like__prateek 5 лет назад
i also have this doubt.... anyone pls help
@nitinhirve7854
@nitinhirve7854 3 года назад
Your code might have 1000 lines and only 5 lines of code needed shared resources, so rather than executing whole 1000 lines in linear fashion you can just synchronize that 5 lines.
@arijitdey534
@arijitdey534 7 лет назад
Sir, First thank you so much for uploading this video. I can't understand 'Private Account account'.Can you please explain? and one more thing,Can you please provide the full code in comment section?
@YashDEVELOPER12
@YashDEVELOPER12 2 года назад
very nice explanation sir with example... really you are a great teacher
@sachinhissaria2766
@sachinhissaria2766 5 лет назад
Java by Saurabh Shukla Sir sir in dis video.in which line u hve made the object of class account ??
@shouviksinha7613
@shouviksinha7613 6 лет назад
you are a good man sir and a great teacher. i wis uwere our college faculty in our Computer Science department.Our departmet really needs you and your teaching
@vishwamit
@vishwamit 8 лет назад
Hi Saurabh, Can we simply synchronize the withdraw method to achieve same result?
@SaurabhSingh-kz5jv
@SaurabhSingh-kz5jv 7 лет назад
Your explainations are really awesome.....hat's off.
@javabysaurabhshuklasir3459
@javabysaurabhshuklasir3459 7 лет назад
Thanks
@vibhudixit8336
@vibhudixit8336 4 года назад
Sir jab code thoda bada ho jaye to ek baar upar se niche poora show kr Diya kijiye. This helps in making notes.
@padhaiparcharcha
@padhaiparcharcha 3 года назад
Sir is work ko ham join(); se bhi kar sakte hain.
@AnuragRawat01
@AnuragRawat01 10 месяцев назад
One of the best teacher❤
@gourabofficial1373
@gourabofficial1373 2 месяца назад
really sir ! great teaching style , Thank u sir
@codelearner419
@codelearner419 2 года назад
sir you are genius
@sohamnavadiya1717
@sohamnavadiya1717 8 лет назад
Thanks for share video, I like your approach to explain concept in very easy manner. I request you to upload video of collection framework in JAVA.
@kshitijbisht8859
@kshitijbisht8859 5 лет назад
Are you placed now?
@thefactAmaze
@thefactAmaze 2 года назад
@@kshitijbisht8859 Are you placed now?
@RAJANKUMAR-oo8ki
@RAJANKUMAR-oo8ki 4 года назад
sir ye synchronizing block ka kam join() method se v to perform kr skte hai na ?
@SonamSharma-ot9uo
@SonamSharma-ot9uo 4 года назад
Sir why the method void withdrawn of class account is running ,as we have not called it just we have made object we have not written like a1.withdrawn
@varunmishra8389
@varunmishra8389 7 лет назад
Sir, what is the concept of MONITOR (also called Semaphore).. in synchronization?? And also.. MUTUALLY EXCLUSIVE LOCK or MUTEX...??
@aryankalra5640
@aryankalra5640 4 года назад
You are very determined! Thank you for all of your efforts!!!
@priteshkumar659
@priteshkumar659 6 лет назад
Problem solving approach is excellent...sir
@sahilanower9189
@sahilanower9189 5 лет назад
is this synchronization of multiple threads similar to just normal single threaded programming? Because i find them quite same.!!
@mintukumar-vj7ox
@mintukumar-vj7ox 7 лет назад
thank you sir aap ke samjhane ka tarika supar hai aap se request hai ki android ka lecture v upload kijiye
@Akaashlawande
@Akaashlawande 6 лет назад
sir u r so so so...... Great.... i really appreciate . Don't say share .... already share this video in my Whatsapp Group.
@surajkhanna1129
@surajkhanna1129 7 лет назад
Great lec!!! had a doubt ,, so in this did we create a Refrence variable "acc" of an object "a1"
@kookaburra2374
@kookaburra2374 4 года назад
This is called concept!!!!
@aloksrivastava1090
@aloksrivastava1090 8 лет назад
Respected sir i Salute you sir.You are very awesome. I beg you sir please tell about Applet Class, Architecture, Skeleton, Display Methods. Swings: Japplet, Icons, labels, Text Fields, Buttons, Combo Boxes.
@javabysaurabhshuklasir3459
@javabysaurabhshuklasir3459 8 лет назад
+Alok Srivastava they are in the pipeline, coming very soon. I am currently uploading one video per day, but planning to upload 2 videos per day. Please visit www.mysirg.com for all updates
@manishhooda871
@manishhooda871 5 лет назад
Sir aap bhut acha samjhate ho no doubt...... But threads wale sare topics me aapke code run nhi kr rhe h accordingly........ Ya to java ka compiler upgrade hone ki wajh se h ya fir kuch aur wajh h
@muhammadamiraltaf7010
@muhammadamiraltaf7010 6 лет назад
Sir, in the customer class you created "private Account account " Is it simple Account class type variable or object of Account class?
@jigarchudasama
@jigarchudasama Год назад
account is Account type variable
@sunilsahoo2799
@sunilsahoo2799 5 лет назад
Sir with same code , when I am writing" enter amount "inside synchronized block , I am getting thread exception for second object , but if I am writing enter amount outside sync blck it is working
@biplabghosh4219
@biplabghosh4219 7 лет назад
Sir, agar Acount class ka reference variable na banaye or object bana sakte hai kya
@UnknownFacts339
@UnknownFacts339 6 лет назад
so so............ awesome sir mind-blowing explained way
@aishwaryajadhav3569
@aishwaryajadhav3569 3 года назад
Sir, why this program is so large? Thanku for making such lectures, I am beginner
@NITINSHARMA-ug8up
@NITINSHARMA-ug8up 8 лет назад
sir u r d best..........ap acha kaam kar re hai
@sahil.bundela
@sahil.bundela 7 лет назад
sir, what is a difference between inheritance and passing an object of one class into object of another class
@nitinhirve7854
@nitinhirve7854 3 года назад
In inheritance you are actually extending the existing class , it will be pro version of previous class. Where when you are passing object of one class in another class you are just calling functions of another class through functions of this class. But no direct connections between both classes.
@smitshah9716
@smitshah9716 2 года назад
Can we extends account class to customer in this?
@harshuchadiya
@harshuchadiya 3 года назад
Thank you so much sir, For this video still helpful to me and will helpful to us in future ❤️, And also sir let me know I want to develop *IOS Developer* Then what should I learn to become it ??
@pravinkumar-ug8bg
@pravinkumar-ug8bg 4 года назад
Thank you very much sir. You have cleared all my doubts.
@Krishan_Verma
@Krishan_Verma 6 лет назад
Sir Still there is a problem in this program that why it's shows in sufficient bal for simran. At line no. 16 same instance variable bal is used for both raj and simran I think it must be a formal variable . Like int newbal = bal-amt;
@darshitvachhani9790
@darshitvachhani9790 5 лет назад
26:18 sir maje ke mood me hain !!!!
@SaadAli-bb7jd
@SaadAli-bb7jd 6 лет назад
You are a great person May God bless you
@shobhitbajaj9667
@shobhitbajaj9667 7 лет назад
me ye jan na chahta hu kya hum ek se jyada object bhi synchronized kar sakte he.
@zeeshanhashmi868
@zeeshanhashmi868 7 лет назад
Great sir.. really commendable work... Kindly share videos relevant to android app development if possible..
@bilalnizamani7447
@bilalnizamani7447 5 лет назад
sir wesy hum join() method use kr k ye problem solve kr skty hain.
@sansk7767
@sansk7767 6 лет назад
sir plzz make video on notify, notifyAll, wait, sleep method in detail with practical example..and what is deadlock, and how to cross calling in synchronised..
@harshjoshi6257
@harshjoshi6257 5 лет назад
Always gotta speed it up to 2x 😅
@haleemasadia4246
@haleemasadia4246 4 года назад
Mee
@PujaKumari-rp5sg
@PujaKumari-rp5sg 4 года назад
Me
@fenilvediya6742
@fenilvediya6742 4 года назад
Mee bro
@fenilvediya6742
@fenilvediya6742 4 года назад
@@PujaKumari-rp5sg hiii
@karlmax61
@karlmax61 4 года назад
me :)
@Mayur___Ingale
@Mayur___Ingale 5 лет назад
sir private Account account ; ye kya tha smz me nhi aaya plz explain
@Rahulranavlogs-gp1hy
@Rahulranavlogs-gp1hy 7 лет назад
sir you are very nice teacher and thnx for good explaning. Sir plz upload a video of inter-thread communication, transient and volatile modifiers
@namandeep4332
@namandeep4332 5 лет назад
my question is that we should always use synchronization where multiple threads use the same resource at same time.
@Itisme5
@Itisme5 7 лет назад
Hi Sir volatile key ka lecture i need to understand pls reply
@RahulZampanbai
@RahulZampanbai 3 года назад
you upload this video Dec 28, 2015 i take advantage in 20-12-2020
@shobhitbajaj9667
@shobhitbajaj9667 7 лет назад
aap bahut achha kam kar rahe ho
@RohitKumar-dz8dh
@RohitKumar-dz8dh 4 года назад
Sir , please make a video on interthread communication. It's humble request to sir..
@numananjum1861
@numananjum1861 7 лет назад
Sir you are great man...God Bless U
@Apurvsankhyadhar
@Apurvsankhyadhar 5 лет назад
Kaaafi gazab video, thanks sir!
@tmahesh3607
@tmahesh3607 5 лет назад
please any 1 explain 18:44 in that sir said account ka object hai na hamare pass...! how did he wrote account.isSufficientBalance plz explain
@priyansh_-_awadhiya_-.6760
@priyansh_-_awadhiya_-.6760 3 года назад
Ye baat Customer Class me likhi hai aur object to ExampleThread me call hua hai to Customer class me call karne k liye account variable ki help li hai I have a better modified code for the Same program. Check here: import java.util.Scanner; class Account { private int bal; public Account(int bal) { this.bal=bal; } public void isSufficientBalance(int w) { if (bal>w) { bal=bal-w; System.out.println("withdral money"+w); System.out.println("your current balance:"+bal); } else { System.out.println("Insufficient balance");} } } class Customer implements Runnable { private String name; private Account account; public Customer(Account account, String n) { this.account=account; name=n; } public void run () {Scanner kb=new Scanner(System.in); synchronized(account){ System.out.println(name+": Enter amount to withdraw"); int amt=kb.nextInt(); account.isSufficientBalance(amt);} } } public class ExampleThread { public static void main(String [] args) { Account a1=new Account(1000); Customer c1=new Customer(a1, "PRIYANSH"); Customer c2=new Customer(a1, "KABIR"); Thread t1=new Thread(c1); Thread t2=new Thread(c2); t1.start(); t2.start();} }
@mohdafzal4017
@mohdafzal4017 6 лет назад
Sir, how to know that what should be passed in synchronized block?
@AbhiSharma-pp8dh
@AbhiSharma-pp8dh 6 лет назад
shaandaar, Jabardast , Zindabaad
@yashrajsingh5768
@yashrajsingh5768 8 лет назад
sirg plz mujhe ye samch mai nhi aa raha hai ki line no 7 mai apne (int w) jo argument liya hai wah kaise acces ho raha hai. usko to apne koi data hi nhi diya hai. kya yaha int type default value hai. sir appke video kamal ka hai .
@jk2346
@jk2346 4 года назад
Thank You from 2020
@sehajdhingra5426
@sehajdhingra5426 8 лет назад
sir you r excellent lecturer,....
@javabysaurabhshuklasir3459
@javabysaurabhshuklasir3459 8 лет назад
+honesty forever thanks please visit www.mysirg.com
@kshitijbisht8859
@kshitijbisht8859 5 лет назад
@honesty forever are you placed now?
@SHUBHAMSINGH-sw6kz
@SHUBHAMSINGH-sw6kz 5 лет назад
Sir U r great, no words for giving thanku to u
@UniqueBansal44
@UniqueBansal44 4 года назад
Mja aagya dekh ke 😁😁
@pranavmitan4011
@pranavmitan4011 5 лет назад
At 18:43 , you say that we have an object of account class but that's not an object...we only made a reference variable. Please Explain
@foodlover3128
@foodlover3128 5 лет назад
haa prr upr dekho hmne acc ka members use krne se pehle usko a1 account ka obj pass krdya account refrence mai...
@srikanths.v.1159
@srikanths.v.1159 3 года назад
sir output alag aa raha he before synchronization ka dono ka withdrawl show nhi kar raha pls guide
@snehlatasarode1957
@snehlatasarode1957 4 года назад
very nice explanation sir 🙏🙏🙏
@syedraghib7670
@syedraghib7670 3 года назад
No need to study in college when saurabh sir is here💖💖💖
@Raw_Matter
@Raw_Matter Год назад
sir i did not understand the reference you that is Account account in customer class
@SonuKhan-mp2yn
@SonuKhan-mp2yn 5 лет назад
Sir aapse to koi bewakoof bhi mahan ban Sakta hai Thank You very much Sir
@abhishekgoel2127
@abhishekgoel2127 5 лет назад
Great person
@zamimajawaid6562
@zamimajawaid6562 7 лет назад
But ye programs to hmlog bina thread ka v kar skte the... To hmlog thread use qq karenge??
@OasisFinder
@OasisFinder 6 лет назад
right per yea ek chota sa program hai aage jake jab hazaro lines ke coding ati hai tab inka use hota hai ache se. yea bas concept clear karne ke liye hai
@prashantsrivastava54
@prashantsrivastava54 6 лет назад
Sir pls make the video on interthread communication
@VishalThakur-zg7ub
@VishalThakur-zg7ub 7 лет назад
Nice video Sir. Can you share the link to this program?
@sharvarithakar6137
@sharvarithakar6137 6 лет назад
Confused in line( private Account account )
@Mayur___Ingale
@Mayur___Ingale 5 лет назад
me bhi
@bhinderjit6606
@bhinderjit6606 3 года назад
i also
@priyansh_-_awadhiya_-.6760
@priyansh_-_awadhiya_-.6760 3 года назад
he declared a variable of account class in customer class. So that this variable can be put in constructor of Customer to point at object of Account class
@SonamSharma-ot9uo
@SonamSharma-ot9uo 4 года назад
Sir why have u written private Account account in customer class..i am not able to understand...we have not made object of account in customer and then we can access the account class
@preetiupadhyay4923
@preetiupadhyay4923 5 лет назад
please provide video on inter thread communication in java
@yasirsultan7767
@yasirsultan7767 3 года назад
sir mera to synchronization k bger b wese he chal rha hy...iski kya reason?
@SonuKhan-mp2yn
@SonuKhan-mp2yn 5 лет назад
Legendary Teacher
@manishraj3325
@manishraj3325 4 года назад
*s ir* thanks so much to making this video, sir mane synchronized() method ka use kre bena withdraw() function bnaya h , so kya mujhe ab synchronized ka use kerna chaye na nahi public void withdraw (int amt) { if(bal-withdraw>0) { bal =bal - amt; System.out.println("withdrawl money is "+amt); System.out.println("your current balance is "+bal); } }
@priyansh_-_awadhiya_-.6760
@priyansh_-_awadhiya_-.6760 3 года назад
I have a better modified code for the Same program. Check here: import java.util.Scanner; class Account { private int bal; public Account(int bal) { this.bal=bal; } public void isSufficientBalance(int w) { if (bal>w) { bal=bal-w; System.out.println("withdral money"+w); System.out.println("your current balance:"+bal); } else { System.out.println("Insufficient balance");} } } class Customer implements Runnable { private String name; private Account account; public Customer(Account account, String n) { this.account=account; name=n; } public void run () {Scanner kb=new Scanner(System.in); synchronized(account){ System.out.println(name+": Enter amount to withdraw"); int amt=kb.nextInt(); account.isSufficientBalance(amt);} } } public class ExampleThread { public static void main(String [] args) { Account a1=new Account(1000); Customer c1=new Customer(a1, "PRIYANSH"); Customer c2=new Customer(a1, "KABIR"); Thread t1=new Thread(c1); Thread t2=new Thread(c2); t1.start(); t2.start();} }
@zenshyam
@zenshyam 5 лет назад
Amazing explanation sir
@akshaydey6143
@akshaydey6143 7 лет назад
Sir, can't we do this program by thread priority ?
@OasisFinder
@OasisFinder 6 лет назад
same question
@MsHimanshuchauhan
@MsHimanshuchauhan 6 лет назад
Can do absolutely
@adityaSharma-ib1il
@adityaSharma-ib1il 5 лет назад
by using rule FIFS
@sushantkumarray3313
@sushantkumarray3313 6 лет назад
Sir, What is Daemon Thread ?
@RajatSingh-rh5hg
@RajatSingh-rh5hg 5 лет назад
what has been done in the line: private Account account; i will be thankful if u explain the same
@Mayur___Ingale
@Mayur___Ingale 5 лет назад
i am also in confusion
@YouTubeloveSachin
@YouTubeloveSachin 5 лет назад
Its private instance variable of Account type... like we make int accNo....in this way..
@deepaksaini9204
@deepaksaini9204 6 лет назад
sir account.isSafficientBalance(amt) me account object kese hua plz reply
@OasisFinder
@OasisFinder 6 лет назад
" account " ek reference variable hai " Account object " ka ,
@mohdwasim6138
@mohdwasim6138 2 года назад
nice shukla g..
@dailyusegadgets789
@dailyusegadgets789 6 лет назад
Thanks alot sir. So amazing voice
@nvision.studywithfun872
@nvision.studywithfun872 7 лет назад
afternoon sir am Ankit Sir i confused with a line in this program which is following {private Account account} sir plz tell me breifly this lin plz plz sir
@lxkakkarot3689
@lxkakkarot3689 7 лет назад
ankit kumar tiwari uska mtlb ye h ki class account ka ek variable bna h account
@amityadav6065
@amityadav6065 7 лет назад
ankit kumar tiwari same problem
@deepaksaini9204
@deepaksaini9204 6 лет назад
pr yha if(account.isSafficientBalance(amt)) ye object kam kese krra h fir
@dhanubhardwaj6935
@dhanubhardwaj6935 6 лет назад
ankit kumar tiwari same problem
Далее
Lecture 42 Introduction to file handling in Java Hindi
20:21
다리찢기 고인물⁉️😱 Leg Splits Challenge
00:37
#89 Race Condition in Java
12:30
Просмотров 69 тыс.
Lecture 68 Queue and Map in Java Hindi
40:55
Просмотров 53 тыс.
Lecture 48 Garbage Collection in Java Hindi
19:21
Просмотров 138 тыс.