Pre-emptive multitasking / paging

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
oschaos
Posts: 3
Joined: Mon Jun 14, 2010 2:47 pm

Pre-emptive multitasking / paging

Post by oschaos »

anyone know were I can get more info on these?
links... asm code examples? ect...

Thanks in advance..
StephanvanSchaik
Member
Member
Posts: 127
Joined: Sat Sep 29, 2007 5:43 pm
Location: Amsterdam, The Netherlands

Re: Pre-emptive multitasking / paging

Post by StephanvanSchaik »

oschaos
Posts: 3
Joined: Mon Jun 14, 2010 2:47 pm

Re: Pre-emptive multitasking / paging

Post by oschaos »

check Wikipedia and do some research.... #-o just joking.. I have.. 8)

sometimes asking ... helps to narrow down sites people have used... and that are good sites to goto.. that in some cases take a while to find...
its not good learning going to a site that miss informs one on the methods used... and a waste of time.. so asking for a good site/ download/ example code from someone experienced helps not to make mistakes on a website that is outdated or just wrong... anyone can make a webpage...

but thanks..
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Pre-emptive multitasking / paging

Post by Combuster »

If you did do your research (which truly is doubtful, see the link why), you definitely broke the smart questions forum rule which would have prevented the response you just received. (Which, to be honest, could have been much worse)

Stay safe, and happy coding.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
gravaera
Member
Member
Posts: 737
Joined: Tue Jun 02, 2009 4:35 pm
Location: Supporting the cause: Use \tabs to indent code. NOT \x20 spaces.

Re: Pre-emptive multitasking / paging

Post by gravaera »

okay #-o .. but it's generally okay to trust wikipedia 8) ... since IT related topics are usually edited by persons who are interested in, and know about IT .. so you should attempt to look up topics there... and on various other websites... before posting.. so that you don't disrupt the flow of the forum..

you'll generally learn a lot from reading documentation from currently existing kernels.. and from papers written by researchers... and from reading source code.. linux is useful for that... there are linux lexers online... those are good for quick browsing to find asm source code examples.. 'ect'...like you asked...

and asking about paging is not very productive either.. since paging and virtual memory implementations on various processors differ greatly... there are many different processor architectures... what you want to do is dive into the manuals for your target architecture... and see how virtual memory/paging is implemented in that architecture..

but thanks..
17:56 < sortie> Paging is called paging because you need to draw it on pages in your notebook to succeed at it.
oschaos
Posts: 3
Joined: Mon Jun 14, 2010 2:47 pm

Re: Pre-emptive multitasking / paging

Post by oschaos »

what you want to do is dive into the manuals for your target architecture... and see how virtual memory/paging is implemented in that architecture..
and that is a good ans.. that will direct me to the manual.. instead of jumping around to website to website... see... was not a waste of time for me..
Thanks..
those are good for quick browsing to find asm source code examples
yes but many are outdated...

Thanks again! :-)
StephanvanSchaik
Member
Member
Posts: 127
Joined: Sat Sep 29, 2007 5:43 pm
Location: Amsterdam, The Netherlands

Re: Pre-emptive multitasking / paging

Post by StephanvanSchaik »

oschaos wrote:and that is a good ans.. that will direct me to the manual.. instead of jumping around to website to website... see... was not a waste of time for me..
Thanks..
I don't think you even bothered looking at the links. Seriously, being spoon-fed and still not swallowing it.


Regards,
Stephan J.R. van Schaik.
rknox
Member
Member
Posts: 55
Joined: Wed Apr 28, 2010 9:07 am

Re: Pre-emptive multitasking / paging

Post by rknox »

You have not told us what you know thus it is hard to answer.

But

The intel SPg 253668.pdf (search web) has good descriptions of many of the basics you need. Chpts 3 to 7 or so.

There is a good wiki at this site on programming the Programmable Interval timer.

The book "Operating Systems ..." by Tanenbaum - old book - cheap used at Amazon - has good discussion of scheduling algos. Old book is ok since people have been doing preemptive multi tasking since the 1960's.

enjoy

~~
rknox
Member
Member
Posts: 55
Joined: Wed Apr 28, 2010 9:07 am

Re: Pre-emptive multitasking / paging

Post by rknox »

Pre emptive mulit tasking. Here is more or less what happens whan a task has completed it’s time slice. I really don’t know from your question whether this is old stuff to you, or useful. I don’t deal here with tasks that are blocked waiting for I/O. That is a different discussion.

You write an assembler timer interrupt routine to respond to interrupts from the PIC. If you don’t reprogram the PIC it interrupts about every 50 ms. Every N interrupts - maybe 2? - you decide - the routine saves the context on the stack, calls code that can be compiled - lets assume C code.

When the C code returns, the assembler code restores the context and issues an IRET instruction - not RET - to allow the application involved to resume. The resuming application may or may not be the application that was running when the interrupt occured.

But it’s a little more complicated than I described.

The C code looks to see whether there is anyone waiting. If not it returns, otherwise it ques the old task in the waiting que, subsitutes the task at the top of the list, and allows the timer interrupt routine to transfer control to that task.

If that is too basic - plese excuse. Next time be more detailed. If some of those here with greater knowledge want to amplify I would be happy to defer to them.
Post Reply