OSDev.org

The Place to Start for Operating System Developers
It is currently Sat Apr 27, 2024 3:09 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Calling of the scheduler and IPL/DPC
PostPosted: Mon Nov 13, 2023 4:56 am 
Offline

Joined: Thu Nov 09, 2023 1:45 am
Posts: 2
Hello everyone!

I'm in the process of rewriting my scheduler because I came across a big mistake that I built my scheduler on.
I have set up my scheduler so that it receives an interrupt context as an argument.
This is of course unfavourable if, for example, a thread wants to sleep. So that I can then call the scheduler, I would have to fire a self-ipi. But this option is not particularly attractive. Or even if I just want to yield, I would also have to generate a self-ipi.
Or how else is this regulated?

I've just seen both. LyreOS always uses the interrupt context and uses a self-ipi for this.
Others have a separate context from the TrapFrame, which only saves the callee-saved registers and you can switch back and forth freely in the kernel.

Option two would be nicer, wouldn't it?

Which brings me to my next question.
I'm in the process of implementing a kind of event queue for various things. For example, an event is generated when a thread goes to sleep. This event is in the future and is practically the wake_up function. With a timer, which always fires on the closest event in time, the handling function for the event is then called in the timer_interrupt.
Should I also include the preemption of a thread in this event queue? Or should I rather have a periodic timer in the scheduler that creates a timer interrupt where I can preempt?
What would you prefer?

My last question would be about IPLs and DPCs in general.


At the beginning of the interrupt context, the IPL is raised to the IPL of the respective interrupt.
So that no low-order interrupt can interrupt it.
At the end, I fall back to the old IPL.
In the function that reduces my IPL, I then check whether I have fallen below the level for DPCs, don't I?
If this is the case, then the DPCs that have joined the DPC queue in the meantime are executed in sequence, but am I right in assuming that they are still executed in the interrupt context? Or will they be executed differently at some point?

I am/was of the opinion that this still happens in the interrupt context, but I'd better ask again.

I hope this is the right category for this sort of questions.
Cheers


Top
 Profile  
 
 Post subject: Re: Calling of the scheduler and IPL/DPC
PostPosted: Tue Jan 16, 2024 12:46 am 
Offline

Joined: Thu Nov 09, 2023 1:45 am
Posts: 2
I figured this stuff already out.

I decided to make reschedule an event in the EventQueue too and don't schedule anything with a TrapFrame or anything. So, independently from interrupts.
Since the DPC mechanism is quite attractive I also implemented it.
I got the needed information from Inside Windows NT and Windows Internals book.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 14 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group