Questions tagged [threads]
The threads tag has no summary.
112 questions
0
votes
0
answers
77
views
How do threads aid in execution of a program?
Firstly this is not a question about programming. A book I am reading on C programming explains briefly the steps of execution of a C program after its compilation. It states the following,
To be ...
0
votes
1
answer
72
views
Thread safety due to no runtime allocation of memory, why?
I was watching a presentation related to the MuJoCo simulator (and other topics which were more relevant for the presentation itself) and at one moment in the presentation it is mentioned that MuJoCo ...
2
votes
2
answers
579
views
Would it be possible to run destructors when aborting a thread?
I had a discussion with a C++ developer on whether aborting a thread causes memory leaks. His opinion on how aborting a thread works was
all destructors of the stack objects of the thread to abort ...
0
votes
1
answer
177
views
How to find optimum number of cpu cores for a workload
Following bar graph shows maximum percentage cpu utilization of F16sv2 (16vcpu &32GB) azure virtual machine in last 30 days. Only sometimes CPU usage goes more than 60 percentage.
How to find the ...
0
votes
1
answer
1k
views
Two-Level Threading Model
In multithreading models, we have a two-level model in which we multiplexes many user-level threads to a smaller or equal number of kernel threads but also allows a user-level thread to be bound to a ...
0
votes
1
answer
199
views
Threads and its priority in Java
I was experimenting with the concept of threading in java, we have a method setPriority, using which we can set thread priority. In official documentation it is given as below,
But while seeing in ...
3
votes
2
answers
479
views
Race condition, my doubt on Peterson's algorithm vs. C
I have seen this C code showing an implentation of Peterson's Critical Section algorithm. It is obviously skeletal and hardwired for two threads but the logic is supposed to be correct in detail.
...
0
votes
3
answers
938
views
What is the minimum and maximum value of Counter when the two threads are executed concurrently?
I'm studying for an exam and have run into a problem that I do not understand. The main program starts two threads that execute the following program concurrently, whenever both threads terminate the ...
1
vote
0
answers
58
views
Thread wait state due to a cache miss
I know that a thread in a "running" state is put in a "wait" state if the thread itself needs I/O operation. Now I'm asking if even a cache miss implies that a thread is put in a &...
2
votes
1
answer
95
views
Are there any operating systems that utilize only user threads?
We're going over threading models in my freshman CS class. Are there any examples of operating systems that use exclusively user threads (N:1)? It looks like 1:1 is far and away the most common model ...
2
votes
2
answers
1k
views
Why does python's threading library use OS level threads when it can't achieve parallelism?
I was surprised to hear that the threading module from python uses OS level threads. From what I know, OS level threads are more expensive (but can achieve parallelism) meanwhile green threads are ...
0
votes
1
answer
171
views
Reader / writer locking algorithm
I'm pretty sure there's a textbook solution to this problem, but I haven't figured it out.
I have fixed-size blocks of data arranged in a sequence: block 0, block 1, etc.. There are reader threads ...
1
vote
1
answer
612
views
Deadlocks: Why if 2 threads are waiting for a lock from each other results in a deadlock?
I am confused as to why 2 threads waiting for a lock from each other will result in a deadlock. Let's say I have a Thread 1 that needs to execute contents in Lock 1 and then Lock 2 and a Thread 2 that ...
0
votes
1
answer
176
views
What is the need for Kernel threads?
I'm a bit confused about kernel-threads, I searched a lot at the Internet, SOF and here but found very diverse and conflict answers. What is the need for Kernel threads? Are they threads that are only ...
0
votes
1
answer
135
views
Which overhead is smaller - function call or passing variables between processes?
the question is related to networking frameworks; callback-based approach requires you to call a callback function every time you receive a new data packet; this is not a good approach for high-load ...