Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [threads]

The tag has no usage guidance.

3
votes
1answer
31 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
57 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 ...
0
votes
0answers
14 views

Co-routines and Threads are same?

Everyone say both Threads and Co-routines are similar to each other. Actually what is difference between Co-routines and Threads? How they work in a program?
1
vote
1answer
39 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
18 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
0answers
11 views

Program behavior when running on user level threads vs on kernel threads?

With respect to load and store instructions, will a program behave differently when running on user-level threads vs when on kernel threads? If yes, how? The only difference I know is that on user-...
0
votes
1answer
32 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
16 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
22 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
37 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
21 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
77 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, ...
0
votes
0answers
21 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 - ...
0
votes
0answers
10 views

Concurrent server with preallocated Threads

Can we implement a mechanism described below with mutex and a condition variable? If yes, then what r the structures, code of the master and slave threads used in it? Mechanism -" Consider a ...
1
vote
2answers
44 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
104 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
19 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
75 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
1k 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
117 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
45 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 ...
1
vote
1answer
187 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
96 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
53 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 ...
0
votes
1answer
310 views

How can context switch affect the modification of a variable?

float myTotalAmount=0; void update(float amt){ myTotalAmount+= amt; } Task A call update(10); calculate `myTotalAmount+= ...
4
votes
1answer
97 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 ...
8
votes
2answers
772 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
48 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
225 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 ...
0
votes
1answer
648 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 ...
2
votes
0answers
115 views

many to many multithreading

In many to many multithreading model the processor threads are multiplexed to a lesser or equal number of kernel threads. What exactly does it mean?? Does it mean that if a kernel is executing a ...
1
vote
2answers
3k views

How does RAM is shared in multi core environment?

I learnt that multi core processors have more than one processing units( i.e. the main executing units ALU etc.) and they are better at performance. I want to know how they share Physical memory. I'll ...
5
votes
1answer
142 views

Can threads use resources from other processes?

This is how I see threads. Please do correct me if I'm wrong: A thread is a part of a process that runs a sequence of program code. There can be many threads within a process that run different ...
1
vote
2answers
99 views

What does it mean that a core supports 2 threads?

I understand that a process may have multiple threads, and that a processor may have multiple cores to run processes in parallel. But I can't understand how a core may allow multiple threads, what ...
4
votes
1answer
128 views

What techniques could be used to support thread-local contexts and resources in a language?

I am interested in the subject of thread-local contexts, which is a feature that I use quite often in solutions, but seems to lack first-class support in any languages I have used. Quite often in ...
7
votes
1answer
988 views

Why is quiescent consistency compositional, but sequential consistency is not

I'm having trouble in comparing these two memory consistency models. Essentially for sequential consistency I think of real code like this: ...
4
votes
1answer
1k views

Difference between IO threads and worker threads

I have read that NodeJs is able to support hundreds and thousand of concurrent calls because the worker threads do not wait on the IO calls to complete. They use event driven IO. Similarly in .NET we ...
0
votes
1answer
64 views

What is extra thread for idle time

Here http://tomstechnicalblog.blogspot.com/2016/02/rxjava-understanding-observeon-and.html I've found a sentence which I do not understand: If you have a quad-core, you can optimally support 5 ...
0
votes
1answer
68 views

Is it correct to say that CPU's only compute threads?

New to the world of parallel computation. Would it be correct to say that CPU's are actually thread calculators? My understanding currently: a ...
1
vote
1answer
2k views

User level threads are transparent to the kernel?

Find whether given statement True or False? Explain. User level threads are transparent to the kernel? My attempt : False. Since, user level threads are managed by a user level library however, ...
6
votes
2answers
538 views

Why are multi-threading programs more prone to errors?

Why are multi-threading programs more prone to errors than single threaded programs ? or why is multi-threading programming one of the areas where developers are (more) prone to errors? Is this in ...
2
votes
2answers
951 views

Why there must be a relationship between user threads and kernel threads?

The following is an excerpt from OS concepts by galvin.Here is the book. Multithreading Models Our discussion so far has treated threads in a generic sense. However, support for threads may ...
0
votes
1answer
47 views

How do threads decide when to 'go'? [closed]

I have written some code that animates two boxes using HTML5 and JavaScript threads. I set them up to move at a fixed rate, which is the same: ...
13
votes
3answers
30k views

What threads share in general?

Well this is general question. And if anyone want to make it implementation specific then I will prefer Unix related stuff. But first need to know following problems in generality: I read single ...
4
votes
1answer
117 views

Does a reentrant list for signal queue in a single-thread environment exist?

I need to handle Unix signals in a single-threaded application with the following goals: Signals doesn't mask on receive (thus, the signal handler must be reentrant). I am not allowed to lose signal ...
-2
votes
1answer
520 views

2-core 2.6GHz vs 4-core 1.3GHz [closed]

If a process could run as much cores as available, which CPU is faster, a 2-core 2.6GHz CPU or a 4-core 1.3GHz CPU?
2
votes
1answer
109 views

synchronization (test-and-set)

I have benn wondering about the following possibility: if I have multiple hardware threads on the same core, and then someone decides to use shared register to allow fast synchronization among threads ...
7
votes
2answers
704 views

Why can't fibers utilize multiple processors?

It seems that the distinction between fibers and threads is that fibers are cooperatively scheduled, whereas threads are preemptively scheduled. The point of the scheduler seems like a way to make an ...
4
votes
0answers
117 views

Mutex implementation on top of a preemptive scheduler that does not guarantee liveness

I'm implementing some synchronization primitives in the standard library of an operating system. Specifically, I want to implement mutexes and condition variables. This is on top of a microkernel with ...