You are not logged in. Your edit will be placed in a queue until it is peer reviewed.
We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.
-
I don't know if you looked around Stack Exchange much, but here's a similar question, with a few answers but none marked as the accepted answer, and at least one warning about tough bugs and advising to just use coarse locking: stackoverflow.com/q/4320337/618649Craig Tullis– Craig Tullis2015-06-03 23:50:27 +00:00Commented Jun 3, 2015 at 23:50
-
It has lots of non-solutions that's for sure. Just like the first answere here will deadlock within seconds. Google was also quite unhelpfull since most cases deal with threads and not cores and try to solve the problem that one thread gets preempted before finishing its operation.Goswin von Brederlow– Goswin von Brederlow2015-06-04 00:17:27 +00:00Commented Jun 4, 2015 at 0:17
-
Well...each core is still effectively executing a thread even if this is your own custom kernel that only spins up as many threads as you have CPU cores (or call them processes or executors or whipsits or whatever you want to call them). Point being that they're all still contending over a shared resource (RAM) and you have to coordinate access or you end up in deadlock, or with hopelessly corrupted data structures. So it's not so different from threads. That threads are pre-emptible by a scheduler just means you have even more opportunities for conflicts, because more threads. ;-)Craig Tullis– Craig Tullis2015-06-04 00:47:46 +00:00Commented Jun 4, 2015 at 0:47
-
@Craig (sorry to revive a dead horse) The difference between user space threads and the kernel running things on multiple cores is that the kernel controls the task switching. As said the code will never preempted in the middle, which totally changes the playing field. You have to coordinate access but the best way to coordinate differs. How they differ is part of the question.Goswin von Brederlow– Goswin von Brederlow2020-02-26 16:04:57 +00:00Commented Feb 26, 2020 at 16:04
Add a comment
|
How to Edit
- Correct minor typos or mistakes
- Clarify meaning without changing it
- Add related resources or links
- Always respect the author’s intent
- Don’t use edits to reply to the author
How to Format
-
create code fences with backticks ` or tildes ~
```
like so
``` -
add language identifier to highlight code
```python
def function(foo):
print(foo)
``` - put returns between paragraphs
- for linebreak add 2 spaces at end
- _italic_ or **bold**
- indent code by 4 spaces
- backtick escapes
`like _so_` - quote by placing > at start of line
- to make links (use https whenever possible)
<https://example.com>[example](https://example.com)<a href="https://example.com">example</a>
How to Tag
A tag is a keyword or label that categorizes your question with other, similar questions. Choose one or more (up to 5) tags that will help answerers to find and interpret your question.
- complete the sentence: my question is about...
- use tags that describe things or concepts that are essential, not incidental to your question
- favor using existing popular tags
- read the descriptions that appear below the tag
If your question is primarily about a topic for which you can't find a tag:
- combine multiple words into single-words with hyphens (e.g. design-patterns), up to a maximum of 35 characters
- creating new tags is a privilege; if you can't yet create a tag you need, then post this question without it, then ask the community to create it for you