As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [threads]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
28 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 ...
Niraj Jain's user avatar
3 votes
2 answers
90 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. ...
pitosalas's user avatar
  • 133
0 votes
3 answers
132 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 ...
LinkedLists101's user avatar
0 votes
0 answers
18 views

How is CPU timesharing working when I launch nested tasks

I launch 3 tasks, each of them using 4 threads. Those 3 tasks each launch a single subtask using 6 threads, each. Both the upper level 3 tasks and 3 subtasks are resource-heavy. And I have a 6 core, ...
ivan866's user avatar
  • 111
1 vote
0 answers
26 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 &...
Bender's user avatar
  • 347
2 votes
1 answer
55 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 ...
James's user avatar
  • 21
1 vote
2 answers
238 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 ...
OneRaynyDay's user avatar
0 votes
1 answer
49 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 ...
ccleve's user avatar
  • 129
1 vote
1 answer
160 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 ...
Adam Lee's user avatar
  • 213
0 votes
1 answer
74 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 ...
osama.bmaq's user avatar
0 votes
1 answer
49 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 ...
ivan866's user avatar
  • 111
0 votes
2 answers
102 views

What are the examples of multi-threading in a web server?

So I’ve been reading about multi-threading these past few days. Can you give me a real life example where the multi-threading might be used in a REST API web server?
Axel's user avatar
  • 101
1 vote
3 answers
155 views

concurrency vs parallelism

I am so confused between concurrency vs parallelism in multi-core processors. If a concurrent process has many threads and if the processor is multi-core then can each thread run on multiple cores? If ...
Rohit's user avatar
  • 11
0 votes
2 answers
705 views

concurrency in multiple core

I know the basic definition between parallelism and concurrency. But there is not much information about concurrency in multiple core. what is the difference between concurrency in single-core vs ...
Rohit's user avatar
  • 11
0 votes
1 answer
43 views

Running an application that needs 6 threads on dual core processor

If a dual core processor have 4 threads, then what will happen if i run an application which uses more than 4 threads? And just to make sure i'm understanding what are threads in a cpu, when an ...
rayanJ's user avatar
  • 1
0 votes
1 answer
181 views

Analyzing parallel performance question

I was reviewing for my CS class and came across this question and answer combo that didn't have any explanation why it was correct. I'm confused on how they got the answer: We have a system to which ...
Melanie's user avatar
  • 103
0 votes
2 answers
135 views

How could i create a multi-threading system in a kernel?

Im trying to figure out if there's an assembler instructions or a bios intruction to get multi-threading in a kernel. In the case that doesn't exist that, how could i set muti-threading in a kernel?
UserGuestIneedyourhelpguys2631's user avatar
1 vote
1 answer
265 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....
Midhunraj R Pillai's user avatar
5 votes
2 answers
801 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. ...
Frank's user avatar
  • 323
0 votes
1 answer
77 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 ...
Turing101's user avatar
  • 1,180
1 vote
2 answers
100 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" ? ...
HadiRj's user avatar
  • 113
0 votes
1 answer
447 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 ...
Dani's user avatar
  • 131
2 votes
1 answer
1k 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, ...
Ski Mask's user avatar
  • 453
1 vote
0 answers
29 views

Race Condition in Mesa Monitor

...
zeitgeist's user avatar
  • 111
1 vote
1 answer
104 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
Lix's user avatar
  • 115
0 votes
1 answer
125 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?
Franc's user avatar
  • 103
0 votes
0 answers
14 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 ...
SomePerson's user avatar
4 votes
2 answers
484 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 ...
Tura's user avatar
  • 143
2 votes
1 answer
48 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 ...
Vishwa Mithra Tatta's user avatar
0 votes
0 answers
176 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-...
jungleMan's user avatar
  • 101
-2 votes
1 answer
61 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, ...
Joshua's user avatar
  • 382
2 votes
0 answers
33 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. ...
kevinyu's user avatar
  • 121
1 vote
0 answers
26 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 ...
James's user avatar
  • 11
0 votes
1 answer
21 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: ...
protoneight's user avatar
0 votes
1 answer
43 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 ...
Angelixus's user avatar
3 votes
1 answer
1k 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 ...
Abhilash Mishra's user avatar
0 votes
2 answers
570 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 ...
Curious's user avatar
1 vote
1 answer
2k 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 ...
Kindred's user avatar
  • 314
1 vote
0 answers
159 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 ...
Duncan's user avatar
  • 11
0 votes
1 answer
59 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??
Vajira Prabuddhaka's user avatar
1 vote
0 answers
31 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 ...
Paul's user avatar
  • 11
1 vote
0 answers
30 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 ...
narendraj9's user avatar
0 votes
1 answer
61 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 ...
Cobie Fisher's user avatar
0 votes
1 answer
185 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 ...
Cobie Fisher's user avatar
1 vote
0 answers
64 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 . ...
unnamed's user avatar
  • 65
3 votes
1 answer
206 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, ...
John P's user avatar
  • 740
1 vote
1 answer
468 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 - ...
akisonlyforu's user avatar
1 vote
2 answers
694 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 ...
Peeyush Singh's user avatar
1 vote
1 answer
165 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 ...
w00d's user avatar
  • 291
1 vote
1 answer
26 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 ...
user1527469's user avatar