3

Possible Duplicate:
Difference between BackgroundWorker and Thread?

I was asked this question in an interview . what should be answer for this ?

Community
  • 1
  • 1
jc tronics
  • 97
  • 1
  • 1
  • 5
  • It may be the similar question please have a look on it http://stackoverflow.com/questions/1506838/backgroundworker-vs-background-thread – Mujassir Nasir Sep 06 '12 at 21:09
  • Another similar question http://stackoverflow.com/questions/4757159/difference-between-backgroundworker-and-thread – Mujassir Nasir Sep 06 '12 at 21:11
  • 1
    @MujassirNasir, the specific answer from the first post is [Matt Davis'](http://stackoverflow.com/a/1507337/1258147). – kurtzbot Sep 06 '12 at 21:13

4 Answers4

1

The word "background" implies that it performs less critical tasks than non-background threads and it doesn't matter some much when they complete. In Java this can mean using a daemon thread.

Technically they are the same thing and the different is subjective.

Peter Lawrey
  • 525,659
  • 79
  • 751
  • 1,130
  • 2
    I would no create tough relationship between words "background" and "not critical". This can be not true. – Tigran Sep 06 '12 at 21:11
1

Backgroundworker threads are most often used when you have a need to perform a long operation in the background and interact with the UI from the thread. Backgroundworker has some features that allow it to interact with the UI much easier.

Stan R.
  • 15,757
  • 4
  • 50
  • 58
0

Neither the "worker" nor "background" threads are the main/UI threads.

Unless you have more details (for example, in the context of Language X or Framework Y), there's no distinct difference between them. But, as I consider them:

  • A worker thread sounds like it might belong to a pool of workers. In which case, it might be re-used after completing a task (and will only be stopped when the worker pool is terminated).
  • A background thread sounds like it was asynchronously invoked to accomplish a single task. Possibly to save the UI thread from blocking.
EthanB
  • 4,239
  • 1
  • 28
  • 46
  • this looks to me as the perfect answer. when i told the recruiter about backgroundworker , he said he did not mention backgroundworker!! – jc tronics Sep 06 '12 at 21:29
0

BackgroundWorker is a System.ComponentModel class that lets you execute a method on a separate Threadpool thread. Joe Albahari has a good writeup on it.

A worker thread is a generic term for threads spawned from your main thread that typically do work in parallel to the UI.

Ed Power
  • 8,310
  • 3
  • 36
  • 42