Comments (4)
Task.Factory.StartNew(body, TaskCreationOptions.LongRunning)
starts a new thread because of LongRunning
option.
Here we create threads:
for (int i = 0; i < workers.Length; i++)
{
workers[i] = Task.Factory.StartNew(body, TaskCreationOptions.LongRunning);
}
stop_time = sw.ElapsedMilliseconds + time;
And here execution starts in all workers (which are all waiting for this event):
e.Set();
The latency of an event is orders of magnitude faster than duration of one benchmark (3sec.), so
when a benchmark needs a particular degree of concurrency the above guarantees it quite reliably.
I do not think we have a problem here.
======= relevant code here:
NonBlocking/BenchmarksCore/Program.cs
Line 391 in 6c9824f
from nonblocking.
For the tests - by default they run continuously and could be left running for hours.
While thread pool does not guarantee a particular concurrency mode, it appears to expose tests to all kind of random combinations (sequential or concurrent) and in practice catches problems really well.
from nonblocking.
Regarding LongRunning
, I don't think the behavior of creating a new, separate thread is guaranteed:
LongRunning: Specifies that a task will be a long-running, coarse-grained operation involving fewer, larger components than fine-grained systems. It provides a hint to the TaskScheduler that oversubscription may be warranted. Oversubscription lets you create more threads than the available number of hardware threads. It also provides a hint to the task scheduler that an additional thread might be required for the task so that it does not block the forward progress of other threads or work items on the local thread-pool queue. [src]
from nonblocking.
Tasks appear to work as expected. I do not think we have a problem here.
from nonblocking.
Related Issues (10)
- CoreCLR Friendly? HOT 1
- Does it allocate for each indexing operation? HOT 1
- Consider specialcasing struct keys that fit into int/long/nint HOT 5
- High clustering of hash function HOT 9
- Consecutive hashes create conflicts
- Make and publish a nuget for this thing. HOT 1
- Performance comparison HOT 1
- Many compile error HOT 2
- Performance of your solution HOT 15
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nonblocking.