Questions tagged [context-switching]

62 questions
9
votes
3 answers

How is context switching of threads done on a multi-core processor?

When doing context switching on a single-core processor, the code responsible is executed on the only CPU which takes care of switching the threads. But how is this done when we have multiple CPUs? Is there a master CPU which does all the context…
gablin
  • 4,678
  • 6
  • 33
  • 47
7
votes
1 answer

Context Switches on Sleeping/Waiting Threads

I'm trying to understand how operating systems handle context switching in different models to better understand why NIO performance is better in cases of large peaks in the number of requests. Apart from the fact that there may be a limit to the…
6
votes
2 answers

iOS4 - fast context switching

When application enters in background running state, how much dirty memory usages is good to go. In apple video it's mentioned that the dirty memory should be reduced as much as we can. But in my App, I am using navigation controller to push and pop…
Sunil Khedar
  • 441
  • 1
  • 3
  • 16
5
votes
2 answers

Context Switch Time in Linux Kernel

In Linux Kernel when processor context switches from one thread to another , the state of the registers are saved into PCB and some more bookkeeping is done to ensure that the exact state can be loaded again. This whole saving and loading of the…
5
votes
2 answers

Where can I find specifics about Windows 10's process scheduling?

I'm currently learning about CPU scheduling and I'm curious about the specifics on Windows 10's scheduling. From what I know a round-robin scheduling is used along with differing levels of priority, but where can I find the specific time quantum…
5
votes
1 answer

entering critical section and context switching in c++

I'm new to thread programming (currently need to use win32 and c++ in a company project) and I just want to ask does entering the critical section means no context switching? does it mean that the thread will lock the resources until it leaves the…
M.R.M
  • 540
  • 1
  • 13
  • 30
4
votes
4 answers

java: Why does not both threads execute in parallel

I am trying to understand the intrinsic locks in java. I have a program where I start 2 threads which will loop thru and call synchronized methods on a same object. I expect that both threads to execute things in parallel but Looks like it executes…
Sam Daniel
  • 1,800
  • 12
  • 22
4
votes
1 answer

POSIX: how to perform a context switch between threads?

I want to implement the context switching between threads using Xilkernel, but there is no primitive POSIX-compliant that allows to stop and then resume the execution of a thread. Is there anyone who can help me?
khaledrmse
  • 41
  • 1
4
votes
3 answers

How long is the time frame between context switches on Windows?

Reading CLR via C# 2.0 (I dont have 3.0 with me at the moment) Is this still the case: If there is only one CPU in a computer, only one thread can run at any one time. Windows has to keep track of the thread objects, and every so often, Windows has…
user53791
4
votes
1 answer

Is the overhead of acquiring a lock dependent on the OS timer resolution when there is a context switch?

Suppose thread 1 tries to acquire a lock on the lockObj object using the lock(lockObj) statement, but this object is already locked by thread 2 at the moment thread 1 tries to acquire a lock on it. Thread 1 will block, right? Now suppose that during…
3
votes
2 answers

Why is this code acting different with a single printf? ucontext.h

When I compile my code below it prints I am running :) forever(Until I send KeyboardInterrupt signal to the program), but when I uncomment // printf("done:%d\n", done);, recompile and run it, it will print only two times, prints done: 1 and then…
3
votes
2 answers

Measure context switching in java

I have a java system doing lot of i/o operations. I do understand that non CPU bound tasks can benefit from # of threads more than #CPUs. As I/O operations time is non deterministic(I don't know how many threads I should initialize in pool). I…
Rohit Sachan
  • 1,178
  • 1
  • 8
  • 16
3
votes
1 answer

Performance impact of function calls in an SQL Query (About Context Switching)

Are there any performance impact in calling functions in an SQL statement due to context switching between SQL and PL/SQL engines? Or is the potential impact dependent on the function called? Calling built-in functions: select…
user3367701
  • 823
  • 1
  • 8
  • 17
3
votes
1 answer

Counting the number of context switches in a c program when that program is executed

I want to output the number of context switches that are performed by the windows OS while executing my program.
Ganapa
  • 73
  • 1
  • 9
3
votes
0 answers

My linux server "Number of processes created" and "Context switches" are growing incredibly fast

EDIT: More detailed answers here: https://serverfault.com/questions/454192/my-linux-server-number-of-processes-created-and-context-switches-are-growing I have a strange behaviour in my server :-/. Is a VPS. When I do cat /proc/stat, I can see how…
Jorge Fuentes González
  • 11,568
  • 4
  • 44
  • 64
1
2 3 4 5