Questions tagged [context-switching]

62 questions
0
votes
1 answer

Limitation of max. threads one can create in Multi-threading

I have multiple threads being invoked by say several other processes at the same time. Generally the thumb rule for max. number of threads that a processor can start giving performance efficiency is no. of threads = no. of processors + 1 (not sure…
A_Var
  • 1,056
  • 1
  • 13
  • 23
0
votes
1 answer

How does interrupt polling perform context switching?

Consider a very old single-core CPU that does not support hardware interrupts, and let's say I want to write a multi-tasked operating system. Using a hardware timer, one can poll an IRQ line in order to determine whether the timer has elapsed, and…
MathuSum Mut
  • 2,765
  • 3
  • 27
  • 59
0
votes
0 answers

Saving the values of hardware registers for a process during context switching

Whenever an interrupt occurs, processor stores the current state in cpu registers.In https://en.wikipedia.org/wiki/Process_control_block , it is mentioned that when context switching occurs, kernel saves the contents of cpu or hardware registers for…
0
votes
1 answer

What should be Memory Protection Strategy for ARM Cortex CPU?

I need to implement a multitasking system with MPU for ARM Cortex M3/M4 processors. In that system, there will be a Kernel which manages resource in Privileged mode and user applications in Unprivilege mode. And I want to seperate User Application…
muratcakmak
  • 325
  • 2
  • 14
0
votes
1 answer

Context Switching among multiple threads in Java

What constitutes Context Switching? I know it can be by using sleep() at times. I came across an example using a combination of wait() and notify() to carry out inter-thread communication so that one thread (of Producer class) supplies a data set…
user2029261
  • 1
  • 3
  • 6
0
votes
1 answer

pthreads code not scaling up

I wrote the following very simple pthread code to test how it scales up. I am running the code on a machine with 8 logical processors and at no time do I create more than 8 threads (to avoid context switching). With increasing number of threads,…
archita
  • 1
  • 1
0
votes
2 answers

Saving ARM NEON registers while context switching in Android

At the time of context switching Android saves all ARM general registers on stack and restore it after. Does Android OS stores NEON registers on stack? If not, how to make a safe usage of NEON in multi-threading and multi-tasking environment?
Dmitri
  • 103
  • 11
0
votes
2 answers

How to make text clickable in TextSwitcher so that it can open another activity?

I have a Text Switcher in my app. Everything is working. My text is switching, but I want to open another activity when the text in the Text Switcher is clicked. How can I achieve this in android ?? Thanks in advance :) Code of text switcher is…
raman rayat
  • 404
  • 5
  • 15
0
votes
1 answer

Custom sp_who/sp_whoUsers

I need to allow a client in a dev DW SQL 2K8R2 environment, to view and kill processes, but I do not want to grant VIEW SERVER STATE to this person (he's a former sql dba and is considered a potential internal threat). When I run the following, it…
0
votes
1 answer

Context switching of ObjectOutput / InputStream

An open ObjectOutputStream sends a certain object initially, and the complementing ObjectInputStream successfully deserializes it. This OIS is then passed to the constructor of a separate thread class, which is required to continue read()ing further…
0
votes
3 answers

PHP context switching

From the Classic ASP world, there was that issue of context switching. Context switching is you open PHP tags, you write a little bit of a php code, then you close the tags, you go on with a little bit of HTML and go back to PHP and keep doing these…
Average Joe
  • 4,521
  • 9
  • 53
  • 81
-1
votes
2 answers

How to check performace of Multi Threading over using only a single thread?

I'm studying Java multi threading and trying to check performance with multiple threads.I am trying to check whether multi threading is better than with single thread. So, I wrote a code which sums to limit. It is working as I expected(multiple…
zz9z9
  • 11
  • 3
-1
votes
1 answer

Why is the context not saved in the process itself instead of the PCB?

I have read that when a context switch happens, the context of that particular process will be saved in the process control block. But I wonder why the context couldn't be saved in the process itself so the CPU only had to remind itself which…
NimaJan
  • 162
  • 1
  • 13
-1
votes
2 answers

Why to sleep 1?

I understand that, in a endless loop or somewhere else, you could sleep(0) to leave the OS to perform a context-switching and execute another thread (if there is and it is ready to execute). Now, I saw a bunch of code where people use sleep(1)…
EProgrammerNotFound
  • 2,403
  • 4
  • 28
  • 59
-2
votes
1 answer

How does the scheduler interrupt the CPU?

So what I would like to know is when the thread scheduler performs a context switch how is the CPU interrupted so the task of switching over to a different process gets accomplished? Does the CPU get paused or go into sleep mode while the new…