1/8
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Do concurrency threads interact with each other?
They may interact with each other however they have an implied relationship between them
Why are threads preferred over processes for concurrency?
Because threads share the same memory space, making it easier to access shared variables
What does the synchronized
keyword prevent in concurrency
It helps prevent race conditions and memory inconsistency errors by ensuring mutual exclusion
Thread A holds Resource 1 and waits for Resource 2, while Thread B holds Resource 2 and waits for Resource 1 - What is this deadlock example called?
Circular wait
How can race conditions cause data corruption?
If multiple threads modify the same resource at a time values can get overwritten
How can race conditions lead to system instability?
Can cause a program to crash or behave unpredictably
How do you prevent memory consistency errors?
By using the synchronised keyword or marking shared variables as volatile
How does the OS schedule threads?
It schedules threads independently causing some to operate on outdated data
What is mutual exclusion?
When one thread can only access a shared resource at a time