Multi-threading suggest parallel execution of multiple threads, which causes new class of difficultires comparing to single-thread programming.
To know multithreadings means knowing commong pitfalls and methods of coding around them. Usually these includes next terms:
* dead-lock
* live-lock
* synchronization
* race condition
* atomicity
* re-entrancy
* synchronization primitives
* memory barriers
A thread is the entity within a process that can be scheduled for execution. All threads of a process share its virtual address space and system resources. Each process is started with a single thread, but can create additional threads from any of its threads.
What is the main principle of dead-lock prevention?
{
"id": "FjKjxtq0JmZgKzARplUR9hci",
"question": "What is the main principle of dead-lock prevention?",
"answers": [
"Always lock objects in the same order",
"It is not possible to guarantee absense of dead-locks",
"Always lock on no more than 1 object",
"Use lock-free algorithms"
],
"correctAnswers": [
"Always lock objects in the same order"
],
"incorrectAnswers": [
"Always lock on no more than 1 object",
"Use lock-free algorithms",
"It is not possible to guarantee absense of dead-locks"
],
"allowCustomAnswer": false,
"canEdit": false,
"allowFileAnswer": false,
"multi": false,
"explanation": "",
"canLike": false,
"likes": 0,
"allAnswers": [
{
"text": "Use lock-free algorithms",
"correct": false,
"selected": false
},
{
"text": "It is not possible to guarantee absense of dead-locks",
"correct": false,
"selected": false
},
{
"text": "Always lock on no more than 1 object",
"correct": false,
"selected": false
},
{
"text": "Always lock objects in the same order",
"correct": true,
"selected": false
}
]
}
0♡
Q:
How many threads can process have on CPU with 12 threads?
{
"id": "O31gXoj7IcBrIe6Lx2BTR8Zc",
"question": "How many threads can process have on CPU with 12 threads?",
"answers": [
"12 or 24 threads (if hyperthreading is on)",
"65536 threads (64k) per CPU",
"Any number - OS threads do not depend on CPU threads"
],
"correctAnswers": [
"Any number - OS threads do not depend on CPU threads"
],
"incorrectAnswers": [
"12 or 24 threads (if hyperthreading is on)",
"65536 threads (64k) per CPU"
],
"allowCustomAnswer": false,
"canEdit": false,
"allowFileAnswer": false,
"multi": false,
"explanation": "",
"canLike": false,
"likes": 0,
"allAnswers": [
{
"text": "Any number - OS threads do not depend on CPU threads",
"correct": true,
"selected": false
},
{
"text": "12 or 24 threads (if hyperthreading is on)",
"correct": false,
"selected": false
},
{
"text": "65536 threads (64k) per CPU",
"correct": false,
"selected": false
}
]
}
Add question
Do you know that ...?
0♡- It is possible to start thread in other process
E.g. via CreateRemoteThread Win API
0♡- Windows supports three levels of granularity of executable units