Questions tagged [context-switching]

62 questions
2
votes
2 answers

Context switching when a thread invokes a system call

I have a process with multiple threads. If one of my threads invokes a system call like gettimeofday(), does the kernel only switch that thread out of context to service the system call, or does it switch the entire process (and all other threads)…
Jay Piscean
  • 47
  • 1
  • 7
2
votes
0 answers

How many asynchronous cores should I use?

In an ideal async program, every event loop is always occupied with zero downtime between receiving data and polling->action-execution. My program listens on an array of ports, and the polling and movement of data into a queue occurs on a single…
Thomas Braun
  • 505
  • 3
  • 14
2
votes
1 answer

Launching parallel network tasks using xargs whilst minimising context switching overhead

I want to run 100 networking (non cpu intense) jobs in parallel and want to understand the best approach. Specifically is it possible to run 100+ jobs using xargs and what are the drawbacks? I understand that there is a point where there is more…
Darthtrader
  • 238
  • 1
  • 8
2
votes
2 answers

Grails - switching data sources based on User

We are developing a Grails web application, where different users (customers) need to be pointed at different databases containing only their organization's data. Unfortunately, the separated databases are a requirement, and we are being asked to be…
2
votes
3 answers

Unnecessary Java context switches

I have a network of Java Threads (Flow-Based Programming) communicating via fixed-capacity channels - running under WindowsXP. What we expected, based on our experience with "green" threads (non-preemptive), would be that threads would switch…
Paul Morrison
  • 1,694
  • 3
  • 20
  • 35
2
votes
2 answers

Calling printf prevents segfaulting

IT engineering student here. We're asked to play around with context switching and one particular assignment had us implement a rather crude try/throw system. Here's the code we've been writing: struct ctx_s { int esp; int ebp; }; struct ctx_s…
Peniblec
  • 437
  • 5
  • 18
1
vote
3 answers

Possible to catch the OS doing Context Switching on threads?

I would like to know how to catch a thread being interrupted by a Context Switch in java. I got two threads running side by side, which are both changing the same int up and down, and I would like for the sake of my report, to know how to catch the…
Martin
  • 157
  • 1
  • 11
1
vote
2 answers

How to calculate context swicthing for anonymous plsql block

How many context switches will happen for the below given plsql block Declare ll_row_count number := 0; begin for i in (select * from employee) loop ll_row_count := ll_row_count+1; update employee set emp_name =…
1
vote
1 answer

Will context-switching happen when thread changes its state?

In java, will context switching happen when thread is changing its state? I've googled a lot of sites, but did't find any article mentioned about this. so if anyone can help would be appreciated. like this: doSomething(); //when Thread.sleep() is…
1
vote
0 answers

Linux's context switching speedy?

I'm studying linux kernel. I read this, "Linux's system call is faster than many other OS, reason is linux's fast context switching time. Process's context switching is very simple and system call handler is simple too". What's mean of this?? why…
1
vote
0 answers

JVM Threads and Context Switching from the memory standpoint

I'm not sure if this is a vague question, if it is then I would be more than happy to be pointed a direction to get some clarity. I've got a bunch of Java Tests (30 to be precise) that gets run using a Parallel Runner (it uses a Threadpool). Each…
user1189332
  • 1,773
  • 4
  • 26
  • 46
1
vote
2 answers

Context Switching delay in centos7

In my C application, the main process forks a child process and then sleeps for ten microseconds to give the child time to get ready. After the sleep period, the parent process sends a signal to the child process to start listening on the specified…
1
vote
2 answers

Context Switch OS : How much and How frequent Context Switching is recommended for OS?

I was asked to answer a question about the OS context switch and I cannot find the answer in my textbook. How much and How frequent Context Switching is recommended for OS?
1
vote
1 answer

Minimize Context Switching Time between process

I have 4 process sharing a common semaphore, all the process have the same priority. The critical region inside the lock, has the read/write operation including the fflush() call. In the logs, I observed that after giving off the semaphore from a…
Saran-san
  • 361
  • 3
  • 14
1
vote
2 answers

High CSwitch ("context switch") when using Boost interprocess code (on Windows, Win32)

I'm writing a multithreaded app. I was using the boost::interprocess classes (version 1.36.0) Essentially, I have worker threads that need to be notified when work is available for them to do. I tried both the "semaphore" and "condition"…
John
  • 1,974
  • 2
  • 25
  • 32