Hot answers tagged

13 votes
Accepted

Why is quiescent consistency compositional, but sequential consistency is not

Sorry for the late reply, but I've just found the question (questions, indeed). I am studying concurrency as well and I'll try to share some ideas with you. First, let's start with sequential ...
Shadow Template's user avatar
7 votes
Accepted

Why are most mutex implementations unfair?

Jim Sawyer's answer points to one answer: When you have threads with differing priorities, "fair" behaviour would be incorrect. When you have multiple threads which could run, the highest priority ...
Pseudonym's user avatar
  • 22k
6 votes
Accepted

User level threads are transparent to the kernel?

As, the linked answers and the explanations provided by your textbooks describe that, user level threads are transparent to the kernel, yes they are indeed. Kernel Level threads are not transparent ...
azam's user avatar
  • 429
6 votes

Is there a generic word for "thread or process"?

A process is a context with one or more threads of execution (concurrent with other threads of execution, either in the same process, or perhaps in other processes), and with its own address space (...
Greg A. Woods's user avatar
5 votes
Accepted

Multi-threading : N cores = N times one core?

If I understood your question correctly, you are essentially asking: Given a piece of sequential code, if we run N instances of it in parallel on N cores (on real, modern, typical, and not-...
Omar's user avatar
  • 1,136
5 votes
Accepted

Why do OS locks require hardware support?

Since the OS manages scheduling, we guarantee mutual exclusion for the following steps. But how do you guarantee mutual exclusion inside the OS? On a single-processor machine¹, you know that only the ...
Gilles 'SO- stop being evil''s user avatar
4 votes

How does RAM is shared in multi core environment?

Memory access is not fully independent. As long as the cores work on different memory ranges (with distance considerably larger than the size of a "cache line", which caches consecutive memory values)...
jvb's user avatar
  • 221
4 votes

Why are most mutex implementations unfair?

'Priority inversion' is one reason that fairness can be undesirable. A low priority process hits the locked mutex and sleeps. Then a higher priority process hits it, and also sleeps. When the mutex ...
Jim Sawyer's user avatar
4 votes

What is the difference between a page and thread?

You're looking at very vague descriptions and asking "What's the difference between these things that haven't been described properly?" For a more detailed understanding, you should, well, look for ...
David Richerby's user avatar
4 votes
Accepted

What should be the minimum value when the two threads are executed concurrently

Here's a tricky interleaving. R1,R2 denote the independent logical registers used by the threads, while count is the shared ...
chi's user avatar
  • 14.5k
4 votes

How does a dual core microprocessors run so many programs?

It's great that you're curious. A simplified explanation follows with a few links to delve into: All of the programs running in parallel is actually an illusion that is created by the OS. Even if we ...
ss09's user avatar
  • 96
3 votes

Why are most mutex implementations unfair?

A fair mutex will spend more of its lifetime locked than an unfair mutex, all else being equal. Because a thread releasing an unfair mutex can always just unlock it. But a thread releasing a fair ...
Jason Ganetsky's user avatar
3 votes
Accepted

One rational interval function and one irrational, will they ever collide?

Could you make a theoretical device that could measure an irrational number of seconds? Maybe, but that would be impossibly hard. In the real world the computers clock, which runs the scheduler, is ...
lPlant's user avatar
  • 1,602
3 votes
Accepted

How does RAM is shared in multi core environment?

I learnt that multi core processors have more than one processing units Well having more than one processing unit is something present even outside multi-code processors. Processors which are able ...
AProgrammer's user avatar
  • 3,059
3 votes

What does it mean that a core supports 2 threads?

See Wikipedia on Computer Multitasking and Time-sharing, which have an explanation of how operating systems allow this. Basically, they switch between multiple threads. Read also about hardware ...
D.W.'s user avatar
  • 158k
3 votes

Why the most dominant programming languages didn't follow CSP thread model?

There are many approaches for concurrency, with different tradeoffs. We have threads with shared mutable state (e.g., SRC-style threading). We have coroutines (like Go). We have actor models with ...
D.W.'s user avatar
  • 158k
3 votes
Accepted

Can User Level Thread read/write Kernel thread?

No. In most operating systems, kernel memory is protected using virtual memory mechanisms, so a user process cannot read or write to kernel memory. A user thread is part of a user process, and has ...
D.W.'s user avatar
  • 158k
3 votes
Accepted

Deadlocks: Why if 2 threads are waiting for a lock from each other results in a deadlock?

The situation you are describing is not a deadlock. A deadlock would be more like this: Both Thread A and Thread B require both Lock 1 and Lock 2. Thread A first acquires Lock 1, then Lock 2. Thread ...
Jörg W Mittag's user avatar
2 votes

What threads share in general?

Threads share: Address space Heap Static data Code segments File descriptors Global variables Child processes Pending alarms Signals and signal handlers Accounting information Threads have their own:...
ericcurtin's user avatar
2 votes

Difference between IO threads and worker threads

I don't know NodeJs or .NET, and they would be off-topic here anyway, but the underlying concepts are common among programming frameworks and programming models, so I'll answer in general terms. The ...
Gilles 'SO- stop being evil''s user avatar
2 votes

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

One example of a language system built from bottom up to support this kind of situation is Erlang. It is well worth looking into. It is built around the concept that you create a lot of tasks. The ...
ghellquist's user avatar
2 votes
Accepted

Understanding google's user level threads in kernel threads

This is talking about user level threads, so they should all have the same memory context (virtual memory map). So while the threads need to be careful in doing so, they can all access each other's ...
PPenguin's user avatar
  • 327
2 votes
Accepted

Hardware thread context and register renaming

I am not expert about hardware threading but I know two different ways to achieve it with potentially different answers: Architectures where the CPU executes one thread at a time but switches on some ...
Amaury Pouly's user avatar
  • 1,181
2 votes

What is "time-slice multi-threading"?

Time-slice multithreading is the convectional multithreading where CPU creates an illusion of executing more than once program at a time but the CPU can execute only one of these programs at a time. ...
Pragya's user avatar
  • 380
2 votes

Work-stealing: where and how many to steal

I did some experiments about this myself a while back so I hope I can still give some insight. This approach is called "Idempotent Work Stealing" and was defined (to the best of my knowledge) here. It ...
gue's user avatar
  • 211
2 votes
Accepted

How can context switch affect the modification of a variable?

A context switch is simply the operating system pausing the execution of one process and starting another. As such, context switches are required for any concurrency problem since, if there are no ...
David Richerby's user avatar
2 votes

Why are threads called the unit of dispatch?

"Unit of dispatch" just means "the thing that gets scheduled."
David Richerby's user avatar
2 votes
Accepted

Why the most dominant programming languages didn't follow CSP thread model?

Practically speaking, the C++ threading (memory) model is directly inspired by the Java Memory Model, and C followed. Hans Böhm was closely involved with the process and has a great resource list. (*) ...
MSalters's user avatar
  • 865
2 votes

What are the differences between Earliest Deadline First (EDF) and Earliest Due Date (EDD)?

Yes, that's right. In fact I think we can say that EDD is a special case of EDF, where all the processes have arrived at the same time.
Cror2014's user avatar
  • 121
2 votes

Why do OS locks require hardware support?

OS locks require hardware support because every instruction in the ISA takes multiple clock cycles to complete. It has to go through a instruction execution cycle having fetch,decode,execute,write... ...
ajit's user avatar
  • 376

Only top scored, non community-wiki answers of a minimum length are eligible