c# (Csharp) threading interview question:- What is thread,background thread and foreground thread ?

Поділитися
Вставка
  • Опубліковано 17 січ 2025

КОМЕНТАРІ • 104

  • @dnfvideo
    @dnfvideo  3 роки тому +2

    Do not miss our Interview Question video series
    30 Important C# Interview Questions : ua-cam.com/video/BKynEBPqiIM/v-deo.html
    25 Important ASP.NET Interview Questions : ua-cam.com/video/pXmMdmJUC0g/v-deo.html
    25 Angular Interview Questions : ua-cam.com/video/-jeoyDJDsSM/v-deo.html
    5 MSBI Interview Questions : ua-cam.com/video/5E815aXAwYQ/v-deo.html

  • @TheDream3873
    @TheDream3873 11 років тому +3

    Much better than my instructor. Short and to the point!

  • @DineshbabuSengottian
    @DineshbabuSengottian 9 років тому +19

    Small correction in this vedio : Background thread will live until the life time of last foreground thread belongs to that process.

  • @billywang5486
    @billywang5486 2 роки тому

    Thanks for the contribution to the C# community!

  • @claudioas2001
    @claudioas2001 12 років тому +3

    Excellent, simple and easy to remember tutorial. Best explanation I found so far. Thanks, keep your great job.

  • @tcbetka
    @tcbetka 12 років тому

    No, I'd say you got it right... The term "threaded application" pretty much implies "parallel" execution of those threads--as long as you assume the threads to be asynchronous. If they are synchronous, then one might argue that the first thread stops to wait for the second and therefore they aren't truly executing at the same time. But with only one core, you don't have much other choice. So while I can see his point, I think you have presented this in an accurate fashion. Thanks!

  • @EricAnthonyBurnett
    @EricAnthonyBurnett 12 років тому +2

    Great video! It helped me better understand threading in C#. Thank you!

  • @morsheddld
    @morsheddld 5 років тому +2

    This was an awesome demonstration of Thread. Totally realised, thx a lot. Very understandable.

  • @JonWoo
    @JonWoo 12 років тому

    Straight to the point and clearly explained. Awesome

  • @gm6902
    @gm6902 3 роки тому

    This video helps me a lot. Thank you.

  • @rasikasamith
    @rasikasamith 4 місяці тому

    Excellent video. Thanks a lot.

  • @maxron6514
    @maxron6514 4 роки тому

    This is kept simple and straight forward to the point. Good one

  • @poojapandey4149
    @poojapandey4149 3 роки тому

    Perfect for beginners in threading concept, great help

  • @MikeStock88
    @MikeStock88 2 роки тому

    Great explanation, thanks for sharing

  • @Jemszie
    @Jemszie 3 роки тому

    very2 helpful for me to understand the Thread. Thanks dude for the video

  • @jinrajkr4330
    @jinrajkr4330 12 років тому

    really good explanation on threading.. thnkz for the video.

  • @naukriabhi3
    @naukriabhi3 12 років тому +2

    Well in the last part of the video..I can see 'The main application has exited' and below that 'Function1 is entered'...How it is possible...I mean as it reaches to the end of the main program first it shouldn't display the 'Function1 is entered' at all.... Is it because of the delay in writing/displaying to the console application (I mean thread reached first to 'Function1 is entered' and then 'The main application has exited' but display wise it looks opposite) or I am missing something....???

  • @music130man
    @music130man 4 роки тому

    Excellent video, very informative. Thanks.

  • @jessy9643
    @jessy9643 6 років тому

    Nice class !! Worth for listening

  • @darshankalathiya8667
    @darshankalathiya8667 Рік тому

    great learning.

  • @eshansingh1
    @eshansingh1 10 років тому +2

    Thank you for your videos they are very useful!

    • @deepawar_
      @deepawar_ 9 років тому

      in the starting : sheeshap LOL

  • @PhynnOfficial
    @PhynnOfficial 12 років тому

    Great tutorial sir. Well done. It helped me a lot!

  • @kalaqueen4659
    @kalaqueen4659 10 років тому

    greate.ur explaination s simple & clear.

  • @mizantednioc
    @mizantednioc 4 роки тому

    Thank you! very easy to understand

  • @ibknl1986
    @ibknl1986 11 років тому

    Hi, Your explanation is too good and i find it very informative and understandable just in one watch.Thanks.

  • @anikbutt22
    @anikbutt22 12 років тому

    beautifully demonstrated.. thank you alot..

  • @manishverma86
    @manishverma86 11 років тому

    Much better explanation...Thanks. :)

  • @bringaab
    @bringaab 12 років тому

    great tutorial. more power.

  • @robertslamon4403
    @robertslamon4403 6 років тому

    Nice vid! You made this simple.

  • @chowhaan109nitw
    @chowhaan109nitw 4 роки тому

    Nicely explained

  • @Innoventico
    @Innoventico 6 років тому +2

    She is very sharp.

  • @pouriahasheminasab5105
    @pouriahasheminasab5105 12 років тому

    Thanks for your nice videos.

  • @GhostManYT
    @GhostManYT 9 років тому +3

    nicely explained.

  • @manjeetnandal1
    @manjeetnandal1 5 років тому

    Great sharing!

  • @lamarts100
    @lamarts100 12 років тому

    Great tutorial!!!

  • @sumityadav-mt5jz
    @sumityadav-mt5jz 7 років тому

    nicely explained..👍

  • @mememonster2370
    @mememonster2370 10 місяців тому

    after 12 years
    Task - An opeartion
    Thread - process a Task (or executes an operation)
    Multithreading - process multiple task parallel

  • @shuangwang1689
    @shuangwang1689 8 років тому

    wonderful ! it helps me a lot , Thank you very much .

  • @rezkhan3366
    @rezkhan3366 3 роки тому

    Awesome!

  • @tayfunaykin4091
    @tayfunaykin4091 10 років тому

    It's very clear and usefull

  • @jeevanwijerathna
    @jeevanwijerathna 12 років тому

    good explanation. thanks

  • @FlyingBullets
    @FlyingBullets 10 років тому

    Nice, Thanks! Good one, greetings from Germany

  • @ChuckNiddy87
    @ChuckNiddy87 12 років тому

    Thanks great tutorial

  • @kk3528
    @kk3528 3 роки тому

    Very good

  • @Gary190tube
    @Gary190tube 12 років тому

    Great video.

  • @RajKumar-nh8ko
    @RajKumar-nh8ko 4 роки тому

    Nice 👍

  • @gunarsekaran
    @gunarsekaran 11 років тому +2

    very usefull...

  • @joshuazhang6995
    @joshuazhang6995 9 років тому

    nice one !!! thank you so much

  • @tcbetka
    @tcbetka 12 років тому

    I don't think it matters whether or not the threads are foreground or background. As I understand it, that only affects the persistence of the spawned thread when the parent thread terminates...as you've shown in your demonstration.
    I got a lot of information from your video, so thanks again for posting it!

  • @makinggreatbread
    @makinggreatbread 4 роки тому

    good video

  • @MohanrajPeriasamy
    @MohanrajPeriasamy 12 років тому

    great video....

  • @sathyam34
    @sathyam34 11 років тому

    Excellent..!

  • @AliiSaamm
    @AliiSaamm 11 років тому

    Very helpful thanks

  • @killaurnext
    @killaurnext 11 років тому

    when he had function 1 & 2 = parallel tasks
    when it was just function 1 and explaining foreground and background thread...i guess it technically could be both threaded tasks and parallel tasks (I would go more with threaded tasks since you could argue that there is only one thread)

  • @saurabhtanwer2166
    @saurabhtanwer2166 Рік тому

    Thread means parallel execution? Is not it is time slicing or context switching

  • @anjaneya1badrinadh
    @anjaneya1badrinadh 5 років тому

    Hi Sir,
    Please make video on difference between Finalize vs Dispose in C#

  • @dnfvideo
    @dnfvideo  12 років тому

    Did i mix up ?

  • @animeshpatel619
    @animeshpatel619 6 років тому

    hello can you please upload video on multiple parallel http asynchronous programing using await when all

  • @ChetanChanneCSC
    @ChetanChanneCSC 10 років тому

    Good one

  • @bagwerohit
    @bagwerohit 11 років тому

    Nice one thanxxxxxxxxxxxxxxxxxxx

  • @ferrarikarthik1
    @ferrarikarthik1 11 років тому

    S...Because, Parallel code execution concept revolves around the execution of code in multiple processors....But in case of single processor MultiThreding concept(as demonstarted here), the processor executes for a specific time the code in function 1 and function 2. What this implies is that, the processor executes the code in f1 and then for f2. When it is executing f2, f1 is not executed.So, this is not parallel code execution.

  • @kannitra
    @kannitra 11 років тому

    great video thanks>........

  • @vaibhavlodha1178
    @vaibhavlodha1178 11 років тому

    awesome....

  • @bipulabu
    @bipulabu 8 років тому

    When you run 2 different threads - will they run parallely in the same core processor or will they run on two different processors ?

    • @dnfvideo
      @dnfvideo  8 років тому

      +bipulabu For technical query please mail us at questpond@questpond.com

  • @parsalotfy
    @parsalotfy 8 років тому

    I realize diferent beetwen foreground & Backgroung Threads completly...
    Thanks for your VERY helpful video !

  • @shaleenshuklass
    @shaleenshuklass 12 років тому

    so what is use of background thread

  • @Lazy-AI
    @Lazy-AI 9 років тому +1

    Hiee sir , in ur 1st example i've added IsBackground = true for both the function but Function1 and Function2 is still looping and executing after Main thread has ended. what m i doing wrong ?
    Thread obj1 = new Thread(Function1);
    Thread obj2 = new Thread(Function2);
    obj1.IsBackground = true;
    obj2.IsBackground = true;
    obj1.Start();
    obj2.Start();
    Console.WriteLine("Main application has ended");
    Console.ReadKey();

    • @maringeorgiev4456
      @maringeorgiev4456 9 років тому +1

      +Saurabh Main thread hasn't ended after displaying its message on the console. It waits for your next command Console.ReadKey(); Delete that, start the app with Ctrl + F5 evth should be fine

  • @rainvictorron2413
    @rainvictorron2413 5 років тому

    Sir,may i ask,how does threading differs with delegate chaining? Thank you in advance.

  • @ArunSingh-uh5kn
    @ArunSingh-uh5kn 7 років тому

    can you please describe the timing of thread sleep in this program. Means which function call's when after 4 sec as we see there are in function1 and function 2 calling sequence

  • @VINNUSAURUS
    @VINNUSAURUS 11 років тому

    can u explain when to use forground and background ?

    • @santoshKoolkarni
      @santoshKoolkarni 10 років тому

      Use background for tasks that don't involve any user interaction.

    • @santoshKoolkarni
      @santoshKoolkarni 10 років тому +2

      Also background threads abruptly end when all foreground threads end. So none of the cleanups will be performed including any cleanup in the finally block. So if any cleanup is important, use foreground thread or implement some way to cleanup the background before ending last foreground thread.

    • @VINNUSAURUS
      @VINNUSAURUS 10 років тому +1

      Santosh Kulkarni Nice :) Thank you :)

    • @srinivasan1482
      @srinivasan1482 10 років тому +1

      Santosh Kulkarni Really good explanation.

  • @daviddbeloved
    @daviddbeloved 12 років тому

    great. waoooh

  • @drsamsam1104
    @drsamsam1104 4 роки тому

    Does
    Any one have a example of STA threads managing com object with form
    And running other tasks on background threads

  • @shaleenshuklass
    @shaleenshuklass 12 років тому

    sir please tell me threadstart delegate

  • @OreoCokes
    @OreoCokes 11 років тому +1

    Great vid, its like taking lessons from Frank Sinatra :D in other words.... thanks.

  • @WoundedEgo
    @WoundedEgo 12 років тому

    Why? What is the difference?

  • @rutabuga
    @rutabuga 13 років тому +1

    you should not mix up the definition for threaded tasks and parallel tasks.

  • @muhammadadnanakmal9590
    @muhammadadnanakmal9590 10 років тому

    sir i've question if we don't call thread.sleep() method in both Function1 and Function2 Method then what will happen
    and its mandatory that we must call sleep() in threading

    • @MB26566
      @MB26566 7 років тому

      No it,s not mandatory if u want to stop your thread for some time then you can invoke thread.Sleep() method

  • @PE425
    @PE425 12 років тому +2

    "She sharp"??

  • @JDavidEfrain
    @JDavidEfrain 12 років тому

    Great another Hindu tutorial

  • @bike4aday
    @bike4aday 11 років тому +1

    in other words

  • @bogie5464
    @bogie5464 12 років тому

    Hindu is a religion... not a race. That's like saying "Great another Christian tutorial." He sounds Indian, but I could be wrong. Also he knows his shit that's clear, so I don't mind the accent. I'm not an ignorant American.

  • @alphandor
    @alphandor 12 років тому

    control F FIRE!

  • @saabslol
    @saabslol 12 років тому

    in other words!

  • @--Mr.Bombastic--
    @--Mr.Bombastic-- 4 роки тому

    add should. be stop..

  • @JDavidEfrain
    @JDavidEfrain 12 років тому

    Americans invented this shit dude

  • @Kanakis2016
    @Kanakis2016 Рік тому

    Qytgystsyysysghggyggyyytffhgĝhhuuyuyyyyyyyyyhhhu7ùĥ