Questions tagged [threads]
The threads tag has no usage guidance.
95
questions
0
votes
1answer
21 views
OS: Are User-level threads and software threads (and also kernel-level threads and hardware threads) the same?
I am referencing the Book Fundamentals of Computer Algorithms" by Ellis Horowitz et al.
At the part which they talk about multi-threading models, user-level and kernel-level thread are introduced....
0
votes
0answers
23 views
How the task is divided between multiple cores to perform in multiprocessing systems?
I am trying to find how single task is divided between two cores? what are the methods makes them work at the same time without interfering with each other?
0
votes
0answers
13 views
Python 3 multiprocessing stacktrace CUDA failure?
I am working on a data processing script and trying to use multiprocessing so that it runs faster. Whenever I run the python script, I get the following error:
2020-12-24 18:30:22.679414457 [E:...
0
votes
0answers
9 views
How to enforce synchronization with two semaphores
Assume I have 4 threads, A B C D respectively.
A finishes before B starts.
B finishes before C or D start.
How should I initial values and synchronize threads with 2 semaphores?
5
votes
2answers
102 views
Why do OS locks require hardware support?
I just read the chapter on locks in the book Operating Systems: Three Easy Pieces, and it discusses an implementation of locks (see in Figure 28.9) that involves a test-and-set hardware instruction.
...
1
vote
1answer
34 views
Why is it not a good idea to branch a thread outside of a parallel region while other threads are still executing?
Say I have $n$ threads executing in a parallel region and one of them leaves the parallel region when others are still continuing to execute in the parallel region. Why this is a $BAD$ idea? For ...
2
votes
2answers
62 views
Can User Level Thread read/write Kernel thread?
As far as I read in a OS text book (Operating Systems by Silberschatz) Kernel mode is for privileged task, so it it true to claim that "User Level Thread can read/write Kernel threads" ?
...
0
votes
1answer
43 views
Does every thread have its main function?
Does every thread have its own main function?
I know that its have its own stack, but what about main function (not necessarily a function which called main).
For example, when creating a thread, we ...
1
vote
0answers
118 views
What are the differences between Earliest Deadline First (EDF) and Earliest Due Date (EDD)?
From my understanding, the EDF (Earliest Deadline First) rule is essentially an iterative "version" of the EDD (Earliest Due Date) rule, which allows for preemption. At every point in time, ...
1
vote
0answers
25 views
0
votes
1answer
17 views
How to trigger a thread to start working using semaphore?
How to trigger a thread to start working using semaphore?
I have find a lot of explanation about thread and semaphore but i still don't understand, any help please
0
votes
1answer
39 views
Thread - contention vs race
The terms contention and race are used interchangeably when it comes to thread's state(at critical section). Are they same?
0
votes
0answers
11 views
parallelized data structure
I'm searching a data structure that supports O(1) concurrent insertions (thread number is known in advance) and iteration over its elements (insertion order doesn't need to be preserved).
While one ...
0
votes
0answers
20 views
Preemptive priority scheduling problem with same priority
So if T1(priority 3, arrived first) was preempted it is put back to the runqueue. If there is already T4(priority 3, arrived fourth) inside the runqueue, which one of these two will be handled first?! ...
3
votes
2answers
156 views
Why the most dominant programming languages didn't follow CSP thread model?
I was trying to ask this question in StackOverflow, but later realized that this question is more relevant to general computer science, not specific engineering problems. If you think it's not, please ...
2
votes
1answer
36 views
How does a dual core microprocessors run so many programs?
I have a laptop with Intel dual core and it runs, the OS windows, and many application from Opera, age of empires, word, excel etc open at once just fine. If it only has 2 cores, how can so many ...
0
votes
0answers
47 views
Can many threads run in a parallel in many-to-one model?
The book I am reading suggests that in a many-to-one multi-threading model, the threads are unable to run in parallel in a multi-core system.
I am thinking this is not the case because if we have many-...
-2
votes
1answer
48 views
Does this lock have a name (related to reader-writer lock)
The object can be locked two different ways, where if the lock is entered the same way a second time, the lock is recursive, but if it's entered the other way, it blocks. Like a reader-writer lock, ...
2
votes
0answers
29 views
What does it mean by “consistent view of memory” in lock-free dequeue implementation?
I am currently reading this paper by Chales-Lev. This paper explain an implementation of work-stealing dequeue. The part where I don't understand is in the implementation of steal operation.
...
1
vote
0answers
23 views
Parallel Thread Processing Variable Question
if there is a better stack exchange suited for this question please inform me.
say you have a thread that is constantly checking the state of a variable in 2 ms intervals
...
0
votes
1answer
18 views
multithreading - duration of jobs
" How long will it take for 2 jobs to complete if they're running in parallel, knowing that both have a total of 20 minutes of CPU usage time and 50% IO"
I calculated the CPU usage: ...
0
votes
1answer
37 views
Threads and Operating System
In a computer, the processor executes different threads and changes between them, the operating system is a program at the end that it´s being executed by the processor, there exists the posibility ...
3
votes
1answer
342 views
What should be the minimum value when the two threads are executed concurrently
int count=0;
void *thfunc()
{
int ctr=0;
for(ctr=0;ctr<100;ctr++)
count++;
}
If *thfunc() is executed by two threads concurrently in a uniprocessor ...
0
votes
2answers
213 views
Why are threads called the unit of dispatch?
Threads called the "unit of dispatch" but what does that mean? I was looking over the web and two operating systems books but I can't find the answer. It seems that processes are defined by two ...
1
vote
1answer
1k views
About hardware multithreading
I'm reading Multithreading (computer architecture) - Wiki, aka hardware threading, and I'm trying to understand the second paragraph:
(p2): Where multiprocessing systems include multiple complete ...
1
vote
0answers
88 views
How is switching among user-level threads realised in the user space?
This is with respect to user-level threads where the kernel only knows about the process as a whole, and threads are created and maintained in the user space. Each thread has its PC, registers, stack ...
0
votes
1answer
57 views
Reason for thread pooling
Can someone explain what is the reason for thread-pooling in Linux, even if the threads are light to create and destroy??
1
vote
0answers
30 views
Definition of PrefixSum function
I came across this paper and attempting to go through the implementation of randomized selection algorithm on page 8.
Step 1 of the algorithm suggest to compute $s = PrefixSum(n_i, p)$. Where $p$ is ...
1
vote
0answers
23 views
User-level threads and information available to the kernel
User-level threads are transparent to the kernel. How is htop able to show user-level threads running on my system? I know that those threads are user-level threads ...
0
votes
1answer
43 views
Can Multiprocessor Systems Implement Both Temporal Multithreading and Simultaneous Multithreading?
I am aware that multiprocessor systems often implement simultaneous multithreading in order to allow multiple threads to run on different CPUs. I am also aware that uni-core systems often implement ...
0
votes
1answer
91 views
What is the Difference Between Many-to-Many (M:M) Threading and Hybrid (M:N) Threading?
I have been researching threading and come across several websites which all say contradicting statements about which and how many thread models exist. Some websites say there are only three: 1:1, M:1 ...
1
vote
0answers
41 views
semaphore for two groups of processes
Can someone help me giving a pseudo code to this problem : There are two groups of processes , A and B. Maximum 3 Processes from group A or group B(only from one group) can use the given resource . ...
3
votes
1answer
132 views
What is the benefit of using one to one thread mapping model instead of Many to Many or two level?
So in the silberschatz O.S book it says Windows uses one to one model (mapping user level threads to kernel level threads)
but why? i thought many to many and two level models are much better, ...
1
vote
1answer
96 views
Why is there no one to many Multithreading Model?
I am studying various multi-threading models. Here the user threads are mapped to Kernel Threads. They are -
...
1
vote
2answers
164 views
What is the difference between a page and thread?
"Each process that is executed is divided into blocks of same size, called pages."
"Thread is a part of process being executed."
Are pages and threads both part(s) of process? Whats the difference ...
1
vote
1answer
149 views
Work-stealing: where and how many to steal
If one ignores the conflicts when accessing the dequeue in Work-Stealing algorithms, does it matter (and in what ways) if one steals from the top or bottom (or anywhere randomly) of the dequeue? Does ...
1
vote
1answer
23 views
Need to understand signals received vs sent
What is meant by in the following statement (from the paper titled "Implementing Lightweight Threads"):
As in singlethreaded processes, the number of signals received by the
process is less than ...
0
votes
1answer
191 views
Hardware thread context and register renaming
I'm having some issues understanding what happens on a context switch with the physical register file in an out-of-order CPU that implements context switching. Suppose that a CPU consists of 4 ...
1
vote
1answer
4k views
What is “time-slice multi-threading”?
My goal is to understand the exact differences between SoEMT, SMT and "time-slice multi threading".
Thus far I already found information on SoEMT and SMT and it does not seem to hard to find more on ...
1
vote
1answer
166 views
Multi-threading : N cores = N times one core?
This question is about modern CPU architectures and multi-threading. I'm mainly interested in personal computers or servers having 2, 4, 8, 16... cores like for example an Intel core i7. I mean not a ...
1
vote
0answers
54 views
Is a single starved process considered deadlocked?
In regard to the critical section problem, an algorithm that switches between allowing one of two processes, P1 or P2, to complete their critical section would cause starvation for P1 if P2 stayed in ...
2
votes
1answer
482 views
Understanding google's user level threads in kernel threads
I came across Paul Turner work on increasing efficiency of M:N threading model. I am not able to grasp the concept at slide 18 of LPC-User-Threading
It says : for two threads ...
0
votes
0answers
155 views
Algorithm to construct timeline graph with arrival and departure times
So I am trying to construct a timeline graph for threads interacting with synchronization functions e.g. pthread_mutex_lock.
I have the following information:
1- ...
0
votes
1answer
90 views
What do `i` and `Number` represent in the Bakery Algorithm?
I am studying the bakery algorithm, and I am unsure of what the variable i represents in it. I understand that Entering ...
1
vote
1answer
589 views
How can context switch affect the modification of a variable?
float myTotalAmount=0;
void update(float amt){
myTotalAmount+= amt;
}
Task A called update(10);
Calculated ...
5
votes
1answer
114 views
Is there a generic word for “thread or process”?
I'm writing about a problem that could be caused by race conditions between multiple threads, or OS-level processes on the same machine or different machines, or VM-level processes like the Erlang VM ...
11
votes
3answers
3k views
Why are most mutex implementations unfair?
My understanding is that most popular implementations of a mutex (e.g. std::mutex in C++) do not guarantee fairness -- that is, they do not guarantee that in instances of contention, the lock will be ...
3
votes
1answer
52 views
One rational interval function and one irrational, will they ever collide?
This question may be a little mathy or hardware-y, so I may have to ask elsewhere.
I've recently learned that if a is a positive rational number and b is a positive irrational number, there exists no ...
1
vote
0answers
429 views
Do user level threads take advantage of multi processing?
I asked this question here on stackoverflow, but maybe because of off-topic over there, it didn't received proper response.
Does user level threads take advantage of multiprocessing ? I read one such ...
1
vote
1answer
1k views
thread scheduling in multi core architecture
In multi core architecture, let us say we have M cores and N threads (N > M) and a process once assigned to a core can't migrate to another core's ready queue. We have to design scheduling policy to ...