As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
When should I use async/await and when should I use parallel.foreach in C#? Are parallel and async/await serve the same purpose?
What are the differences in them?
async/await is about asynchrony, whereas Parallel.ForEach is about parallelism. They're related concepts, but not the same.
Parallel.ForEach is used when you want to execute the same operation on all the items in a collection, in parallel, blocking the current thread until all operations have completed.
async/await is used when the current operation can't make any more progress until a particular asynchronous operation has completed, but you don't want to block the current thread. This is particularly useful in two situations:
Writing code which basically kicks off various asynchronous operations, one after the other, on the UI thread, accessing the UI briefly between operations. (It's more general than that, but that's a simple example.) You don't want to block the UI thread, but managing all of those asynchronous operations is a pain otherwise.
Handling lots of long-running operations at a time - e.g. in a web server. Each individual request may take a long time due to calling into other web service, databases etc - but you don't want to have one thread per request, as threads are a relatively expensive resource.
You can combine parallelism and asynchrony by kicking off a new task which will call Parallel.ForEach, and then awaiting that task. (Just as one example.)
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I want to compare the following software design processes.
Waterfall model
V-Model
Unified Process
The V-Model has test phases for each specification phase, the waterfall model doesn't.
The Unified Process is iterative and incremental, the others aren't.
Are those the main differences? Is there something to add?
I only need the main differences, not too detailed.
The water fall model is not iterative.
V-Model is iterative in the sense that
a. It uses unit testing to verify procedural design
b. It uses integration testing to verify architectural (system) design
c. It uses acceptance testing to validate the requirements
d. If problems are found during verification and validation, the left side of the V can be re-executed before testing on the right side is re-enacted
Unified Process Model is iterative
a. System delivered in pieces.
b. Allows production system and development system to run in parallel.
c. Reduces risk and uncertainty in the development
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Neural networks are usually characterized by a huge amount of data and necessity to use parallel computing. Does it make functional languages more suitable for building neural networks?
Not really. Functional languages usually make parallelization trivial if you stick to immutability (or more precisely avoid any kind of uncontrolled side effects). If you do not, then it's not really easier to make things parallel then in non functional languages.
In this case you have two options:
use side effects, but in a localized fashion, so parallel threads have no business with each other: e.g. you evaluate a lot of NN-s, each of them can happen on it's own thread (using a thread pool with not much more threads than the number of CPU cores is a good idea).
for non localized side effects you need to rely on synchronization or some other ways to control it. One such example is the computation model of actors (quite popular in functional language users, but also available for java, see http://akka.io/) which usually let you have your side effects within your actor, but the interaction of the actors has its strict rules. This will free you from the business of low level thread handling.
Another thing that you should consider is that it's not too difficult to have a moderately performant NN implementation, it's also not very complicated to have a purely functional one, but doing both at the same time can be a challenging task. So - unless you are experienced with functional languages - I think it's easier to write a parallelized NN in a non functional language, or at least in a non pure way.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Now a days, there is only one buzz that goes on...Big Data..Curious to know what it is ..Though I have gleaned some information from Big Data but want to know more.
Thanks
The difference between a database for a coffee shop, and for facebook. It's easy to get something to work with 200 users. But when you have 200,000 users... that's a different story.
Table scans become impossible. Indexes become very important.
Single servers cannot handle all the load. Solutions such as clustering are employed to make it so more than one server can host an application. This makes it so you can keep adding more servers to the cluster each time the load gets too big and performance starts to die.
You'll hear a lot about NoSQL databases too such as MongoDB. This is where the database just stores key/value documents. Such databases are more suited for massive scaling (by sharding) than are relational database systems.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
We are going to develope one web application using Asp.Net which can have millions of data to handle
so i am confuse between database selection
which should i prefer sql server or oracle with respect to performance and all criteria
please guide me on this
thanks
Your question is looks subjective, how ever I like to answer and say that:
If some one gives you to drive a formula one, in how many seconds you gong to crash it? Probably you do not even manage to start it running.
The same think is on programming. Both programs are like formula one, maybe one have some feature and the other have some other, but they can run so fast if "you can drive them" like that.
Now it's up to you to make a good design to the database and make it real fast, or very slow and huge. It's not the machine, it you that you can make it run fast. It's not the formula one on the races, it’s the pilot (and the rest team) that they drive them so fast.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Given Meteor's support for eventually-consistent offline writes to data objects, automatically merging concurrent edits to the same text field seems like a natural next step. This might be done by integrating some of all of an operational transformation library (list) such as ShareJS.
Is there a desire in the Meteor team to support this functionality in the core product at some point, or would it more likely appear as a third-party add-on module?
Also, since ShareJS actually seems to provide the basic functionality of the Meteor data architecture (they mention in their documentation that it works with arbitrary JSON objects), would it perhaps be possible to do something like Meteor using ShareJS for data syncronization?
I'm guessing it might be something they might add or could be done with packages.
In the meantime however:
You could use Meteor.methods to expose an api to communicate to the same field back and forth.
The method could do a diff on the change and merge it to the Collection before returning what should be changed on the clients computer.