Borland Pascal 7 MULTITASKING

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
User avatar
inflater
Member
Member
Posts: 1309
Joined: Thu Sep 28, 2006 10:32 am
Location: Slovakia
Contact:

Borland Pascal 7 MULTITASKING

Post by inflater »

Hi, i am writing PortixOS in Pascal - 16 bit, MONOTASKING :D

I want to put to my OS multitasking and I am REALLY TOTAL NOOB in multitasking; I only know that mutitasking can run more than one program but not more...
I have read the FAQ and Lino Commando OS dev'ing :D yep, i feel like him :D
How I do multitasking? I can access BIOS (INT 15h, there are some functions) and I dont know what, where to start...
I have some mem managment though.

I also readed this:
http://www.osdev.org/osfaq2/index.php/M ... %20Systems

Thanks
inflater
My web site: http://inflater.wz.cz (Slovak)
Derrick operating system: http://derrick.xf.cz (Slovak and English :P)
PyroMathic
Member
Member
Posts: 33
Joined: Wed Apr 26, 2006 11:00 pm

Post by PyroMathic »

lo,

Basicly all you need is something that switches from 1 task to another, like if the PIC irq is trigert, you go from task x to another.

Between task-switsches you do need to save the state of the task, so the task can resume at some other point whitout even knowing it was interupted.

If you got something like that, you just need to make sure that 1 task cant modify data from task 2.
So for example if you alloc some memory it might be smart to make sure the task cant be interupted untill it is done whit changing kernell var's (globals), otherwise you can get very random error's and bugs.


I did the following in my os: a kernell which cant be interupted by IRQ's, and several (thus far only 2) user "programs" which all run in there own memory and can be interupted whenever an irq is trigert.

Regards.
Pyromathic
User avatar
inflater
Member
Member
Posts: 1309
Joined: Thu Sep 28, 2006 10:32 am
Location: Slovakia
Contact:

Post by inflater »

Basicly all you need is something that switches from 1 task to another, like if the PIC irq is trigert, you go from task x to another
OK. If I understand correctly, all i have to do is make a simple interrupt that will change task, like INT FFh, AX=0003 will point to "Change task to ring 3 (or something)", i know to make INTerrupts.

Or IRQ?
for example - When there is something typed to keyboard (IRQ1), change task to XYZ.

But how to change tasks?

inflater
My web site: http://inflater.wz.cz (Slovak)
Derrick operating system: http://derrick.xf.cz (Slovak and English :P)
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post by Dex »

Here a TP unit for multi-tasking http://www.programmersheaven.com/downlo ... nload.aspx

Also i remember Alexei A. Frounze doing TP multi-tasking demo, but you need to search, or ask him as he is useally on here:
http://groups.google.com/group/alt.os.development/

PS: Your type of multi-tasking is differant, baseally you load two programs in to memory, give them differant stacks, you then hook into the timer int that fire about 18 times a second, what multi-tasking does, is store all the reg from one program on its stack than loads the reg from another program from it stack runs that program until the timer fires again, and keep swooping them round.
This is the most base, there lot of other thing but to understand i have just said the basics.
Post Reply