Do not miss our Interview Question video series 30 Important C# Interview Questions : ruclips.net/video/BKynEBPqiIM/видео.html 25 Important ASP.NET Interview Questions : ruclips.net/video/pXmMdmJUC0g/видео.html 25 Angular Interview Questions : ruclips.net/video/-jeoyDJDsSM/видео.html 5 MSBI Interview Questions : ruclips.net/video/5E815aXAwYQ/видео.html
Your videos are clear and easy to understand. In fact your tutorials including this video helped me pass the technical interviews in one of the biggest investment bank in UK. Thanks a lot.
It is a great video for learning. i could not find linked video of this one. i would like to learn mutex, monitor and semaphore too..do you have video for that too?
you shouldn't lock with "this", instead, you should lock with a private member object of that class, as the caller of the class should not have access on the object you are using to lock. Just sayin'
True but not always. Sometimes it may make sense to lock with this if the private state you are changing could have such wide implication on whole object that none of the operations can be performed without locking. for example if you are updating account balance in an account object.
mutable state changes on a object need locking sure, but even in these instances, you would not lock on 'this'. rather, the caller(s) from the outside would be responsible for locking the account object. that "lock" would be shared among multiple concurrent processes to ensure the resource (account) is not contested. locking on 'this' removes control from the caller, and leads to confusion. even if on the outset, it appears you are doing the same work. see.... see stackoverflow.com/questions/251391/why-is-lockthis-bad As a note, i am generally against rampant locking on asynchronous operations, i subscribe the whole 'reactive' approach to software design, and am a big advocate for single threaded asynchronous execution over uncontrolled multi threaded execution. The closest analogy i could draw is possibly the nodejs execution model...tho, see the link below if you are curious about the characteristics of the system i describe. en.wikipedia.org/wiki/Reactor_pattern cheers.
If a part is locked so that only the current thread can execute, what do other threads do in the meantime? Do they wait for the lock to disappear or do they skip over the part or do they skip over the complete loop? Thanks!
Thanks for the vids. They are very useful! One thing I noticed, because your mic is a bit cracky in the beginning: I turned on English subtitles and it makes the funniest of sentences based on your narrations! :D
Realy nice video, I have one question for you. In this example you open only two threads if you open multiple treads is there a chance for a deadlock? And if there is how you avoid it? For example if more than two threads want access of Num1 and Num2 to read or to write could resolve to a tread starving for ever?(Maybe not just three threads but more likely 10000 threads doing the same thing.
dnfvideo I have a Question. This is the situation: I have Form with code that back's up files showin in a label th files that are being copied, and at the sametime picturebox with a Gif image is being show. How can I thread the Picturebox to show the gift mage without it to freeze when big file is being copied? Thank you.
excuse me, but wouldn't it make more sense to NOT declare the object as static? as per my understanding, both threads are using a static object, thus getting such error when calling because the values are the same across all the program (that's what static means)... Just asking because I noticed it at the very beggining and was wondering about it all along the duration of this video...
Hello Pablo, The whole point of the video is to demonstrate thread safety so we have created a global object a.k.a static object or else we will never get a thread violation error.
One doubt, the static keyword added to the 'objMaths' instance is only for the purpose that it can be accessed by static main method. The exception will happen, whenever the same Maths object is used by threads, static instance or not. Am I right?
Young programmers please do not do this! Old Programmers know better than not to do this. The only way to do multithreaded communication between threads properly with lock variables is to pass buffer string arrays of data between them. If you use lock variables for any other reason, your program will likely halt because two doors happen. One locks a door while it waits for another door to open while the other one locked that door while waiting for the other. If you don't understand what I said, you shouldn't be using locking variables.
Do not miss our Interview Question video series
30 Important C# Interview Questions : ruclips.net/video/BKynEBPqiIM/видео.html
25 Important ASP.NET Interview Questions : ruclips.net/video/pXmMdmJUC0g/видео.html
25 Angular Interview Questions : ruclips.net/video/-jeoyDJDsSM/видео.html
5 MSBI Interview Questions : ruclips.net/video/5E815aXAwYQ/видео.html
Your videos are clear and easy to understand. In fact your tutorials including this video helped me pass the technical interviews in one of the biggest investment bank in UK. Thanks a lot.
Certainly you & your teaching pattern both are awesome.
God bless you
Very clear, thank you! I can not find the next video about : Monitor, Mutex & Semaphore, can you show me the link??
It is a great video for learning. i could not find linked video of this one. i would like to learn mutex, monitor and semaphore too..do you have video for that too?
you shouldn't lock with "this", instead, you should lock with a private member object of that class, as the caller of the class should not have access on the object you are using to lock. Just sayin'
True but not always. Sometimes it may make sense to lock with this if the private state you are changing could have such wide implication on whole object that none of the operations can be performed without locking. for example if you are updating account balance in an account object.
mutable state changes on a object need locking sure, but even in these instances, you would not lock on 'this'. rather, the caller(s) from the outside would be responsible for locking the account object.
that "lock" would be shared among multiple concurrent processes to ensure the resource (account) is not contested. locking on 'this' removes control from the caller, and leads to confusion. even if on the outset, it appears you are doing the same work. see....
see stackoverflow.com/questions/251391/why-is-lockthis-bad
As a note, i am generally against rampant locking on asynchronous operations, i subscribe the whole 'reactive' approach to software design, and am a big advocate for single threaded asynchronous execution over uncontrolled multi threaded execution. The closest analogy i could draw is possibly the nodejs execution model...tho, see the link below if you are curious about the characteristics of the system i describe.
en.wikipedia.org/wiki/Reactor_pattern
cheers.
Very nicely explained...Please post video of Monitor, Mutex & Semaphore
You explain so well dude !
Very nice! Thanks.
But where is the continuation?
If a part is locked so that only the current thread can execute, what do other threads do in the meantime?
Do they wait for the lock to disappear or do they skip over the part or do they skip over the complete loop?
Thanks!
Thanks for the vids. They are very useful!
One thing I noticed, because your mic is a bit cracky in the beginning: I turned on English subtitles and it makes the funniest of sentences based on your narrations! :D
Nicely explained. Please post video of Monitor, Mutex & Semaphore.
Thanks, I'm just getting started with threading and that helped me a lot :)
Realy nice video, I have one question for you. In this example you open only two threads if you open multiple treads is there a chance for a deadlock? And if there is how you avoid it? For example if more than two threads want access of Num1 and Num2 to read or to write could resolve to a tread starving for ever?(Maybe not just three threads but more likely 10000 threads doing the same thing.
dnfvideo I have a Question.
This is the situation:
I have Form with code that back's up files showin in a label th files that are being copied, and at the sametime picturebox with a Gif image is being show.
How can I thread the Picturebox to show the gift mage without it to freeze when big file is being copied?
Thank you.
VERY clear, thanks!
good enough to learn Thread concept
thank you for this best tuto
Nice tutorial thanks a lot........
Good Work!
nice example
so the lock acts like a try catch
good example
I want to understand full OOPS concert, can anyone help me
@3:15 it reads: static Maths objMaths = new Maths();
How is that possible? Static means stateless...
thanks !
excuse me, but wouldn't it make more sense to NOT declare the object as static? as per my understanding, both threads are using a static object, thus getting such error when calling because the values are the same across all the program (that's what static means)... Just asking because I noticed it at the very beggining and was wondering about it all along the duration of this video...
Hello Pablo,
The whole point of the video is to demonstrate thread safety so we have created a global object a.k.a static object or else we will never get a thread violation error.
.NET Interview Preparation videos
yes, I guessed as much... just wanted to be sure it was the case... TY!!
One doubt, the static keyword added to the 'objMaths' instance is only for the purpose that it can be accessed by static main method. The exception will happen, whenever the same Maths object is used by threads, static instance or not. Am I right?
Young programmers please do not do this!
Old Programmers know better than not to do this.
The only way to do multithreaded communication between threads properly with lock variables is to pass buffer string arrays of data between them. If you use lock variables for any other reason, your program will likely halt because two doors happen. One locks a door while it waits for another door to open while the other one locked that door while waiting for the other. If you don't understand what I said, you shouldn't be using locking variables.
There are lords of messages showing on windows so that's why we are not able to see the code properly
bro...hold the mic away from your mouth
good vid overall
Control f fi FTW
He is doing it intentionally as an example to demonstrate how threads can lock objects.
mafgamt takhrya m3aha had lhindi
I hate your mic, thx for the video though