328 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
Advice
1
vote
2
replies
142
views
How the Computer Handles Interrupts
What is the difference between an interrupt and a context switch?
I understand the concept of an interrupt and how it occurs. However, I'm digging deeper into the topic.
I studied Computer ...
2
votes
1
answer
137
views
Context switch in interrupt routine
I am writing an interrupt routine for RISC-V. Interrupts occur in U-mode and are handled in S-mode.
Upon an interrupt, I want to save the user execution context on the kernel stack of the thread that ...
0
votes
0
answers
47
views
ARM context switch using MSP
I'm experimenting with STM32 baremetal context switching and came across this article. In it, the thread 0 is using MSP and others use PSP. I don't understand, how could thread context be saved on MSP ...
0
votes
0
answers
51
views
How does the ROB track instructions from multiple logical threads in a core?
If a core supports simultaneous multithreading (SMT) and executes multiple logical threads, how does the Reorder Buffer (ROB) differentiate which instruction belongs to which logical thread?
...
0
votes
0
answers
44
views
Does Preemptive Scheduling Inherently Require Time Slices?
I'm studying operating systems and have encountered conflicting information about preemptive scheduling, specifically regarding SRT (Shortest Remaining Time) scheduling. My question focuses on whether ...
0
votes
1
answer
98
views
Implementing a context-switching mechanism in asyncio
I wish to create something similar to a context switching mechanism, that allows using a shared resource one at a time.
In my case it's a single session object connecting to a website, and each ...
0
votes
1
answer
66
views
Task switch during fork() causes random stack errors
I'm working on multitasking for my OS, more specifically fork() for usermode ELF-binaries (they call it by a syscall).
After calling fork, it manages to return to the parent process (sometimes) but on ...
1
vote
1
answer
125
views
How can I restore the cpu status? (restoring the cpu registers x86_64)
I am implementing context switching for my first os and I came into a little problem I cannot solve which is restoring the cpu status after saving it from a struct. As all the registers have to be ...
0
votes
0
answers
88
views
how to save the current CPU state in rust
i am trying to add context switching to my first os what is the best method to do so?
i have been trying different methods for a while now, this is my last attempt:
use core::arch::asm;
use crate::...
0
votes
0
answers
68
views
NIC context switch with PREEMPT-RT
In the communication (with UDP protocol) between a Ubuntu 20.04 PC, patched with PREEMPT-RT, and an external machine, the nominal behavior foresees an alternating packet exchange between the two ...
1
vote
0
answers
89
views
How is cpu's state saved by os without altering it?
During the context switch the operating system (OS) needs information from the CPU to create a Process Control Block (PCB), but accessing the CPU could alter the very information it's trying to ...
1
vote
1
answer
115
views
Why doesn't this pop instruction restore the register values?
I'm studying an OS implemented in a stm32f103rb. I arrived at 02-ContextSwitch-1 chapter and found that the program crashes and throws this error.
qemu: fatal: Trying to execute code outside RAM or ...
0
votes
0
answers
44
views
Can a context switch between threads of the same process occure during signal handling?
Logic tells me that in Linux, the OS does not allow context switchwes between threads of the same process during the operation of a signal handler, but I wasn't able to find anything concrete about it ...
1
vote
0
answers
291
views
Difference in overhead of a mode switch vs intra-process context switch on Linux
I've searched for it several times and I don't think it's a duplicate.
AFAIU, context switches typically (e.g. on Linux) happen in kernel mode, and there are a few answers on SO stating that mode ...
0
votes
0
answers
500
views
Too much context switches - how to be sure that it is actual problem?
I suspect that my application suffers from too much context switches. There is huge amount of threads (do not ask why) and I wonder whether overhead related to switching context becomes problematic. ...